wouterhardeman / play2-maven-plugin

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

Maven can't resolve .play2 packaging #36

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Build and deploy application
2. Try to use the application as maven dependency

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

Dependency should be resolved successfully. Instead, the dependecy resolver is 
looking for a package with .play2 extension instead of .jar

[error] (*:update) sbt.ResolveException: download failed: 
lt.spectrofinance.core#core-frontend-application;0.0.3-SNAPSHOT!core-frontend-ap
plication.play2

Please provide any additional information below.

If, in a deployed .pom file, I change <packaging> to jar, everything works. By 
the looks of it maven simply doesn't know how to handle the play2 packaging.

Versions used:

Maven 3.2.1
play2-maven-plugin 1.0.0-alpha6
Play 2.2.2

POM file for the project attached

Original issue reported on code.google.com by unique.y...@gmail.com on 14 May 2014 at 11:01

Attachments:

GoogleCodeExporter commented 8 years ago
SBT (actually Ivy used by SBT) does not know about "play2" packaging producing 
"jar" file.

The workaround is changing packaging from "play2" to "jar".

change:

...
    <packaging>play2</packaging>
...
            <plugin>
                <groupId>com.google.code.play2-maven-plugin</groupId>
                <artifactId>play2-maven-plugin</artifactId>
                <extensions>true</extensions>
            </plugin>
...

to

...
    <packaging>jar</packaging>
...
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.1</version>
                <configuration>
                    <skipMain>true</skipMain> <!-- skip compile -->
                    <skip>true</skip> <!-- skip testCompile -->
                </configuration>
            </plugin>

            <plugin>
                <groupId>com.google.code.sbt-compiler-maven-plugin</groupId>
                <artifactId>sbt-compiler-maven-plugin</artifactId>
                <version>${sbt-compiler.plugin.version}</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>compile</goal>
                            <goal>testCompile</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>com.google.code.play2-maven-plugin</groupId>
                <artifactId>play2-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>routes-compile</goal>
                            <goal>template-compile</goal>
                            <goal>enhance</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
...

It's verbose, but it works for me.

I've asked about this problem on SBT dev list. Here it is:
https://groups.google.com/forum/#!msg/sbt-dev/UZ2SB3SdnxA/PEijUw8VALkJ

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

GoogleCodeExporter commented 8 years ago
I found much better solution on SBT side.

Return to "play2" packaging in Maven and add this to your "build.sbt" file:

// If your Maven artifact is not deployed, only installed in local Maven 
repository
resolvers += "Local Maven Repository" at Path.userHome.asFile.toURI.toURL + 
".m2/repository"

classpathTypes += "play2"

libraryDependencies +=
  "lt.spectrofinance.core" % "core-frontend-application" % "0.0.3-SNAPSHOT" artifacts( Artifact("core-frontend-application", "jar", "jar") )

Original comment by gslowiko...@gmail.com on 15 May 2014 at 9:16

GoogleCodeExporter commented 8 years ago
Tell me if it works for you.

Original comment by gslowiko...@gmail.com on 15 May 2014 at 9:19

GoogleCodeExporter commented 8 years ago

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

GoogleCodeExporter commented 8 years ago
this does not work in sbt 0.13.5: classpathTypes += "play2"

Original comment by Andrei.Pozolotin on 17 Sep 2014 at 8:45

GoogleCodeExporter commented 8 years ago
It works for me, I've just tested it. Can you attach sample not working project?

Original comment by gslowiko...@gmail.com on 18 Sep 2014 at 7:09

GoogleCodeExporter commented 8 years ago
Here are my test projects.

Original comment by gslowiko...@gmail.com on 18 Sep 2014 at 9:41

Attachments: