You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Smirnegger Steihnhoff <sm...@gmail.com> on 2011/01/21 14:11:50 UTC

Odd behaviour in dependency management with plugins

Hi,
I'm having some trouble with how maven resolves dependencies in my
project. The project has many sub-projects, and one of the
sub-projects does not build correctly when I build the whole project.
This problematic project is a WAR project which contains my app's web
services. In this project, I need two dependencies: one for the
project containing classes generated by wsimport, and an EJB project.
The pom has these relevant parts:
-- wsgen plugin
<plugin>
--<groupId>org.codehaus.mojo</groupId>
--<artifactId>jaxws-maven-plugin</artifactId>
--<version>1.12</version>
--...
--<executions>
----<execution>
------<id>generate-wsdl</id>
------<phase>pre-integration-test</phase>
------<goals>
--------<goal>wsgen</goal>
------</goals>
----</execution>
--</executions>
--<dependencies>
----<dependency>
------<groupId>${project.groupId}</groupId>
------<artifactId>EJB-Project</artifactId>
------<version>${project.version}</version>
------<type>ejb</type>
----</dependency>
----<dependency>
------<groupId>${project.groupId}</groupId>
------<artifactId>WS-Classes</artifactId>
------<version>${project.version}</version>
------<type>jar</type>
----</dependency>
--</dependencies>
</plugin>
...
</build>
<dependencies>
----<dependency>
------<groupId>${project.groupId}</groupId>
------<artifactId>EJB-Project</artifactId>
------<version>${project.version}</version>
------<type>ejb</type>
------<scope>provided</scope>
----</dependency>
----<dependency>
------<groupId>${project.groupId}</groupId>
------<artifactId>WS-Classes</artifactId>
------<version>${project.version}</version>
------<type>jar</type>
----</dependency>
</dependencies>

If I build this WAR project alone, the build is successfull. However,
when I issue the build on the Big Project, it fails by not finding
some classes in the EJB project (which has scope compile for the
plugin but cannot go in the WEB-INF/lib dir of the WAR, so it has
provided scope out of the plugin).
If I change the EJB project's scope to compile, the build succeeds,
but then the EJB project and all of it's dependencies end up in the
lib directory of the WAR. This breaks stuff when I package them into
an EAR, though.

Is there something I'm overlooking? What should I do?

TIA,

--
Khristian

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Odd behaviour in dependency management with plugins

Posted by Anders Hammar <an...@hammar.net>.
It smells like a reactor issue. Are you using Maven 2.x? Could you try Maven
3.0.2? Maven 3 has bug improvements (fixes) to reactor builds.

/Anders

On Fri, Jan 21, 2011 at 14:11, Smirnegger Steihnhoff
<sm...@gmail.com>wrote:

> Hi,
> I'm having some trouble with how maven resolves dependencies in my
> project. The project has many sub-projects, and one of the
> sub-projects does not build correctly when I build the whole project.
> This problematic project is a WAR project which contains my app's web
> services. In this project, I need two dependencies: one for the
> project containing classes generated by wsimport, and an EJB project.
> The pom has these relevant parts:
> -- wsgen plugin
> <plugin>
> --<groupId>org.codehaus.mojo</groupId>
> --<artifactId>jaxws-maven-plugin</artifactId>
> --<version>1.12</version>
> --...
> --<executions>
> ----<execution>
> ------<id>generate-wsdl</id>
> ------<phase>pre-integration-test</phase>
> ------<goals>
> --------<goal>wsgen</goal>
> ------</goals>
> ----</execution>
> --</executions>
> --<dependencies>
> ----<dependency>
> ------<groupId>${project.groupId}</groupId>
> ------<artifactId>EJB-Project</artifactId>
> ------<version>${project.version}</version>
> ------<type>ejb</type>
> ----</dependency>
> ----<dependency>
> ------<groupId>${project.groupId}</groupId>
> ------<artifactId>WS-Classes</artifactId>
> ------<version>${project.version}</version>
> ------<type>jar</type>
> ----</dependency>
> --</dependencies>
> </plugin>
> ...
> </build>
> <dependencies>
> ----<dependency>
> ------<groupId>${project.groupId}</groupId>
> ------<artifactId>EJB-Project</artifactId>
> ------<version>${project.version}</version>
> ------<type>ejb</type>
> ------<scope>provided</scope>
> ----</dependency>
> ----<dependency>
> ------<groupId>${project.groupId}</groupId>
> ------<artifactId>WS-Classes</artifactId>
> ------<version>${project.version}</version>
> ------<type>jar</type>
> ----</dependency>
> </dependencies>
>
> If I build this WAR project alone, the build is successfull. However,
> when I issue the build on the Big Project, it fails by not finding
> some classes in the EJB project (which has scope compile for the
> plugin but cannot go in the WEB-INF/lib dir of the WAR, so it has
> provided scope out of the plugin).
> If I change the EJB project's scope to compile, the build succeeds,
> but then the EJB project and all of it's dependencies end up in the
> lib directory of the WAR. This breaks stuff when I package them into
> an EAR, though.
>
> Is there something I'm overlooking? What should I do?
>
> TIA,
>
> --
> Khristian
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: Odd behaviour in dependency management with plugins

Posted by Jörg Schaible <jo...@gmx.de>.
Anders Hammar wrote:

> Or switch to Maven 3. :-)

We can build our tree with M2 and M3, so I have no proof yet :D

- Jörg


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Odd behaviour in dependency management with plugins

Posted by Anders Hammar <an...@hammar.net>.
Or switch to Maven 3. :-)

/Anders

On Fri, Jan 21, 2011 at 15:11, Jörg Schaible <jo...@gmx.de> wrote:

> Hi,
>
> Smirnegger Steihnhoff wrote:
>
> > Hi,
> > I'm having some trouble with how maven resolves dependencies in my
> > project. The project has many sub-projects, and one of the
> > sub-projects does not build correctly when I build the whole project.
> > This problematic project is a WAR project which contains my app's web
> > services. In this project, I need two dependencies: one for the
> > project containing classes generated by wsimport, and an EJB project.
> > The pom has these relevant parts:
> > -- wsgen plugin
> > <plugin>
> > --<groupId>org.codehaus.mojo</groupId>
> > --<artifactId>jaxws-maven-plugin</artifactId>
> > --<version>1.12</version>
> > --...
> > --<executions>
> > ----<execution>
> > ------<id>generate-wsdl</id>
> > ------<phase>pre-integration-test</phase>
> > ------<goals>
> > --------<goal>wsgen</goal>
> > ------</goals>
> > ----</execution>
> > --</executions>
> > --<dependencies>
> > ----<dependency>
> > ------<groupId>${project.groupId}</groupId>
> > ------<artifactId>EJB-Project</artifactId>
> > ------<version>${project.version}</version>
> > ------<type>ejb</type>
> > ----</dependency>
> > ----<dependency>
> > ------<groupId>${project.groupId}</groupId>
> > ------<artifactId>WS-Classes</artifactId>
> > ------<version>${project.version}</version>
> > ------<type>jar</type>
> > ----</dependency>
> > --</dependencies>
> > </plugin>
> > ...
> > </build>
> > <dependencies>
> > ----<dependency>
> > ------<groupId>${project.groupId}</groupId>
> > ------<artifactId>EJB-Project</artifactId>
> > ------<version>${project.version}</version>
> > ------<type>ejb</type>
> > ------<scope>provided</scope>
> > ----</dependency>
> > ----<dependency>
> > ------<groupId>${project.groupId}</groupId>
> > ------<artifactId>WS-Classes</artifactId>
> > ------<version>${project.version}</version>
> > ------<type>jar</type>
> > ----</dependency>
> > </dependencies>
> >
> > If I build this WAR project alone, the build is successfull. However,
> > when I issue the build on the Big Project, it fails by not finding
> > some classes in the EJB project (which has scope compile for the
> > plugin but cannot go in the WEB-INF/lib dir of the WAR, so it has
> > provided scope out of the plugin).
> > If I change the EJB project's scope to compile, the build succeeds,
> > but then the EJB project and all of it's dependencies end up in the
> > lib directory of the WAR. This breaks stuff when I package them into
> > an EAR, though.
> >
> > Is there something I'm overlooking? What should I do?
>
> I guess this is normal ;-)
>
> Remember, that Maven loads every plugin (with its classpath) only once. I
> simply suppose that you use the jaxws-plugin in your big project elsewhere
> first, where those two deps are not declared ... voilá!
>
> The real culprit though is the wsgen-plugin, since it does not add
> artifacts
> of scope priovided to its classpath used for compilation. This violates the
> POM definition and I'd consider this as bug.
>
> Unfortunately this does not help you. What I do is generating the WSDL in
> the WebService project itself and add those stuff as an attached artifact
> with classifier "wsdl". That way you don't have the need at all to generate
> the WSDL later on somewhere, because you can refer it as dependency.
>
> - Jörg
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: Odd behaviour in dependency management with plugins

