Hi,

I'm using Maven 2.1.0, with plugins: Maven WAR, Maven Release & Maven Eclipse.
My question is about the mechanism for resolving dependencies, more precisely 
resolution for a dependency with classifier.
I have a multi-projects architecture, with a parent and 5 modules: ejb, web-A, 
web-Z, webservices & ear.
With Maven WAR plugin, i "overlaying" the war-A into war-Z, with this 
configuration:

Into project-Z (web-Z):
        <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>2.1-beta-1</version>
                <configuration>
                        
<dependentWarExcludes>WEB-INF/web.xml,META-INF/**,WEB-INF/classes/**,WEB-INF/lib/**,WEB-INF/conf/**
 </dependentWarExcludes>
                        
<packagingIncludes>**/*.html,**/*.js,**/*.jsp,**/*.class,**/*.xls,**/*.tld,**/*.xml,**/*.xlt,**/WEB-INF/lib/agenda-web-*-classes.jar,**/*.css,**/*.properties,**/*.zip,**/*.png,**/*.jpg,**/*.gif,**/*.ico,**/*.txt,**/*.cur,**/*.as</packagingIncludes>
                        <useCache>false</useCache>
                        <webXml>${maven.war.webxml}</webXml>
                        <overlays>
                                <overlay>
                                        <groupId>ch.hcuge.mdt.agenda</groupId>
                                        <artifactId>agenda-web</artifactId>
                                        <includes>
                                                
<include>webRessources/**</include>
                                                <include>css/**</include>
                                                
<include>definitions/**</include>
                                                <include>errors/**</include>
                                                <include>scripts/**</include>
                                                <include>WEB-INF/*.tld</include>
                                        </includes>
                                        <excludes>
                                                
<exclude>WEB-INF/web.xml</exclude>
                                                <exclude>META-INF/**</exclude>
                                                
<exclude>WEB-INF/lib/**</exclude>
                                                
<exclude>WEB-INF/classes/**</exclude>
                                                
<exclude>WEB-INF/conf/**</exclude>
                                        </excludes>
                                </overlay>
                        </overlays>
                        <archive>
                                <manifest>
                                        <addClasspath>true</addClasspath>
                                </manifest>
                        </archive>
                </configuration>

                <executions>
                        <execution>
                                <phase>generate-sources</phase>
                                <goals>
                                        <goal>inplace</goal>
                                </goals>
                        </execution>
                </executions>                   
        </plugin>

And I built a jar with all web-A classes as like this:

Into project-A (web-A):
        <plugin>
                <artifactId>maven-war-plugin</artifactId>
                <version>2.1-beta-1</version>
                <configuration>
                        <webXml>${maven.war.webxml}</webXml>
                        
<warSourceExcludes>/webapp/WEB-INF/lib/**,**/*.jar</warSourceExcludes>
                        
<packagingExcludes>/webapp/WEB-INF/lib/**,**/*.jar</packagingExcludes>

                        <archive>
                                <manifest>
                                        <addClasspath>true</addClasspath>
                                </manifest>
                        </archive>

                        <attachClasses>true</attachClasses>
                        <useCache>false</useCache>
                </configuration> 
        </plugin>

In adding an "<attachClasses />" to the plugin configuration, i get a 
web-A-1.0-SNAPHOT-classes.jar with all Java classes. And after, i use this jar 
as dependency of web-Z project, like this:
        <dependency>
                <groupId>com.swisscompagny</groupId>
                <artifactId>web-A</artifactId>
                <version>${project.parent.version}</version>
                <classifier>classes</classifier>
        </dependency>

This jar is used for the compile phase and like reference in my eclipse project.

Now, after this very long explanation of the context, i can expose my problem. 
First, the stuff that works...
I run a "mvn clean install" and my build process is executed successfully, all 
dependencies are resolved and the result is right.
After I run a "mvn eclipse:clean eclipse:eclipse", and the result is the same 
... SUCCESSFUL!.

Now, I run a "mvn release:clean release:prepare release:perform" and... 
FAILURE! Dependencies are not resolved, particularly the 
"web-A-1.0-SNAPHOT-classes.jar" artifact. If i remove this dependency, the 
release is performed.
---
[WARNING] The dependency: com.swisscompagny:web-A:war:1.0.0-SNAPSHOT can't be 
resolved but has been found in the reactor.
This dependency has been excluded from the plugin execution. You should rerun 
this mojo after executing mvn install.

[WARNING] The dependency: com.swisscompagny:ejb:ejb:1.0.0-SNAPSHOT can't be 
resolved but has been found in the reactor.
This dependency has been excluded from the plugin execution. You should rerun 
this mojo after executing mvn install.

[WARNING] The dependency: com.swisscompagny:web-A:war:1.0.0-SNAPSHOT can't be 
resolved but has been found in the reactor.
This dependency has been excluded from the plugin execution. You should rerun 
this mojo after executing mvn install.

[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failed to resolve artifact.

Missing:
----------
1) com.swisscompagny:web-A:war:1.0.0-SNAPSHOT

  Path to dependency:
        1) com.swisscompagny:web-Z:war:0.5.1-RC0-SNAPSHOT
        2) com.swisscompagny:web-A:war:1.0.0-SNAPSHOT

2) com.swisscompagny:ejb:ejb:1.5.1-RC0-SNAPSHOT

  Path to dependency:
        1) com.swisscompagny:web-Z:war:0.5.0-SNAPSHOT
        2) com.swisscompagny:ejb:ejb:1.5.0-SNAPSHOT

3) com.swisscompagny:web-A:jar:classes:1.5.0-SNAPSHOT

  Path to dependency:
        1) com.swisscompagny:web-Z:war:0.5.0-SNAPSHOT
        2) com.swisscompagny:web-A:jar:classes:1.0.0-SNAPSHOT

----------
3 required artifacts are missing.

for artifact:
  com.swisscompagny:web-Z:war:0.5.0-SNAPSHOT
---

I can reproduce this problem, with "mvn dependency:tree". It seems to be due at 
the mecanism of dependencies resolution.

Could you explain me this fact ? Do you think i could do all my desires with 
this configuration ? Please help me, i search any solution since a week...

Best regards,
Florian

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to