This Bugzilla instance is deprecated, and most Eclipse projects now use GitHub or Eclipse GitLab. Please see the deprecation plan for details.
Bug 472084 - Maven 3.3.1 doesn't pick up the customized Toolchain for the WTP build
Summary: Maven 3.3.1 doesn't pick up the customized Toolchain for the WTP build
Status: CLOSED WORKSFORME
Alias: None
Product: Community
Classification: Eclipse Foundation
Component: CI-Jenkins (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 7
: P3 critical (vote)
Target Milestone: ---   Edit
Assignee: CI Admin Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug, RHT
Keywords:
Depends on: 475732
Blocks:
  Show dependency tree
 
Reported: 2015-07-07 13:24 EDT by Samuel Wu CLA
Modified: 2018-08-20 08:19 EDT (History)
8 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Samuel Wu CLA 2015-07-07 13:24:49 EDT
A few WTP plugins need to build with the old JDK and a WTP toolchains.xml is set up. It works fine with Maven 3.2.5 but fails with Maven 3.3.1.
The current investigation showed that instead of using the WTP specific toolchains.xml which is defined in the Hudson build configuration, a common toolchains /opt/public/common/maven-toolchains.xml is linked as the user toolchains.
genie.gef ~> ll ~/.m2
[....]
lrwxrwxrwx 1 genie.gef tools.gef  37 23 févr. 04:05 settings.xml -> /opt/public/common/maven-settings.xml
lrwxrwxrwx 1 genie.gef tools.gef  39 23 févr. 04:05 toolchains.xml -> /opt/public/common/maven-toolchains.xml

I wonder how Maven 3.2.5 can pick up the customized toolchains but not 3.3.1. It would be great if Maven 3.3.1 can pick up the customized toolchains as 3.2.5. 
At the same time, I wonder whether the common toolchains file can be changed to support IBM JDK 1.4. Its current JDK 1.4 points to the Sun's which is broken and generates compile errors.

<toolchain>
    <type>jdk</type>
    <provides>
      <id>J2SE-1.4</id>
    </provides>
    <configuration>
      <jdkHome>/shared/webtools/apps/IBMJava2-142-SR13FP10/jre</jdkHome>
    </configuration>
  </toolchain>
Comment 1 Jan Sievers CLA 2015-07-08 03:17:17 EDT
Try narrowing down the problem. Did you try running a build

a) locally with explicit toolchains using 'mvn --toolchains /path/to/toolchains.xml' with both maven versions
b) on hudson with a console step (not a maven build step) and explicit 'mvn --toolchains /path/to/toolchains.xml' with both maven versions
Comment 2 Mikaël Barbero CLA 2015-07-08 05:12:51 EDT
From the console log https://hudson.eclipse.org/webtools/job/WTP-R3_7_x_Maintenance_test/16/consoleText, it seems that your toolchain is taken into account 

[INFO] o.h.m.e.h.MavenExecutionRequestHandler - Using tool-chains document ID: f1492191-c1d9-4caa-a6bf-44160486454d and it matches with you custom toolchain id.

but just before, there is a warning:

[WARN] o.h.m.e.EventSpyProcessor - Unhandled event: org.apache.maven.toolchain.building.DefaultToolchainsBuildingRequest@49b07ee3 (org.apache.maven.toolchain.building.DefaultToolchainsBuildingRequest)

I would suggest to try to upgrade Hudson to its latest version. The hudson/maven integration may have been improved since then. 

The migration is totally transparent and we do a complete backup so we are able to restore exactly as it was before migration if anything is wrong with the new version.

Do you want me to upgrade your HIPP to Hudson 3.2.2?
Comment 3 Samuel Wu CLA 2015-07-08 08:59:11 EDT
(In reply to Mikael Barbero from comment #2)
I'm fine with the upgrade as long as it can fix the build.
Comment 4 Samuel Wu CLA 2015-07-08 09:02:59 EDT
(In reply to Jan Sievers from comment #1)
The current WTP toolchains are defined on the Hudson build configuration. I'm not so sure what is its path on the build machine.
Comment 5 Mikaël Barbero CLA 2015-07-08 09:42:36 EDT
(In reply to Samuel Wu from comment #4)
> (In reply to Jan Sievers from comment #1)
> The current WTP toolchains are defined on the Hudson build configuration.
> I'm not so sure what is its path on the build machine.

it is in ~/.hudson/maven/documents/f1492191-c1d9-4caa-a6bf-44160486454d.xml
Comment 6 Mikaël Barbero CLA 2015-07-08 09:42:51 EDT
(In reply to Samuel Wu from comment #3)
> (In reply to Mikael Barbero from comment #2)
> I'm fine with the upgrade as long as it can fix the build.

I'll do the upgrade now
Comment 7 Mikaël Barbero CLA 2015-07-08 10:17:18 EDT
The upgrade is now done. Could you please try your job again? Thanks.
Comment 8 Samuel Wu CLA 2015-07-08 10:22:03 EDT
The build is running now. My fingers are crossed.
Comment 9 Samuel Wu CLA 2015-07-08 11:02:38 EDT
The build failed again unfortunately.
Comment 10 Samuel Wu CLA 2015-07-08 14:23:31 EDT
The following mvn command was added to the build.
/shared/common/apache-maven-latest/bin/mvn clean install -V -B -e -Dmaven.test.skip=true -Dmaven.test.failure.ignore=true -Dmaven.test.error.ignore=true -Dsurefire.timeout=1800 -DskipWithIssues=false -Dmaven.repo.local=/home/hudson/genie.webtools/.hudson/jobs/WTP-R3_7_x_Maintenance_test/workspace/.maven/repo -f pom.xml -P bree-libs -P eclipse-sign -X -ff --toolchains ~/.hudson/maven/documents/f1492191-c1d9-4caa-a6bf-44160486454d.xml

But it failed with the following error message

[ERROR] Failed to execute goal org.eclipse.tycho:tycho-compiler-plugin:0.20.0:compile (default-compile) on project org.eclipse.wtp.releng.versionchecker: useJDK = BREE configured, but no toolchain of type 'jdk' with id 'J2SE-1.5' found. See http://maven.apache.org/guides/mini/guide-using-toolchains.html -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.eclipse.tycho:tycho-compiler-plugin:0.20.0:compile (default-compile) on project org.eclipse.wtp.releng.versionchecker: useJDK = BREE configured, but no toolchain of type 'jdk' with id 'J2SE-1.5' found. See http://maven.apache.org/guides/mini/guide-using-toolchains.html

 see https://hudson.eclipse.org/webtools/job/WTP-R3_7_x_Maintenance_test/18/ for more details.
Comment 11 Mikaël Barbero CLA 2015-07-09 09:38:32 EDT
I installed Maven 3.3.3 in /shared/common and added it to your HIPP. I started a new build (https://hudson.eclipse.org/webtools/job/WTP-R3_7_x_Maintenance_test/20/) to see if it changes something.
Comment 12 Samuel Wu CLA 2015-07-09 10:15:01 EDT
https://hudson.eclipse.org/webtools/job/WTP-R3_7_x_Maintenance_test/20/ failed with the same error as build 18. But it was running the shell command to call mvn directly. 
I changed it to run with the Hudson Maven 3 task and started another build https://hudson.eclipse.org/webtools/job/WTP-R3_7_x_Maintenance_test/21/
Comment 13 Samuel Wu CLA 2015-07-09 10:55:08 EDT
The build failed again.
https://hudson.eclipse.org/webtools/job/WTP-R3_7_x_Maintenance_test/21/

[ERROR] Failed to execute goal org.eclipse.tycho:tycho-compiler-plugin:0.20.0:compile (default-compile) on project org.eclipse.wst.wsdl: Compilation failure: Compilation failure:
[ERROR] /jobs/genie.webtools/WTP-R3_7_x_Maintenance_test/workspace/webtools.webservices/bundles/org.eclipse.wst.wsdl/src-wsdl/org/eclipse/wst/wsdl/util/WSDLParser.java:[787]
[ERROR] catch (IOException exception)
[ERROR] ^^^^^^^^^^^
[ERROR] Unreachable catch block for IOException. This exception is never thrown from the try statement body
Comment 14 Mikaël Barbero CLA 2015-07-10 04:52:35 EDT
I think you should raise a bug against the Maven project as it really seems to be a regression in 3.3.x. I am for closing this bug as invalid as it is not related to HIPP configuration or infrastructure. Do you agree?
Comment 15 Thanh Ha CLA 2015-07-10 10:14:27 EDT
Just a thought, since Maven 3.3.3 is the latest released version maybe it's worth trying that out first before we open a bug with Maven.
Comment 16 Mikaël Barbero CLA 2015-07-10 10:15:38 EDT
(In reply to Thanh Ha from comment #15)
> Just a thought, since Maven 3.3.3 is the latest released version maybe it's
> worth trying that out first before we open a bug with Maven.

We already did (see comment 11, 12 and 13).
Comment 17 Samuel Wu CLA 2015-07-10 10:48:31 EDT
(In reply to Mikael Barbero from comment #14)
> I think you should raise a bug against the Maven project as it really seems
> to be a regression in 3.3.x. I am for closing this bug as invalid as it is
> not related to HIPP configuration or infrastructure. Do you agree?

Sure, as long as the problem can be solved. But I have never opened a bug against Maven. Can you please advise how to proceed or can you please open a Maven bug since you can explain the Hudson and Maven situation better?
Comment 18 Mikaël Barbero CLA 2015-07-13 14:10:29 EDT
As you have demonstrated with your CLI tests, the issue does not seem related to hudson/maven integration. Just open a bug (https://issues.apache.org/jira/browse/MNG) stating that the use of --toolchains does not pick up the given one, but instead use the user's one.
Comment 19 Samuel Wu CLA 2015-07-13 15:08:17 EDT
https://issues.apache.org/jira/browse/MNG-5855 is opened
Comment 20 Samuel Wu CLA 2015-08-19 21:29:40 EDT
Hervé Boutemy from the Maven team suspects the user toolchain file ~/.hudson/maven/documents/f1492191-c1d9-4caa-a6bf-44160486454d.xml had the incorrect content. Please see https://issues.apache.org/jira/browse/MNG-5855 for details.
Comment 21 Mikaël Barbero CLA 2015-08-20 03:37:21 EDT
(In reply to Samuel Wu from comment #20)
> Hervé Boutemy from the Maven team suspects the user toolchain file
> ~/.hudson/maven/documents/f1492191-c1d9-4caa-a6bf-44160486454d.xml had the
> incorrect content. Please see https://issues.apache.org/jira/browse/MNG-5855
> for details.


Hervé is right. ~/.hudson/maven/documents/f1492191-c1d9-4caa-a6bf-44160486454d.xml is not a toolchains file but a Hudson document that contains a toolchains. I did not check the format before telling you to use it. I was assuming it was the toolchains file itself (facepalm). It can not be given to the --toolchain parameter.

I suggest you create a toolchains.xml in your workspace with the content you desired. Do it as a shell script step. Then, call maven as you did before but by refererencing the toolchains in the working directory:

--toolchains ./toolchains.xml

and let see what happen. If it works, you can close the MNG-5855 as invalid and open a new one against the Hudson project to raise the issue about the error:

 o.h.m.e.EventSpyProcessor - Unhandled event: org.apache.maven.toolchain.building.DefaultToolchainsBuildingRequest

, otherwise, more investigation will be required MNG-5855.
Comment 22 Samuel Wu CLA 2015-08-24 11:57:22 EDT
A user toolchain was created and the build was successful with the created toolchain. But build still failed with the Hudson Maven 3 build process. Bug 475732 was created as follow up at the request of Mikael Barbero.
Comment 23 Mikaël Barbero CLA 2015-08-25 03:51:34 EDT
(In reply to Samuel Wu from comment #22)
> A user toolchain was created and the build was successful with the created
> toolchain. But build still failed with the Hudson Maven 3 build process. Bug
> 475732 was created as follow up at the request of Mikael Barbero.

Thanks. I moved it to the Hudson project (you put it under Community/Hudson which is the project about Hudson instances at Eclipse.org ;))

Let's see how Hudson's committers react.
Comment 24 Samuel Wu CLA 2015-08-25 08:43:43 EDT
(In reply to Mikael Barbero from comment #23)
Thank you, Mikael.
Comment 25 Samuel Wu CLA 2015-08-26 16:23:27 EDT
The following is the response from Winston Prakash CLA Friend 2015-08-26 12:35:04 EDT
I'm not sure how this is an issue in Hudson. To me it looks like a build time configuration issue.
Comment 26 Eclipse Genie CLA 2017-08-16 10:50:06 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.
Comment 27 Carl Anderson CLA 2017-08-16 12:01:54 EDT
WTP moved back to Maven 3.2.5 and remains on that level, due to this bug.  If a later version of Maven respects the toolchains.xml as 3.2.5 did, then WTP can move forward (and at some point WTP will need to move forward).
Comment 28 Nick Boldt CLA 2017-12-14 15:08:51 EST
WTP 3.10 is now building with Tycho 1.0, Maven 3.3.3, and I'm still seeing this:

[DEBUG] Connected to remote
[INFO] o.h.m.e.h.SettingsBuildingRequestHandler - Using settings document ID: e23a0b6a-ab36-4ea3-8d97-c6ce7ba3db90
[WARN] o.h.m.e.EventSpyProcessor - Unhandled event: org.apache.maven.toolchain.building.DefaultToolchainsBuildingRequest@53b98ff6 (org.apache.maven.toolchain.building.DefaultToolchainsBuildingRequest)
[WARN] o.h.m.e.EventSpyProcessor - Unhandled event: org.apache.maven.toolchain.building.DefaultToolchainsBuildingRequest@53b98ff6 (org.apache.maven.toolchain.building.DefaultToolchainsBuildingRequest)
[INFO] o.h.m.e.h.MavenExecutionRequestHandler - Using tool-chains document ID: f1492191-c1d9-4caa-a6bf-44160486454d

Also did an experiment using Mvn 3.5, passing a toolchains file in via commandline to prove it's being respected, and it is. See bug 475732 comment 22 for details.

TL;DR, I think if we use mvn 3.5 or newer (bug 528801) we should be fine. The warning is just a warning, and the correct tool-chains doc f1492191-c1d9-4caa-a6bf-44160486454d *IS* being used.
Comment 29 Frederic Gurr CLA 2018-08-20 08:19:40 EDT
Seems like we can close this. Please re-open if I misjudged.