You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by Karl Heinz Marbaise <kh...@gmx.de> on 2016/05/27 22:21:53 UTC
Toolchain Example - Problem
Hi to all Devs,
I have made a setup for a toolchain example but I've found an issue
which i currently don't have good idea to solve.
https://github.com/khmarbaise/maven-toolchain-example
If I ran that everything works so far fine...i will get compiled the
different modules with different JDK's (6, 7, 8) which i have configured
in my toolchains.xml file. Also maven-compiler-plugin shows that it
recognizes the toolchain correctly etc.
But what I have stumbled over is that the entries in the MANIFEST.MF
files for Build-Jdk: ... are only showing the JDK which is used to run
Maven itself instead of the ones used to create the class files in
contradiction to the toolchain configuration...
Ok after looking into the code in maven-archiver I saw the reason for it:
addManifestAttribute( m, entries, "Built-By", System.getProperty(
"user.name" ) );
addManifestAttribute( m, entries, "Build-Jdk", System.getProperty(
"java.version" ) );
I already thought about using Toolchains in Maven-Archiver (or
maven-jar-plugin), but after i thinking about that a little bit longer I
declined that, cause toolchain needed to call a Tool like javac...apart
from the performance overhead it would produce to call javac -version
something to get the correct version of which has been used to compile
the classes etc.
What i could imagine is something like giving some kind of information
from maven-compile-plugin(?) via WhatEver??? to maven-jar-plugin ?
So the question is:
Does someone has a good idea to solve this kind of problem ?
Any hints/tips/ideas are appreciated...
Kind regards
Karl Heinz Marbaise
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org
Re: Toolchain Example - Problem
Posted by Robert Scholte <rf...@apache.org>.
On Sat, 28 May 2016 00:38:28 +0200, Michael Osipov <mi...@apache.org>
wrote:
> Am 2016-05-28 um 00:21 schrieb Karl Heinz Marbaise:
>> Hi to all Devs,
>>
>> I have made a setup for a toolchain example but I've found an issue
>> which i currently don't have good idea to solve.
>>
>> https://github.com/khmarbaise/maven-toolchain-example
>>
>> If I ran that everything works so far fine...i will get compiled the
>> different modules with different JDK's (6, 7, 8) which i have configured
>> in my toolchains.xml file. Also maven-compiler-plugin shows that it
>> recognizes the toolchain correctly etc.
>>
>> But what I have stumbled over is that the entries in the MANIFEST.MF
>> files for Build-Jdk: ... are only showing the JDK which is used to run
>> Maven itself instead of the ones used to create the class files in
>> contradiction to the toolchain configuration...
>>
>> Ok after looking into the code in maven-archiver I saw the reason for
>> it:
>>
>> addManifestAttribute( m, entries, "Built-By", System.getProperty(
>> "user.name" ) );
>> addManifestAttribute( m, entries, "Build-Jdk", System.getProperty(
>> "java.version" ) );
>
> This is, unfortunately, a wellknown problem.
>
>
>> I already thought about using Toolchains in Maven-Archiver (or
>> maven-jar-plugin), but after i thinking about that a little bit longer I
>> declined that, cause toolchain needed to call a Tool like javac...apart
>> from the performance overhead it would produce to call javac -version
>> something to get the correct version of which has been used to compile
>> the classes etc.
>>
>> What i could imagine is something like giving some kind of information
>> from maven-compile-plugin(?) via WhatEver??? to maven-jar-plugin ?
>>
>> So the question is:
>>
>> Does someone has a good idea to solve this kind of problem ?
>
> Haven't used Toolchains myself, I would expect the
> maven-toolchains-plugin to write an XML file to target which contains
> all necessary information about the forked VM/JDK. Very much like
> Surefire does.
> This standard file could be easily consumed. If present, you know that
> the Maven JDK has not been used but another one.
>
That's not going to work, toolchains is not aware of the tool being
executed. Instead maven-compiler-plugin should preserve this information
or prepare the MANIFEST file.
Robert
> Michael
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org
Re: Toolchain Example - Problem
Posted by Michael Osipov <mi...@apache.org>.
Am 2016-05-28 um 00:21 schrieb Karl Heinz Marbaise:
> Hi to all Devs,
>
> I have made a setup for a toolchain example but I've found an issue
> which i currently don't have good idea to solve.
>
> https://github.com/khmarbaise/maven-toolchain-example
>
> If I ran that everything works so far fine...i will get compiled the
> different modules with different JDK's (6, 7, 8) which i have configured
> in my toolchains.xml file. Also maven-compiler-plugin shows that it
> recognizes the toolchain correctly etc.
>
> But what I have stumbled over is that the entries in the MANIFEST.MF
> files for Build-Jdk: ... are only showing the JDK which is used to run
> Maven itself instead of the ones used to create the class files in
> contradiction to the toolchain configuration...
>
> Ok after looking into the code in maven-archiver I saw the reason for it:
>
> addManifestAttribute( m, entries, "Built-By", System.getProperty(
> "user.name" ) );
> addManifestAttribute( m, entries, "Build-Jdk", System.getProperty(
> "java.version" ) );
This is, unfortunately, a wellknown problem.
> I already thought about using Toolchains in Maven-Archiver (or
> maven-jar-plugin), but after i thinking about that a little bit longer I
> declined that, cause toolchain needed to call a Tool like javac...apart
> from the performance overhead it would produce to call javac -version
> something to get the correct version of which has been used to compile
> the classes etc.
>
> What i could imagine is something like giving some kind of information
> from maven-compile-plugin(?) via WhatEver??? to maven-jar-plugin ?
>
> So the question is:
>
> Does someone has a good idea to solve this kind of problem ?
Haven't used Toolchains myself, I would expect the
maven-toolchains-plugin to write an XML file to target which contains
all necessary information about the forked VM/JDK. Very much like
Surefire does.
This standard file could be easily consumed. If present, you know that
the Maven JDK has not been used but another one.
Michael
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org