Bug 475732 - Unhandled event: DefaultToolchainsBuildingRequest
Summary: Unhandled event: DefaultToolchainsBuildingRequest
Status: ASSIGNED
Alias: None
Product: Hudson
Classification: Technology
Component: Plugins (show other bugs)
Version: 3.2.2   Edit
Hardware: PC Windows 7
: P3 critical (vote)
Target Milestone: ---   Edit
Assignee: Winston Prakash CLA
QA Contact: Geoff Waymark CLA
URL:
Whiteboard: candidate-3.3.1
Keywords:
Depends on:
Blocks: 472084
  Show dependency tree
 
Reported: 2015-08-24 11:53 EDT by Samuel Wu CLA
Modified: 2017-12-14 15:09 EST (History)
10 users (show)

See Also:


Attachments
hudson config (bash + mvn3) and console output (4.70 KB, text/plain)
2017-12-14 14:15 EST, Nick Boldt CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Samuel Wu CLA 2015-08-24 11:53:45 EDT
This bug is opened at the request of Mikael Barbero as the follow up of bug 472084.

The following WTP build was created to run Maven and build WTP twice.
https://hudson.eclipse.org/webtools/job/WTP-R3_7_x_Maintenance_test/24/

In the first run, Maven is started by the following command shell.
/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 ./scripts/wtp-toolchain.xml

The following messages were found in the build log and everything was built successfully.
...
[DEBUG] Reading global toolchains from /shared/common/apache-maven-latest/conf/toolchains.xml
[DEBUG] Reading user toolchains from /jobs/genie.webtools/WTP-R3_7_x_Maintenance_test/workspace/./scripts/wtp-toolchain.xml
...
sun.java.command=org.codehaus.plexus.classworlds.launcher.Launcher 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 ./scripts/wtp-toolchain.xml
...
Building org.eclipse.wst.wsdl 1.2.400-SNAPSHOT
[INFO] Compiling 145 source files to /jobs/genie.webtools/WTP-R3_7_x_Maintenance_test/workspace/webtools.webservices/bundles/org.eclipse.wst.wsdl/target/classes
[DEBUG] Using javaHome: /shared/webtools/apps/IBMJava2-142-SR13FP10/jre
...
[INFO] org.eclipse.wst.wsdl ............................... SUCCESS [  3.717 s]
...

In the second run, Maven 3 step was configured to run Maven 3.3.3 and the toolchain was not found during the build.
/shared/common/apache-maven-3.3.3/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.ext.class.path=/home/hudson/genie.webtools/.hudson/maven/slavebundle/resources:/home/hudson/genie.webtools/.hudson/maven/slavebundle/lib/maven3-eventspy-3.1.jar:/home/hudson/genie.webtools/.hudson/war/webapp/WEB-INF/lib/hudson-remoting-3.0.3.jar -Dhudson.eventspy.port=58380 -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

[INFO] Building org.eclipse.wst.wsdl 1.2.400-SNAPSHOT
[DEBUG] Using javaHome: /opt/public/common/j2sdk1.4.2_19/jre
Comment 1 Mikaël Barbero CLA 2015-08-24 12:01:04 EDT
Moved to the Hudson project
Comment 2 Samuel Wu CLA 2015-08-26 12:30:24 EDT
I wonder whether someone can take a look at this problem since it has blocked our build for a while now. Thanks.
Comment 3 Winston Prakash CLA 2015-08-26 12:35:04 EDT
(In reply to Samuel Wu from comment #2)

I'm not sure how this is an issue in Hudson. To me it looks like a build time configuration issue.
Comment 4 Mikaël Barbero CLA 2015-08-27 04:44:12 EDT
To elaborate a bit, the second maven run tries to use a toolchains which has been written as a maven document in the maven 3 configuration of Hudson. The content is exactly the same as the one in ./scripts/wtp-toolchain.xml. Unfortunately, it fails to do so and warn us with

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

This is just a warning but suspect that it prevents the Hudson maven integration to properly use the defined toolchain document because with this configuration the build fails with 

[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


Any idea?
Comment 5 Samuel Wu CLA 2015-09-08 08:33:25 EDT
Hello Winston,
Any update?
Comment 6 Winston Prakash CLA 2015-09-08 12:05:32 EDT
(In reply to Samuel Wu from comment #5)
From the log output from the maven3 builder, I don't see the property setting --toolchains ./scripts/wtp-toolchain.xml. I don't have access to see the job configuration. How do I see the job configuration?
Comment 7 Winston Prakash CLA 2015-09-08 12:27:37 EDT
(In reply to Winston Prakash from comment #6)
OK, reproducible. I just created a dummy job with a dummy toolchain. It was not appearing in the command line.
Comment 8 Samuel Wu CLA 2015-09-08 13:30:40 EDT
Hi Winston,
I'm glad that you produced the problem. I've added you to the access list of the build configuration.
Comment 9 Samuel Wu CLA 2015-09-22 09:10:09 EDT
Hi Winston,
Any progress on this problem?
Comment 10 Winston Prakash CLA 2015-10-01 23:52:43 EDT
(In reply to Samuel Wu from comment #9)

Actually I take that back. In fact it works as expected. My earlier testing was not good.

This is how I tested now

- Created a tool chain in maven 3 configuration and intentionally given the JDK path incorrect
- Created a maven project with toolchain plugin configured to use the JDK configured in the Toolchain configured via maven 3 configuration 
- Created a Hudson job and added maven builder that includes the ToolChain 

Expected - If the toolchain document is loaded correctly, the toolchain maven plugin should complain about the invalid path

I did a build and indeed the build failed that indicates the path was incorrect.

Failed to execute goal org.apache.maven.plugins:maven-toolchains-plugin:1.1:toolchain (default) on project HudsonTest: Misconfigured toolchains. Non-existing JDK home configuration at /path/to/jdk/1.5 -> [Help 1]
Comment 11 Winston Prakash CLA 2015-10-01 23:52:54 EDT
(In reply to Samuel Wu from comment #9)

Actually I take that back. In fact it works as expected. My earlier testing was not good.

This is how I tested now

- Created a tool chain in maven 3 configuration and intentionally given the JDK path incorrect
- Created a maven project with toolchain plugin configured to use the JDK configured in the Toolchain configured via maven 3 configuration 
- Created a Hudson job and added maven builder that includes the ToolChain 

Expected - If the toolchain document is loaded correctly, the toolchain maven plugin should complain about the invalid path

I did a build and indeed the build failed that indicates the path was incorrect.

Failed to execute goal org.apache.maven.plugins:maven-toolchains-plugin:1.1:toolchain (default) on project HudsonTest: Misconfigured toolchains. Non-existing JDK home configuration at /path/to/jdk/1.5 -> [Help 1]
Comment 12 Winston Prakash CLA 2015-10-01 23:53:41 EDT
(In reply to Winston Prakash from comment #11)

Here is the build

http://ci.hudson-ci.org/view/Tests/job/maven-toolchain-test/5/console
Comment 13 Mikaël Barbero CLA 2015-10-02 04:09:20 EDT
I ran the exact same job on one of our Hudson instance (https://hudson.eclipse.org/cbi/job/test-hudson-toolchains/lastBuild/console). 

I have a toolchain.xml defined in the ~/.m2 folder. No one provides the configuration required by your pom. 

However, I defined a toolchain document with the expected conf:

<?xml version="1.0" encoding="UTF8"?>
<toolchains>
  <!-- JDK toolchains -->
  <toolchain>
    <type>jdk</type>
    <provides>
      <version>1.5</version>
      <vendor>sun</vendor>
    </provides>
    <configuration>
      <jdkHome>/shared/common/jdk1.5.0-latest</jdkHome>
    </configuration>
  </toolchain>
</toolchains>

The toolchain document seems to be taken into account but I still got the warning:

[WARN] o.h.m.e.EventSpyProcessor - Unhandled event: org.apache.maven.toolchain.building.DefaultToolchainsBuildingRequest@5ab7f23f (org.apache.maven.toolchain.building.DefaultToolchainsBuildingRequest)
[WARN] o.h.m.e.EventSpyProcessor - Unhandled event: org.apache.maven.toolchain.building.DefaultToolchainsBuildingRequest@5ab7f23f (org.apache.maven.toolchain.building.DefaultToolchainsBuildingRequest)
[INFO] o.h.m.e.h.MavenExecutionRequestHandler - Using tool-chains document ID: 44fff448-2c72-48b8-9b8f-6114a2946a6e


During the maven build, it seems that it only take into account the ~/.m2/toolchains.xml.
Comment 14 Winston Prakash CLA 2015-10-02 13:14:07 EDT
(In reply to Mikael Barbero from comment #13)

I'm not an expert in Maven internals, so I can't tell exactly what is happening. 

But it appears, maven is raising events on available resources and expects registered handlers to handle them accordingly at build time. 

Reading through the code, maven3 plugin has its own build time event handlers 

o.h.m.e.EventSpyProcessor is registered to handle only the events raised for its own resources, so I guess it handles the event raised for the Toolchain document created (eventually handled by o.h.m.e.h.MavenExecutionRequestHandler)

However, since o.h.m.e.EventSpyProcessor  does not know how to handle the events related to DefaultToolchains (~/.m2/toolchains), it simply warns that it was not handled and expected to be handled by other registered event handlers.

Question would be whether the compiler plugin used the JDK defined in the custom Toolchain.
Comment 15 Mikaël Barbero CLA 2015-10-08 05:18:55 EDT
Would you please copy paste the content of the toolchain document you used on your hudson test instance? Thanks
Comment 16 Samuel Wu CLA 2015-10-08 08:54:09 EDT
(In reply to Mikael Barbero from comment #15)
> Would you please copy paste the content of the toolchain document you used
> on your hudson test instance? Thanks
Here is the toolchain.

<toolchains>
  <toolchain>
    <type>jdk</type>
    <provides>
      <id>J2SE-1.4</id>
      <vendor>ibm</vendor>
    </provides>
    <configuration>
      <jdkHome>/shared/webtools/apps/IBMJava2-142-SR13FP10/jre</jdkHome>
    </configuration>
  </toolchain>
  <toolchain>
    <type>jdk</type>
    <provides>
      <id>J2SE-1.5</id>
    </provides>
    <configuration>
      <jdkHome>/shared/common/jdk-1.5.0-22.x86_64/jre</jdkHome>
    </configuration>
  </toolchain>
  <toolchain>
    <type>jdk</type>
    <provides>
      <id>JavaSE-1.6</id>
    </provides>
    <configuration>
      <jdkHome>/shared/common/jdk1.6.0_45/jre</jdkHome>
    </configuration>
  </toolchain>
  <toolchain>
    <type>jdk</type>
    <provides>
      <id>JavaSE-1.7</id>
    </provides>
    <configuration>
      <jdkHome>/shared/common/jdk1.7.0_25/jre</jdkHome>
    </configuration>
  </toolchain>

</toolchains>
Comment 17 Mikaël Barbero CLA 2015-10-08 09:04:44 EDT
Thanks Samuel. I was actually asking to Winston :) sorry for the misunderstanding.
Comment 18 Samuel Wu CLA 2015-10-08 09:13:34 EDT
(In reply to Mikael Barbero from comment #17)
> Thanks Samuel. I was actually asking to Winston :) sorry for the
> misunderstanding.

It's fine. At least Winston knows that his is the one wanted :)
Comment 19 Samuel Wu CLA 2015-10-22 21:36:26 EDT
Hi Winston,
I wonder whether you can provide the toolchain file for Mikael. Thanks.
Comment 20 Winston Prakash CLA 2015-10-22 22:01:49 EDT
OOPs sorry.

I simply used the sample one given here

https://maven.apache.org/guides/mini/guide-using-toolchains.html
Comment 21 Nick Boldt CLA 2017-12-14 14:15:29 EST
Created attachment 271917 [details]
hudson config (bash + mvn3) and console output

Did a little experiment for myself here, using wtp's parent pom build and a local toolchains.xml file.

If I set invalid paths in the toolchains file, maven doesn't complain. So while the warning looks innocuous, it seems the toolchains file isn't being respected.

That said, I looked for *.xml files in the WTP releng.aggregator project (including all the submodules) containing the word "toolchain" in any way ... and the only hit is line 440 of the wtp-parent pom:

http://git.eclipse.org/c/webtools/webtools.releng.aggregator.git/tree/wtp-parent/pom.xml#n437

Of course the reason bad toolchain paths are being ignored here could be that there's no manifest or BREE set for this build.
Comment 22 Nick Boldt CLA 2017-12-14 15:04:13 EST
I set up a job with Maven 3.5 and JDK 8 to actually test if the toolchain passed via commandline is respected.

Here's the toolchain file (note the "BAD" suffix on paths):

https://hudson.eclipse.org/webtools/view/webtools_R3_10/job/webtools-servertools_R3_10_toolchains/ws/.maven/repo/toolchains.xml

It *IS* respected, since the build failed:

[workspace] $ /shared/common/apache-maven-3.5.0/bin/mvn clean verify -V --global-toolchains /home/hudson/genie.webtools/.hudson/jobs/webtools-servertools_R3_10_toolchains/workspace/.maven/repo/toolchains.xml -t /home/hudson/genie.webtools/.hudson/jobs/webtools-servertools_R3_10_toolchains/workspace/.maven/repo/toolchains.xml -V -B -Dmaven.test.skip=false -Dmaven.test.error.ignore=true -Dmaven.test.failure.ignore=true -Dsurefire.timeout=1800 -DskipWithIssues=false -Dmaven.ext.class.path=/home/hudson/genie.webtools/.hudson/maven/slavebundle/resources:/home/hudson/genie.webtools/.hudson/maven/slavebundle/lib/maven3-eventspy-3.1.jar:/home/hudson/genie.webtools/.hudson/war/webapp/WEB-INF/lib/hudson-remoting-3.0.3.jar -Dhudson.eventspy.port=41274 -Dmaven.repo.local=/home/hudson/genie.webtools/.hudson/jobs/webtools-servertools_R3_10_toolchains/workspace/.maven/repo -f pom.xml -P bree-libs -P eclipse-sign -ff
...
[WARN] o.h.m.e.EventSpyProcessor - Unhandled event: org.apache.maven.toolchain.building.DefaultToolchainsBuildingRequest@781a9412 (org.apache.maven.toolchain.building.DefaultToolchainsBuildingRequest)
[WARN] o.h.m.e.EventSpyProcessor - Unhandled event: org.apache.maven.toolchain.building.DefaultToolchainsBuildingRequest@781a9412 (org.apache.maven.toolchain.building.DefaultToolchainsBuildingRequest)
...
[ERROR] Failed to execute goal org.eclipse.tycho:tycho-compiler-plugin:1.0.0:compile (default-compile) on project org.eclipse.wst.server.discovery: Non-existing JDK home configuration at /shared/webtools/apps/IBMJava2-142-SR13FP10/jreBAD

-- https://hudson.eclipse.org/webtools/view/webtools_R3_10/job/webtools-servertools_R3_10_toolchains/1/console