Or switch to Maven 3. :-) /Anders
On Fri, Jan 21, 2011 at 15:11, Jörg Schaible <joerg.schai...@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-unsubscr...@maven.apache.org > For additional commands, e-mail: users-h...@maven.apache.org > >