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

play2-maven with nonplay submodules #151

Closed
mhmgad opened this issue Aug 28, 2017 · 5 comments
Closed

play2-maven with nonplay submodules #151

mhmgad opened this issue Aug 28, 2017 · 5 comments

Comments

@mhmgad
Copy link

mhmgad commented Aug 28, 2017

So I tried to create project with 3 submodules one is play and 2 are normal java modules and I made the main POM file as in play24/multimodule example .. Whenever I try to execute mvn play2:run it fail to execute run on other submodules. I added the plugin to all submodules but I get this mvn error

Failed to execute goal com.google.code.play2-maven-plugin:play2-maven-plugin:1.0.0-rc1:run (default-cli) on project fact-spotting: ?: play.docs.BuildDocHandlerFactory -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.google.code.play2-maven-plugin:play2-maven-plugin:1.0.0-rc1:run (default-cli) on project fact-spotting: ?
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:213)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:154)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:146)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
        at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:309)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:194)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:107)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:993)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:345)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:191)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException: ?
        at com.google.code.play2.plugin.Play2RunMojo.internalExecute(Play2RunMojo.java:529)
        at com.google.code.play2.plugin.AbstractPlay2Mojo.execute(AbstractPlay2Mojo.java:139)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
        ... 20 more
Caused by: java.lang.ClassNotFoundException: play.docs.BuildDocHandlerFactory
        at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
        at com.google.code.play2.provider.play25.Play25Runner.runInDevMode(Play25Runner.java:100)
        at com.google.code.play2.plugin.Play2RunMojo.internalExecute(Play2RunMojo.java:509)
        ... 23 more

How can I fix that?

@gslowikowski
Copy link
Contributor

Hi. Can you create test project? This will help me find the bug faster.

@lukoyanov
Copy link

@mhmgad you can add following section to your non play submodules pom.xml to fix it.

    <build>
        <plugins>
...
            <plugin>
                <groupId>com.google.code.play2-maven-plugin</groupId>
                <artifactId>play2-maven-plugin</artifactId>
                <version>1.0.0-rc1</version>
                <configuration>
                    <playVersion>${play2.version}</playVersion>
                    <runSkip>true</runSkip>
                </configuration>
            </plugin>
...
        </plugins>
    </build>

@mhmgad
Copy link
Author

mhmgad commented Oct 20, 2017

@gslowikowski Sorry for not setup a test project .. I just got busy! .. I will try to simulate the senario

@lukoyanov I added it but when I use mvn play2:run on the main project it gives success messages for all sub-modules as well as the play one and the server is not starting.

So my hierarchy is :

Parent (Maven)
|-- commons (java maven NOT play)
|--core (java maven NOT play)
|-- web-app (java maven play)

All of them has pom files that have Parent specified and core has depends on commons and they compile together peacefully. Finally, I added web-app and it has core as dependency and added it as module to Parent and declared it to be the main play2 module.

When I follow example multimodel in play24 test projects and use play2:run from the Parent, it just gives success messages and do not start the server as expected.

On the other hand, when invoking play2:run from inside web-service directory it searches for the core and commons in the local repository instead of compiling/packaging them from the Parent project. So, I have to install them first into my repo.

Thank you for your suggestion, I tried it but the result is the same

Edit: The problem is resolved ... <mainModule> is a misleading property name.. it should be main artifactID (play module artifactId) something like that because maven uses the folder names for <module>.

Sorry for disturbance !

@mhmgad mhmgad closed this as completed Oct 20, 2017
@mhmgad
Copy link
Author

mhmgad commented Oct 20, 2017

The problem is resolved ... <mainModule> is a misleading property name.. it should be main artifactID (play module artifactId) something like that because maven uses the folder names for <module>.

@ranjan-rozario
Copy link

@mhmgad Hello, I seem to be facing the same issue. How did you resolve it ? I dont find any property in the pom.xml. Any help is appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants