Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » scout » Scout - Maven - Configure animal sniffer plugin to use java 8?
Scout - Maven - Configure animal sniffer plugin to use java 8? [message #1768078] Thu, 13 July 2017 12:57 Go to next message
Corrado Parisi is currently offline Corrado ParisiFriend
Messages: 32
Registered: September 2016
Member
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]

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 messageGo to next message
Arthur van Dorp is currently offline Arthur van DorpFriend
Messages: 26
Registered: October 2015
Junior Member
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 #1768094 is a reply to message #1768089] Thu, 13 July 2017 14:27 Go to previous messageGo to next message
Benjamin Schulte is currently offline Benjamin SchulteFriend
Messages: 34
Registered: December 2016
Member
I don't think that animal sniffer is the problem here. If I get it correctly, the shown error message is no animal sniffer output but a compiler error. It looks like the problem is simply that a JDK7 is used. Setting maven.compiler.source/target also does not affect which JDK is used.
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 messageGo to next message
Corrado Parisi is currently offline Corrado ParisiFriend
Messages: 32
Registered: September 2016
Member
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 messageGo to next message
Arthur van Dorp is currently offline Arthur van DorpFriend
Messages: 26
Registered: October 2015
Junior Member
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 messageGo to next message
Corrado Parisi is currently offline Corrado ParisiFriend
Messages: 32
Registered: September 2016
Member
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 #1768099 is a reply to message #1768096] Thu, 13 July 2017 14:56 Go to previous messageGo to next message
Arthur van Dorp is currently offline Arthur van DorpFriend
Messages: 26
Registered: October 2015
Junior Member
You could always set master_sanityCheck_skip to true (e.g. with -Dmaster_sanityCheck_skip=true on the command line) to skip the animal sniffer from the config-POM.
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 messageGo to next message
Corrado Parisi is currently offline Corrado ParisiFriend
Messages: 32
Registered: September 2016
Member
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]

Report message to a moderator

