Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add usage of maven-toolchains-plugin. #855

Merged
merged 1 commit into from
Jun 23, 2020
Merged

Add usage of maven-toolchains-plugin. #855

merged 1 commit into from
Jun 23, 2020

Conversation

sbernard31
Copy link
Contributor

Add a profile to use maven toolchain. This allows to compile against JDK 1.7 running maven with a more recent JRE/JDK.

The doclint HACK is needed because of : https://issues.apache.org/jira/browse/MNG-6943.
We can use toolchain correctly on jenkins thanks to : eclipse#bug_560161.

Using toolchain seems to allow us to get a rid of JAVA_TOOL_OPTIONS and _JAVA_OPTIONS workaround needed because of eclipse jenkins configuration : eclipse#bug_547626.

@sbernard31
Copy link
Contributor Author

@boaks this maybe makes sense for californium too.

@boaks
Copy link

boaks commented Jun 22, 2020

After the Californium 2.3.0 release on Wednesday, I will give it a try.

@sbernard31 sbernard31 merged commit cbf3e35 into master Jun 23, 2020
@boaks
Copy link

boaks commented Jul 4, 2020

Verifying, that java 7 API is used to build, my feeling is, the toolchain profile isn't activated just by using java 8.
FMPOV, the usage of the toolchain should not be mandatory, it would require extra configuration for maven.
For Californium I enable it now by the property "use.toolchain", which is intended to be passed in when executing mvn.

<profile>
<!-- This profile activate the usage of toolchain to compile using JDK 1.7-->
<id>useToolchain</id>
<properties>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is the <activation> left out by intention?

Copy link
Contributor Author

@sbernard31 sbernard31 Nov 12, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This profile is intended to be activated manually. (e.g. during jenkins build)

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I use Java8Test to check, if java 7 is really used.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, I see ...

But I guess, you use the keytool of java newer than java 8. The keystore type jks is the default up to java 8 and afterwards changed to PKCS12, which is not supported by java 7. I added therefore the keystore type explicitly to the script.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at Jenkins ouput :

[INFO] ------------< org.eclipse.leshan:leshan-integration-tests >-------------
[INFO] Building leshan - integration tests 2.0.0-SNAPSHOT                [9/12]
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:3.1.0:clean (default-clean) @ leshan-integration-tests ---
[INFO] 
[INFO] --- maven-enforcer-plugin:1.4.1:enforce (enforce-maven) @ leshan-integration-tests ---
[INFO] 
[INFO] --- maven-toolchains-plugin:3.0.0:toolchain (default) @ leshan-integration-tests ---
[INFO] Required toolchain: jdk [ version='1.7' ]
[INFO] Found matching toolchain for type jdk: JDK[/opt/tools/java/oracle/jdk-7/latest]
[INFO] 
[INFO] --- maven-resources-plugin:3.1.0:resources (default-resources) @ leshan-integration-tests ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /home/jenkins/agent/workspace/leshan/leshan-integration-tests/src/main/resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ leshan-integration-tests ---
[INFO] Toolchain in maven-compiler-plugin: JDK[/opt/tools/java/oracle/jdk-7/latest]
[INFO] No sources to compile
[INFO] 
[INFO] --- maven-resources-plugin:3.1.0:testResources (default-testResources) @ leshan-integration-tests ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /home/jenkins/agent/workspace/leshan/leshan-integration-tests/src/test/resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.8.1:testCompile (default-testCompile) @ leshan-integration-tests ---
[INFO] Toolchain in maven-compiler-plugin: JDK[/opt/tools/java/oracle/jdk-7/latest]
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 39 source files to /home/jenkins/agent/workspace/leshan/leshan-integration-tests/target/test-classes
[INFO] 
[INFO] --- maven-surefire-plugin:3.0.0-M4:test (default-test) @ leshan-integration-tests ---
[INFO] Toolchain in maven-surefire-plugin: JDK[/opt/tools/java/oracle/jdk-7/latest]

So java7 seems correctly used.

But regarding eclipse-californium/californium#1442 (comment), I try to build #923 and it failed with :

[ERROR] org.eclipse.leshan.integration.tests.BootstrapTest.bootstrapSecureWithBadPSKKey  Time elapsed: 0.001 s  <<< ERROR!
java.lang.RuntimeException: java.io.IOException: Invalid keystore format
	at org.eclipse.leshan.integration.tests.BootstrapTest.<init>(BootstrapTest.java:47)
Caused by: java.io.IOException: Invalid keystore format
	at org.eclipse.leshan.integration.tests.BootstrapTest.<init>(BootstrapTest.java:47)

[ERROR] org.eclipse.leshan.integration.tests.BootstrapTest.bootstrapWithDiscoverOnDevice  Time elapsed: 0 s  <<< ERROR!
java.lang.RuntimeException: java.io.IOException: Invalid keystore format
	at org.eclipse.leshan.integration.tests.BootstrapTest.<init>(BootstrapTest.java:47)
Caused by: java.io.IOException: Invalid keystore format
	at org.eclipse.leshan.integration.tests.BootstrapTest.<init>(BootstrapTest.java:47)

This confirms that java7 is used and you are right about keystore format.
(Thx again for letting me know that 🙏 )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants