maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Baptiste MATHUS ...@batmat.net>
Subject Re: Multiple JDK versions
Date Tue, 25 Jun 2013 10:01:52 GMT
Well, if you have multiple customers, some on 1.5, some on 1.6, then just
release a 1.5 version.
It will work perfectly with both 1.5 AND 1.6.

Please note this is actually what you certainly are already doing with a
lot of dependencies in your classpath. Not all have the same bytecode
version.

What you might just want to do that is running some integration tests on
your project.
To do that, you'd just need to execute the corresponding tests with some CI
environment (like Jenkins, to illustrate/be clear).

About your question for source and target parameters, please note this is
actually something related to javac, not the maven-compiler-plugin.
See http://docs.oracle.com/javase/1.5.0/docs/tooldocs/solaris/javac.html

To sum up:
* source is asking the compiler you're not using things of upper jdk in
your *source* code
* target is asking the compiler to generated bytecode that will run on the
specified JRE (minimum).

Cheers



2013/6/25 virg g <06virg@gmail.com>

> Yes. We have multiple customers, some of them support 1.5 and others 1.6.
> We need to release both the builds with 1.5 and 1.6. Right now i am
> initiating build separately one after the other, setting JAVA_HOME
> correctly and passing jdk-version according build i need, this parameter i
> am setting for both source and target. Sending both the parameters
> JAVA_HOME, jdk-versions(1.5 to 1.6 to set source and target)  is kind of
> duplicate and also we need to ensure that both are in parameters Sync and
> should match, should be not any mistakes.
> Looking for right solution. As you suggested matrix build, i will check.
> Any other best solutions?
>
> This is plugin i am using
> <plugin>
> <groupId>org.apache.maven.plugins</groupId>
>  <artifactId>maven-compiler-plugin</artifactId>
> <version>2.5.1</version>
>  <configuration>
> <source>${jdk-version}</source>
> <target>${jdk-version}</target>
>  <encoding>${project.build.sourceEncoding}</encoding>
> <executable>${JAVA_HOME}/bin/javac</executable>
>  <compilerArguments>
> <J-Xms1024m/>
> <J-Xmx1024m/>
>  </compilerArguments>
> <fork>true</fork>
> </configuration>
>  </plugin>
>
> Thanks
> Virg
>
>
> On Tue, Jun 25, 2013 at 12:39 PM, Baptiste MATHUS <ml@batmat.net> wrote:
>
> > Hi,
> > +1 on the question, do you really need to build for both versions? As JDK
> > is backward compatible, you could for example build only with 1.5.
> >
> > Maybe you only want to test your build on a 1.5 and 1.6, then I
> personally
> > would prefer keeping a quite simple build and keep those combinations on
> > some CI server like jenkins (see matrix build in this case).
> >
> > Cheers
> > Le 25 juin 2013 08:16, "Ron Wheeler" <rwheeler@artifact-software.com> a
> > écrit :
> >
> > > Why do you need to compile with 2 versions?
> > > You can run apps compiled with 1.5 under 1.6.
> > >
> > > I am not sure that the value of JAVA_HOME has any effect on compiling.
> > > Check the settings in the compile plug-in.
> > >
> > > Ron
> > >
> > >
> > > On 25/06/2013 1:59 AM, virg g wrote:
> > >
> > >> Hi, I need build my project  with multiple jdk versions 1.5 and 1.6. I
> > >>
> > > > am using maven compiler plugin to set the compiler based on JAVA_HOME
> > > > set. Is it mandatory to set target either 1.5 or 1.6 based on the jdk
> > > > version i want to build. Why because if i set compiler to jdk 1.6, in
> > > > the debug log it shows that target is 1.5 but it should be 1.6 right?
> > > > target should set automatically based on JAVA_HOME right unless i
> > > > specically mention the target if i want to change? Any pointers for
> > > > my problem?
> > > >
> > > > [DEBUG]   (f) executable = D:/jdk1.6.0_14/bin/javac [DEBUG] (f)
> > > > source = 1.5 [DEBUG]   (f) staleMillis = 0 [DEBUG]   (f) target =
> > > > 1.5
> > > >
> > > > Thanks virg
> > > >
> > >
> > >
> > > --
> > > Ron Wheeler
> > > President
> > > Artifact Software Inc
> > > email: rwheeler@artifact-software.com
> > > skype: ronaldmwheeler
> > > phone: 866-970-2435, ext 102
> > >
> > >
> >
>
> --
> Baptiste <Batmat> MATHUS - http://batmat.net
> Sauvez un arbre,
> Mangez un castor ! nbsp;!
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message