Scout - Maven - Configure animal sniffer plugin to use java 8? [message #1768078] |
Thu, 13 July 2017 12:57 ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
I have a basic eclipse scout project with a bit of functionality.
After adding java 8 specific code, mvn clean install or mvn clean verify lead to build errors. The animal snffer plugin checks my code against java7 and consequently I get build errors when using streams etc.
I tried to explicitly set the plugin to use java8, but still it uses java7 ...
First I tried to specify the following properties in the parent project's pom:
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
Then I explicitly declared the animal sniffer plugin in the parent pom (see artifactId = java18)
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>animal-sniffer-maven-plugin</artifactId>
<version>1.15</version>
<configuration>
<signature>
<groupId>org.codehaus.mojo.signature</groupId>
<artifactId>java18</artifactId>
<version>1.0</version>
</signature>
</configuration>
<executions>
<execution>
<phase>test</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
This didn't work either.
When I comment out all plugins specified in the scout project parent
pom, this plugin is still being used. Where is it declared? Its neither in the parent, nor in the subprojects's poms.
Here is a bit of relevant maven output:
[INFO] --- animal-sniffer-maven-plugin:1.15:check (default-cli) @ ...scout.shared ---
[DEBUG] Configuring mojo org.codehaus.mojo:animal-sniffer-maven-plugin:1.15:check from plugin realm ClassRealm[plugin>org.codehaus.mojo:animal-sniffer-maven-plugin:1.15, parent: sun.misc.Launcher$AppClassLoader@5c647e05]
[DEBUG] Configuring mojo 'org.codehaus.mojo:animal-sniffer-maven-plugin:1.15:check' with basic configurator -->
[DEBUG] (f) ignoreDependencies = true
[DEBUG] (f) localRepository = id: local
url: file:///C:/Users/paco/.m2/repository/
layout: default
snapshots: [enabled => true, update => always]
releases: [enabled => true, update => always]
[DEBUG] (f) outputDirectory =DEBUG (f) project = MavenProject: ...scout.shared\pom.xml
[DEBUG] (s) groupId = org.codehaus.mojo.signature
[DEBUG] (s) artifactId = java17
[DEBUG] (s) version = 1.0
[DEBUG] (f) signature = org.codehaus.mojo.signature:java17:1.0
[DEBUG] (f) skip = false
[DEBUG] -- end configuration --
[ ... ]
[ERROR]...scout\server\branch\BranchLookupService.java:38: Undefined reference: java.util.stream.Stream java.util.List.stream()
As you can see the signature is set to java17 instead of java18.
What can I do to get rid of this problem?
[Updated on: Thu, 13 July 2017 13:13] by Moderator Report message to a moderator
|
|
|
Re: Scout - Maven - Configure animal sniffer plugin to use java 8? [message #1768089 is a reply to message #1768078] |
Thu, 13 July 2017 13:34 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
The animal sniffer configuration is in org.eclipse.scout:maven_plugin_config-master. The version is from org.eclipse.scout:maven_plugin_version-master. But I don't see why your configuration with
<configuration>
<signature>
<groupId>org.codehaus.mojo.signature</groupId>
<artifactId>java18</artifactId>
<version>1.0</version>
</signature>
</configuration>
didn't work. Did you have a look at the effective POM in Eclipse?
|
|
|
|
Re: Scout - Maven - Configure animal sniffer plugin to use java 8? [message #1768095 is a reply to message #1768089] |
Thu, 13 July 2017 14:34 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
Sorry I don't understand where the configuration comes from. What does this mean: org.eclipse.scout:maven_plugin_config-master ?
Is this config you mention adaptable with the correct java version? Telling from your answer I'd say yes, but I havent suceeded yet. I'm probably trying to change it in the wrong place (parent pom).
I took a look into the effective pom and the correct configuration (java18) is only there when I explicitly specify the plugin in the parent project's.
Nevertheless java17 is still used when building and I don't know how to reconfigure this.
Here is my output of mvn -version:
Apache Maven 3.5.0 (ff8f5e7444045639af65f6095c62210b5713f426; 2017-04-03T21:39:06+02:00)
Maven home: C:\Apps\apache-maven-3.5.0\bin\..
Java version: 1.8.0_101, vendor: Oracle Corporation
Java home: C:\Program Files\Java\jdk1.8.0_101\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"
|
|
|
Re: Scout - Maven - Configure animal sniffer plugin to use java 8? [message #1768096 is a reply to message #1768095] |
Thu, 13 July 2017 14:44 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
The maven_plugin_config-master is the pom.xml where different plugins are configured in a default way suitable for Scout. It's the parent POM of the org.eclipse.scout.rt-POM.
Is there a conflicting configuration present in you effective POM when you define your own configuration?
Benjamin Schulte might still be right about the correct JDK being used. Does your Maven settings.xml define a specific JDK (via "compiler"-Properties)? Or do you specify -Dmaven.compiler.executable on the command line?
|
|
|
Re: Scout - Maven - Configure animal sniffer plugin to use java 8? [message #1768097 is a reply to message #1768094] |
Thu, 13 July 2017 14:47 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
I can guarantee that I'm using java 8.
Moreover I don't have a %USERPROFILE%\mavenrc_pre.bat which could override the JAVA_HOME environment variable.
And last but not least I get the same errors when building on a jenkins server, where java 8 is configured.
As you can see here it still tries to compare my source against java17.
[ INFO] --- animal-sniffer-maven-plugin:1.15:check (enforce-java-api-compatibility) @ ...scout.server ---
[INFO] Checking unresolved references to org.codehaus.mojo.signature:java17:1.0
|
|
|
|
Re: Scout - Maven - Configure animal sniffer plugin to use java 8? [message #1768100 is a reply to message #1768096] |
Thu, 13 July 2017 14:58 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
No, when defining my own configuration only java18 is present.
With custom configuration 2 times:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>animal-sniffer-maven-plugin</artifactId>
<version>1.15</version>
<executions>
<execution>
<phase>test</phase>
<goals>
<goal>check</goal>
</goals>
<configuration>
<signature>
<groupId>org.codehaus.mojo.signature</groupId>
<artifactId>java18</artifactId>
<version>1.0</version>
</signature>
</configuration>
</execution>
</executions>
<configuration>
<signature>
<groupId>org.codehaus.mojo.signature</groupId>
<artifactId>java18</artifactId>
<version>1.0</version>
</signature>
</configuration>
</plugin>
Without:
No org.codehaus.. dependency at all.
[Updated on: Thu, 13 July 2017 15:02] by Moderator Report message to a moderator
|
|
|
|
|
|
|
|
Re: Scout - Maven - Configure animal sniffer plugin to use java 8? [message #1768193 is a reply to message #1768144] |
Fri, 14 July 2017 13:24 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
Corrado Parisi wrote on Fri, 14 July 2017 06:54I assume this whole problem comes from a wrong scout configuration which cannot be overriden.
It can be overriden, I am doing this and I am using Java 8 features in my code.
I use exactly the configuration that is stated above for suppressing the animal-sniffer errors.
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>animal-sniffer-maven-plugin</artifactId>
<version>1.14</version>
<configuration>
<signature>
<groupId>org.codehaus.mojo.signature</groupId>
<artifactId>java18</artifactId>
</signature>
</configuration>
</plugin>
|
|
|
Re: Scout - Maven - Configure animal sniffer plugin to use java 8? [message #1768207 is a reply to message #1768144] |
Fri, 14 July 2017 15:28 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
Hi Corrado
We have the following defined in our parent pom:
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>animal-sniffer-maven-plugin</artifactId>
<configuration>
<!-- for java18 signature check. @see https://github.com/ianbrandt/animal-sniffer-signatures -->
<signature>
<groupId>org.kaazing.mojo.signature</groupId>
<artifactId>java18</artifactId>
<version>1.0</version>
</signature>
<skip>${master_sanityCheck_skip}</skip> <!-- property set to false by default -->
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
hope this helps
|
|
|
|
|
|
Re: Scout - Maven - Configure animal sniffer plugin to use java 8? [message #1768372 is a reply to message #1768371] |
Tue, 18 July 2017 07:22 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
Just experimented a little bit and came up with the following:
- all modules get the java17 animal-sniffer-maven-plugin dependency.
- adding the java18 dependency on my parent project affects only the parent project (dependency can be found in the effective pom, actually only the java18 configuration is there, which is good) and doesn't affect the subprojects even though the parent project is defined within their xml.
Note: Without my custom animal plugin definition in my parent pom, my parent project doesn't show the plugin at all. (Neither of both java17 or java18)
- I have to define the plugin with the java18 dependency in every module, in order that the build doesn't fail when the respective module contains java8 code.
This can't be the right solution ... I don't know what to do.
|
|
|
|
|
Re: Scout - Maven - Configure animal sniffer plugin to use java 8? [message #1778425 is a reply to message #1768383] |
Thu, 14 December 2017 07:21 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
I've came accross the same issue when I started to use Java 8 features. The following code snippet in pom.xml (e.g. helloworld/pom.xml) did work (place it within the project tag somewhere, e.g. after dependencyManagement). It's copy & paste from the effective pom with version tag removed and artifactId changed two times to java18.
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>animal-sniffer-maven-plugin</artifactId>
<executions>
<execution>
<id>enforce-java-api-compatibility</id>
<phase>verify</phase>
<goals>
<goal>check</goal>
</goals>
<configuration>
<signature>
<groupId>org.codehaus.mojo.signature</groupId>
<artifactId>java18</artifactId>
<version>1.0</version>
</signature>
<skip>false</skip>
</configuration>
</execution>
</executions>
<configuration>
<signature>
<groupId>org.codehaus.mojo.signature</groupId>
<artifactId>java18</artifactId>
<version>1.0</version>
</signature>
<skip>false</skip>
</configuration>
</plugin>
</plugins>
</build>
|
|
|
|
Powered by
FUDForum. Page generated in 0.05373 seconds