preslavrachev / maven-play-plugin

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

Can Not Precompile #142

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
When I attempt to precompile, I get the following:

[ERROR] Failed to execute goal 
com.google.code.maven-play-plugin:play-maven-plugin:1.0.0-beta7:precompile 
(default-cli) on project MyProject: ?: Java retu
rned: -1 -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal 
com.google.code.maven-play-plugin:play-maven-plugin:1.0.0-beta7:precompile 
(defau
lt-cli) on project MyProject: ?
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: org.apache.maven.plugin.MojoExecutionException: ?
        at com.google.code.play.PlayPrecompileMojo.internalExecute(PlayPrecompileMojo.java:218)
        at com.google.code.play.AbstractPlayMojo.execute(AbstractPlayMojo.java:72)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
        ... 19 more
Caused by: Java returned: -1
        at org.apache.tools.ant.taskdefs.Java.execute(Java.java:111)
        at com.google.code.play.AbstractAntJavaBasedPlayMojo$JavaRunnable.run(AbstractAntJavaBasedPlayMojo.java:78)
        at java.lang.Thread.run(Thread.java:662)

I am not sure how to explain the best way to reproduce, since I there is 
insufficient feedback to even begin to understand where the problem lies. 
play:clean and play:initialize work fine. Is there any way to get better 
feedback, or do you have any ideas where the problem might lie?

Original issue reported on code.google.com by phil...@phillipwright.info on 22 Apr 2014 at 5:30

GoogleCodeExporter commented 9 years ago
Also, play:run, play:start and play:dependencies all seem to run fine.

Original comment by phil...@phillipwright.info on 22 Apr 2014 at 5:42

GoogleCodeExporter commented 9 years ago
Note: I am using eclipsify an importing the project into Eclipse.

I was able to get a similar error, by creating a new play project and adding 
the same dependencies (the problem seems to come from one of my company's other 
maven projects). When I try to precompile this without the dependency, it's 
fine. When I add this dependency, I get:

play.exceptions.CompilationException: The type DocViewerPlugin must implement 
the inherited abstract method Comparable<PlayPlugin>.compareTo(Object)

play.exceptions.CompilationException: The method getRealFile() is undefined for 
the type Object

Which makes me think something that is getting pulled in via this dependency is 
causing some problems.

However, I have no problem building directly with play when I copy the jar from 
this dependency into the lib folder first. 

Do you have any idea what the conflict could be to cause that error? I am not 
familiar enough with the Play internals to have a good idea at this point...

Original comment by phil...@phillipwright.info on 22 Apr 2014 at 6:19

GoogleCodeExporter commented 9 years ago
Can you run with -X option and attach log here?

Original comment by gslowiko...@gmail.com on 22 Apr 2014 at 6:25

GoogleCodeExporter commented 9 years ago
Even if I set the dependency scope to runtime (so that it isn't even needing 
during compilation), I still reproduce this.

Original comment by phil...@phillipwright.info on 22 Apr 2014 at 6:26

GoogleCodeExporter commented 9 years ago
Here's the log from when I set the scope to runtime.

Original comment by phil...@phillipwright.info on 22 Apr 2014 at 6:37

Attachments:

GoogleCodeExporter commented 9 years ago
I'm trying to limit the possibilities and noticed that the dependency itself 
has dependencies on other projects from my company. I added those dependencies 
directly, and it worked fine. I also tried copying all of the dependencies from 
the problem project and pasting them into the test project, and it failed. So 
it would seem that it is one of the dependencies pulled in by this project that 
is *not* in any other sub projects.

I will try to get a list of these dependencies...

Original comment by phil...@phillipwright.info on 22 Apr 2014 at 6:51

GoogleCodeExporter commented 9 years ago
This appears to be the culprit:

<dependency>
    <groupId>org.eclipse.core</groupId>
    <artifactId>org.eclipse.core.runtime</artifactId>
    <version>3.6.0.v20100505</version>
    <type>jar</type>
    <scope>compile</scope>
</dependency>

I don't know if this is conflicting with some of the Play code, the maven 
plugin code, or some other libs in our project, but when I exclude that, things 
are fine. I may try to place it back in the dependencies and see if removing 
something else helps...

Original comment by phil...@phillipwright.info on 22 Apr 2014 at 7:07

GoogleCodeExporter commented 9 years ago
There are many Eclipse dependencies and Play! uses Eclipse JDT compiler. These 
libraries can interfere in some unpredictable ways.

I don't understand, why this works with pure Play! Did you really successfully 
precompiled with pure Play! and all these dependencies in "lib" directory?

Original comment by gslowiko...@gmail.com on 22 Apr 2014 at 7:10

GoogleCodeExporter commented 9 years ago
More specifically, it appears to be the dependency this introduces on 
org.apache.felix

Original comment by phil...@phillipwright.info on 22 Apr 2014 at 7:20

GoogleCodeExporter commented 9 years ago
Actually, I see the difference.

When I use pure play, we build another war using another process, then we copy 
the data over to the lib directory in this project. In *that* directory, we are 
filtering out org.apache.felix, so it never makes it into the final lib folder 
used.

Sorry to have wasted your time on that :(

However, is there any way to produce a better error message in such a case? In 
the test example, I got some messages about the classes not compiling, which 
might, perhaps, point one to inspect the libs being imported, but in the actual 
project, I get no errors at all other than what I posted in the initial ticket.

Original comment by phil...@phillipwright.info on 22 Apr 2014 at 7:24

GoogleCodeExporter commented 9 years ago
Wow, there are Java classes.

I managed to reproduce your problem. It works with pure Play! and does not work 
with Maven. It must be different jars order in the classpath.

Anyway, "org.apache.felix:org.osgi.foundation" dependency has to be excluded.

Original comment by gslowiko...@gmail.com on 22 Apr 2014 at 7:27

GoogleCodeExporter commented 9 years ago
I will investigate more tomorrow.

Original comment by gslowiko...@gmail.com on 22 Apr 2014 at 7:29

GoogleCodeExporter commented 9 years ago
BTW, I meant "JDK classes" writing "Java classes" :)

Original comment by gslowiko...@gmail.com on 22 Apr 2014 at 7:30

GoogleCodeExporter commented 9 years ago
I found the difference between Maven and pure Play! precompilations.

Play! forks Java process.
In Maven it's configurable and turned off for performance reasons.
After turning on, it works (it has to have something to do with classloaders 
configuration).

    <build>
        <plugins>
            <plugin>
                <groupId>com.google.code.maven-play-plugin</groupId>
                <artifactId>play-maven-plugin</artifactId>
                <extensions>true</extensions>
                <configuration>
                    <precompileFork>true</precompileFork>
                </configuration>
            </plugin>
        </plugins>
    </build>

Let me know if it does not fix the issue.

Original comment by gslowiko...@gmail.com on 23 Apr 2014 at 8:57

GoogleCodeExporter commented 9 years ago
https://maven-play-plugin.googlecode.com/svn/mavensite/1.0.0-beta7/play-maven-pl
ugin/precompile-mojo.html#precompileFork

Original comment by gslowiko...@gmail.com on 23 Apr 2014 at 8:59

GoogleCodeExporter commented 9 years ago
Does it work for you? Can I close this issue?

Original comment by gslowiko...@gmail.com on 24 Apr 2014 at 9:27

GoogleCodeExporter commented 9 years ago
Source of the problem and a workaround found.

Original comment by gslowiko...@gmail.com on 29 Apr 2014 at 11:49