Posted by Jörg Schaible <jo...@gmx.de>.
Hi,

Smirnegger Steihnhoff wrote:

> Hi,
> I'm having some trouble with how maven resolves dependencies in my
> project. The project has many sub-projects, and one of the
> sub-projects does not build correctly when I build the whole project.
> This problematic project is a WAR project which contains my app's web
> services. In this project, I need two dependencies: one for the
> project containing classes generated by wsimport, and an EJB project.
> The pom has these relevant parts:
> -- wsgen plugin
> <plugin>
> --<groupId>org.codehaus.mojo</groupId>
> --<artifactId>jaxws-maven-plugin</artifactId>
> --<version>1.12</version>
> --...
> --<executions>
> ----<execution>
> ------<id>generate-wsdl</id>
> ------<phase>pre-integration-test</phase>
> ------<goals>
> --------<goal>wsgen</goal>
> ------</goals>
> ----</execution>
> --</executions>
> --<dependencies>
> ----<dependency>
> ------<groupId>${project.groupId}</groupId>
> ------<artifactId>EJB-Project</artifactId>
> ------<version>${project.version}</version>
> ------<type>ejb</type>
> ----</dependency>
> ----<dependency>
> ------<groupId>${project.groupId}</groupId>
> ------<artifactId>WS-Classes</artifactId>
> ------<version>${project.version}</version>
> ------<type>jar</type>
> ----</dependency>
> --</dependencies>
> </plugin>
> ...
> </build>
> <dependencies>
> ----<dependency>
> ------<groupId>${project.groupId}</groupId>
> ------<artifactId>EJB-Project</artifactId>
> ------<version>${project.version}</version>
> ------<type>ejb</type>
> ------<scope>provided</scope>
> ----</dependency>
> ----<dependency>
> ------<groupId>${project.groupId}</groupId>
> ------<artifactId>WS-Classes</artifactId>
> ------<version>${project.version}</version>
> ------<type>jar</type>
> ----</dependency>
> </dependencies>
> 
> If I build this WAR project alone, the build is successfull. However,
> when I issue the build on the Big Project, it fails by not finding
> some classes in the EJB project (which has scope compile for the
> plugin but cannot go in the WEB-INF/lib dir of the WAR, so it has
> provided scope out of the plugin).
> If I change the EJB project's scope to compile, the build succeeds,
> but then the EJB project and all of it's dependencies end up in the
> lib directory of the WAR. This breaks stuff when I package them into
> an EAR, though.
> 
> Is there something I'm overlooking? What should I do?

I guess this is normal ;-)

Remember, that Maven loads every plugin (with its classpath) only once. I 
simply suppose that you use the jaxws-plugin in your big project elsewhere 
first, where those two deps are not declared ... voilá!

The real culprit though is the wsgen-plugin, since it does not add artifacts 
of scope priovided to its classpath used for compilation. This violates the 
POM definition and I'd consider this as bug.

Unfortunately this does not help you. What I do is generating the WSDL in 
the WebService project itself and add those stuff as an attached artifact 
with classifier "wsdl". That way you don't have the need at all to generate 
the WSDL later on somewhere, because you can refer it as dependency.

- Jörg


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org