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
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 58 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,60 @@ Contributors:
<test.exclusion.pattern>nothing</test.exclusion.pattern>
</properties>
</profile>
<profile>
<id>jdk8orGreater</id>
<activation>
<jdk>[1.8,)</jdk>
</activation>
<properties>
<jdk8orGreater>true</jdk8orGreater>
</properties>
</profile>
<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 🙏 )

<jdk8orGreater>false</jdk8orGreater>
</properties>
<build>
<plugins>
<plugin>
<artifactId>maven-toolchains-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>toolchain</goal>
</goals>
</execution>
</executions>
<configuration>
<toolchains>
<jdk>
<version>1.7</version>
</jdk>
</toolchains>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>configure-doclint</id>
<activation>
<property><name>jdk8orGreater</name><value>true</value></property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<doclint>all,-missing</doclint>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<!-- this profile generate all the needed artifact and signatures needed, then release it on maven central -->
<id>release</id>
Expand Down Expand Up @@ -235,6 +289,10 @@ Contributors:
<plugin>
<artifactId>maven-enforcer-plugin</artifactId>
<version>1.4.1</version>
</plugin>
<plugin>
<artifactId>maven-toolchains-plugin</artifactId>
<version>3.0.0</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
Expand Down Expand Up @@ -294,7 +352,6 @@ Contributors:
<configuration>
<excludePackageNames>org.eclipse.leshan.core.util</excludePackageNames>
<quiet>true</quiet>
<doclint>all,-missing</doclint>
</configuration>
</plugin>
<plugin>
Expand Down