You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by virg g <06...@gmail.com> on 2013/04/08 12:41:02 UTC

Multiple JDK Versions

Hi,
I want to compile my code with multiple JDK versions 1.4, 1.5, 1.6. I am
using maven-compiler-plugin 3.0.
i am changing <executable>${JAVA_1_5_HOME}/bin/javac</executable> parameter
in maven-compiler-plugin and also set source and target to 1.5. But my
default JAVA_HOME is 1.6. The source is getting compiled with 1.5 java
compiler. But if the  the manifest file version always shows Build-Jdk: as
1.6. It is picking from my JAVA_HOME, Not the the javac version it is
built. I have tried same thing even with maven-toolchains-plugin  plugin
also by setting all jdk paths. How to change manifest  info to point to
correct jdk? Do i have to reset JAVA_HOME everytime if i change jdk?

Re: Multiple JDK Versions

Posted by Stephen Connolly <st...@gmail.com>.
http://maven.apache.org/plugins/maven-jar-plugin/examples/manifest-customization.html


On 8 April 2013 12:41, virg g <06...@gmail.com> wrote:

> Thank you for the reply. As a developer i would be knowing, whether it is
> compiled with which jdk version. Once project's jars/wars released, they
> will be validated/tracked with Build-Jdk of manifest info of jars and wars,
> which is actually showing different than actual. At least how to override
> this property in maven-jar-plugin. What is the property is generates
> Build-JDK
> value? so that atelast i cna use this.
> Thank you. Help is highly appreciated
>
>
> On Mon, Apr 8, 2013 at 4:51 PM, Stephen Connolly <
> stephen.alan.connolly@gmail.com> wrote:
>
> > The manifest is not generated by JavaC but by the tool used to JAR up the
> > files. That would be the Maven Jar Plugin which does not fork the build
> but
> > actually generates the JAR file using the JRE that you launch Maven with.
> >
> > It should not matter whether you use Java 1.2 or Java 1.8 to JAR up the
> > files as the JAR specification has not changed. What should matter to you
> > is the bytecode version, and there are tools such as AnimalSniffer that
> can
> > help you verify that the bytecode version is the version you believe it
> > should be
> >
> >
> > On 8 April 2013 11:41, virg g <06...@gmail.com> wrote:
> >
> > > Hi,
> > > I want to compile my code with multiple JDK versions 1.4, 1.5, 1.6. I
> am
> > > using maven-compiler-plugin 3.0.
> > > i am changing <executable>${JAVA_1_5_HOME}/bin/javac</executable>
> > parameter
> > > in maven-compiler-plugin and also set source and target to 1.5. But my
> > > default JAVA_HOME is 1.6. The source is getting compiled with 1.5 java
> > > compiler. But if the  the manifest file version always shows Build-Jdk:
> > as
> > > 1.6. It is picking from my JAVA_HOME, Not the the javac version it is
> > > built. I have tried same thing even with maven-toolchains-plugin
>  plugin
> > > also by setting all jdk paths. How to change manifest  info to point to
> > > correct jdk? Do i have to reset JAVA_HOME everytime if i change jdk?
> > >
> >
>

Re: Multiple JDK Versions

Posted by virg g <06...@gmail.com>.
Thank you for the reply. As a developer i would be knowing, whether it is
compiled with which jdk version. Once project's jars/wars released, they
will be validated/tracked with Build-Jdk of manifest info of jars and wars,
which is actually showing different than actual. At least how to override
this property in maven-jar-plugin. What is the property is generates Build-JDK
value? so that atelast i cna use this.
Thank you. Help is highly appreciated


On Mon, Apr 8, 2013 at 4:51 PM, Stephen Connolly <
stephen.alan.connolly@gmail.com> wrote:

> The manifest is not generated by JavaC but by the tool used to JAR up the
> files. That would be the Maven Jar Plugin which does not fork the build but
> actually generates the JAR file using the JRE that you launch Maven with.
>
> It should not matter whether you use Java 1.2 or Java 1.8 to JAR up the
> files as the JAR specification has not changed. What should matter to you
> is the bytecode version, and there are tools such as AnimalSniffer that can
> help you verify that the bytecode version is the version you believe it
> should be
>
>
> On 8 April 2013 11:41, virg g <06...@gmail.com> wrote:
>
> > Hi,
> > I want to compile my code with multiple JDK versions 1.4, 1.5, 1.6. I am
> > using maven-compiler-plugin 3.0.
> > i am changing <executable>${JAVA_1_5_HOME}/bin/javac</executable>
> parameter
> > in maven-compiler-plugin and also set source and target to 1.5. But my
> > default JAVA_HOME is 1.6. The source is getting compiled with 1.5 java
> > compiler. But if the  the manifest file version always shows Build-Jdk:
> as
> > 1.6. It is picking from my JAVA_HOME, Not the the javac version it is
> > built. I have tried same thing even with maven-toolchains-plugin  plugin
> > also by setting all jdk paths. How to change manifest  info to point to
> > correct jdk? Do i have to reset JAVA_HOME everytime if i change jdk?
> >
>

Re: Multiple JDK Versions

Posted by Stephen Connolly <st...@gmail.com>.
The manifest is not generated by JavaC but by the tool used to JAR up the
files. That would be the Maven Jar Plugin which does not fork the build but
actually generates the JAR file using the JRE that you launch Maven with.

It should not matter whether you use Java 1.2 or Java 1.8 to JAR up the
files as the JAR specification has not changed. What should matter to you
is the bytecode version, and there are tools such as AnimalSniffer that can
help you verify that the bytecode version is the version you believe it
should be


On 8 April 2013 11:41, virg g <06...@gmail.com> wrote:

> Hi,
> I want to compile my code with multiple JDK versions 1.4, 1.5, 1.6. I am
> using maven-compiler-plugin 3.0.
> i am changing <executable>${JAVA_1_5_HOME}/bin/javac</executable> parameter
> in maven-compiler-plugin and also set source and target to 1.5. But my
> default JAVA_HOME is 1.6. The source is getting compiled with 1.5 java
> compiler. But if the  the manifest file version always shows Build-Jdk: as
> 1.6. It is picking from my JAVA_HOME, Not the the javac version it is
> built. I have tried same thing even with maven-toolchains-plugin  plugin
> also by setting all jdk paths. How to change manifest  info to point to
> correct jdk? Do i have to reset JAVA_HOME everytime if i change jdk?
>