Re: Scout - Maven - Configure animal sniffer plugin to use java 8? [message #1768103 is a reply to message #1768100] Thu, 13 July 2017 15:07 Go to previous messageGo to next message
Arthur van Dorp is currently offline Arthur van DorpFriend
Messages: 26
Registered: October 2015
Junior Member
Strange. I assume this is in your parent POM. It might be, that the POM where it fails (or a parent of it) pulls the wrong configuration. You could check the effective POM of the failing module.
Re: Scout - Maven - Configure animal sniffer plugin to use java 8? [message #1768104 is a reply to message #1768099] Thu, 13 July 2017 15:07 Go to previous messageGo to next message
Corrado Parisi is currently offline Corrado ParisiFriend
Messages: 32
Registered: September 2016
Member
Thanks for the hint on how to disable the check. I will use this until I find a solution ...
Re: Scout - Maven - Configure animal sniffer plugin to use java 8? [message #1768109 is a reply to message #1768103] Thu, 13 July 2017 15:25 Go to previous messageGo to next message
Corrado Parisi is currently offline Corrado ParisiFriend
Messages: 32
Registered: September 2016
Member
Yes this is in my parent POM. You're right with the fact that in the effective POM of the failing module the configuration with java17 is shown. My java18 configuration is nowhere seen there, nor in the child projects.

I can't see which project would set it to java17 but it looks like I'm out of control ...
Re: Scout - Maven - Configure animal sniffer plugin to use java 8? [message #1768123 is a reply to message #1768109] Thu, 13 July 2017 18:34 Go to previous messageGo to next message
Arthur van Dorp is currently offline Arthur van DorpFriend
Messages: 26
Registered: October 2015
Junior Member
You can always put your configuration in the POM where it is failing or in one of its ancestors (wherever the configuration from the config-master is pulled in). I don't have a computer at hand currently and can't check myself how it would look like in a typical Scout project setup.
Re: Scout - Maven - Configure animal sniffer plugin to use java 8? [message #1768144 is a reply to message #1768123] Fri, 14 July 2017 06:54 Go to previous messageGo to next message
Corrado Parisi is currently offline Corrado ParisiFriend
Messages: 32
Registered: September 2016
Member
The failing module declares with the <parent> tag my parent module (where my configuration is specified).I therefore get the same result if I specify the plugin in my parent or in the failing module.

I assume this whole problem comes from a wrong scout configuration which cannot be overriden.
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 messageGo to next message
Benjamin Schulte is currently offline Benjamin SchulteFriend
Messages: 34
Registered: December 2016
Member
Corrado Parisi wrote on Fri, 14 July 2017 06:54
I 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 messageGo to next message
Matthias Villiger is currently offline Matthias VilligerFriend
Messages: 134
Registered: September 2011
Senior Member
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 #1768215 is a reply to message #1768207] Fri, 14 July 2017 18:00 Go to previous messageGo to next message
Arthur van Dorp is currently offline Arthur van DorpFriend
Messages: 26
Registered: October 2015
Junior Member
The kaazing-signature shouldn't be necessary anymore. An offical java18 signature artifact is available under the org.codehaus.mojo.signature group id.
Re: Scout - Maven - Configure animal sniffer plugin to use java 8? [message #1768370 is a reply to message #1768215] Tue, 18 July 2017 06:57 Go to previous messageGo to next message
Corrado Parisi is currently offline Corrado ParisiFriend
Messages: 32
Registered: September 2016
Member
Thanks for your answers, I've managed to add the plugin in the failing module and now the build succeeds. Eclipse shows me the warning: "Duplicate managed version 1.15 for animal-sniffer-maven-plugin". In the effective pom I can see now java17 and java18, therefore the correct warning.

Can I do something about this?
Re: Scout - Maven - Configure animal sniffer plugin to use java 8? [message #1768371 is a reply to message #1768370] Tue, 18 July 2017 07:02 Go to previous messageGo to next message
Arthur van Dorp is currently offline Arthur van DorpFriend
Messages: 26
Registered: October 2015
Junior Member
Simply remove the line with the version from your POM, as it is the same as in the parent that should suffice.
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 messageGo to next message
Corrado Parisi is currently offline Corrado ParisiFriend
Messages: 32
Registered: September 2016
Member
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 #1768374 is a reply to message #1768372] Tue, 18 July 2017 07:26 Go to previous messageGo to next message
Arthur van Dorp is currently offline Arthur van DorpFriend
Messages: 26
Registered: October 2015
Junior Member
Yes, that sounds wrong. I presume that the configuration in your parent POM might be misplaced (in the end a "simple" Maven problem, as simple as they usually are...). I won't find time today or tomorrow to check on an own Scout project. I hope it doesn't block your further development in the meantime.
Re: Scout - Maven - Configure animal sniffer plugin to use java 8? [message #1768383 is a reply to message #1768374] Tue, 18 July 2017 08:16 Go to previous messageGo to next message
Corrado Parisi is currently offline Corrado ParisiFriend
Messages: 32
Registered: September 2016
Member
Thanks very much. No worries it doesn't block me, I'll just leave it disabled in the meantime :-)

Here the sample code I use that let's the build fail on any submodule, for instance 'client' or 'server':

		List<String> list = new ArrayList<>(Arrays.asList("a", "b", "c"));
		list.stream().filter(str -> str.startsWith("s")).collect(Collectors.toList());

[Updated on: Tue, 18 July 2017 08:22]

Report message to a moderator

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 messageGo to next message
Stephan Merkli is currently offline Stephan MerkliFriend
Messages: 21
Registered: April 2012
Junior Member
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>
Re: Scout - Maven - Configure animal sniffer plugin to use java 8? [message #1780793 is a reply to message #1778425] Sat, 27 January 2018 13:42 Go to previous message
Source Deposit is currently offline Source DepositFriend
Messages: 13
Registered: March 2017
Junior Member

Thank you Stephan Merkli !!!

I also had the problem just deployed:

execute goal org.codehaus.mojo: animal-sniffer-maven-plugin: 1.15: check (enforce-java-api-compatibility) on project


Everything went really well with your tip!

TipTop ... thank you!

Previous Topic:[NEON] Using Wizards (org.eclipse.scout.rt.client.ui.wizard)
Next Topic:Form Validation and Error Messages
Goto Forum:
  


Current Time: Wed Sep 19 19:15:06 GMT 2018

Powered by FUDForum. Page generated in 0.03085 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top