wouterhardeman / play2-maven-plugin

Automatically exported from code.google.com/p/play2-maven-plugin
0 stars 0 forks source link

Compile failed when using java 8 lamdas #35

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?

In the test project /test-projects/play22/java/helloworld :

1. Add the following properties to the pom.xml to switch to Java 8 source and 
target :

{{{
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>${maven.compiler.source}</maven.compiler.target>
}}}

2. Add the following lines at the beginning of the method 
controllers.Application.index() :

{{{
Set<Integer> integers = Arrays.asList("1", "2", "3", "4").stream().map(x -> 
Integer.valueOf(x)).collect(Collectors.toSet());
System.out.println(integers);
}}}

What is the expected output? What do you see instead?

I expect to see it compiling without error. 

However, I see :

{{{
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building Play! Framework 2.x Maven Test Projects : Play! 2.2.x : Java : 
Hello World 1.0.0-alpha7-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ helloworld ---
[INFO] Deleting 
/home/sbarbey/dev/sources/play2-maven-plugin/test-projects/play22/java/helloworl
d/target
[INFO] 
[INFO] --- play2-maven-plugin:1.0.0-alpha6:routes-compile 
(default-routes-compile) @ helloworld ---
[INFO] 
[INFO] --- play2-maven-plugin:1.0.0-alpha6:template-compile 
(default-template-compile) @ helloworld ---
[INFO] 3 templates processed, 3 compiled
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ 
helloworld ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 2 resources
[INFO] Copying 3 resources
[INFO] 
[INFO] --- sbt-compiler-maven-plugin:1.0.0-beta3:compile (default-compile) @ 
helloworld ---
[INFO] Compiling 5 Scala sources and 2 Java sources to 
/home/sbarbey/dev/sources/play2-maven-plugin/test-projects/play22/java/helloworl
d/target/classes...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 8.676s
[INFO] Finished at: Mon May 12 15:52:34 CEST 2014
[INFO] Final Memory: 43M/222M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal 
com.google.code.sbt-compiler-maven-plugin:sbt-compiler-maven-plugin:1.0.0-beta3:
compile (default-compile) on project helloworld: Execution default-compile of 
goal 
com.google.code.sbt-compiler-maven-plugin:sbt-compiler-maven-plugin:1.0.0-beta3:
compile failed: Unknown constant: 18 -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e 
switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please 
read the following articles:
[ERROR] [Help 1] 
http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException
}}}

What version of the product are you using? On what operating system?

* play2-maven-plugin: 1.0.0-alpha6
* sbt-compiler-maven-plugin: 1.0.0-beta3
* play: 2.2.2
* scala: 2.10.3

Please provide any additional information below.

Could be linked to these issues :

* https://github.com/sbt/sbt/issues/842
* https://github.com/sbt/sbt/issues/887

Original issue reported on code.google.com by simon.ba...@gmail.com on 12 May 2014 at 2:01

GoogleCodeExporter commented 8 years ago
Hi Simon

Thank you for detailed explanation. It helped a lot.

Change:

    <properties>
        ...
        <play2.plugin.version>1.0.0-alpha6</play2.plugin.version>
        <sbt-compiler.plugin.version>1.0.0-beta3</sbt-compiler.plugin.version>
    </properties>

to:

    <properties>
        ...
        <sbt.version>0.13.1</sbt.version>

        <play2.plugin.version>1.0.0-alpha7-SNAPSHOT</play2.plugin.version>
        <sbt-compiler.plugin.version>1.0.0-beta4-SNAPSHOT</sbt-compiler.plugin.version>
    </properties>

Read https://code.google.com/p/play2-maven-plugin/wiki/Usage about 
configuration required when using snapshot version of a plugin.

BTW, sbt-compiler-maven-plugin does not use neither "maven.compiler.source" nor 
"maven.compiler.target". You have to use plugin "javacOptions" and 
"scalacOptions" configuration properties:

https://sbt-compiler-maven-plugin.googlecode.com/svn/mavensite/1.0.0-beta4-SNAPS
HOT/sbt-compiler-maven-plugin/compile-mojo.html#javacOptions
https://sbt-compiler-maven-plugin.googlecode.com/svn/mavensite/1.0.0-beta4-SNAPS
HOT/sbt-compiler-maven-plugin/compile-mojo.html#scalacOptions

I have successfully compiled with SBT 0.13.1. You can use "0.13.2" and 
"0.13.5-M3" as well.

Original comment by gslowiko...@gmail.com on 12 May 2014 at 8:22

GoogleCodeExporter commented 8 years ago

Original comment by gslowiko...@gmail.com on 19 May 2014 at 12:33

GoogleCodeExporter commented 8 years ago

Original comment by gslowiko...@gmail.com on 2 Jun 2014 at 7:46

GoogleCodeExporter commented 8 years ago
I was waiting the release the plugins to test. So far it seems to have resolved 
the problem !

Thank you for your work !

Original comment by simon.ba...@gmail.com on 6 Jun 2014 at 2:55

GoogleCodeExporter commented 8 years ago
Cool, thanks.

Original comment by gslowiko...@gmail.com on 6 Jun 2014 at 3:20