Hello, I encountered a similar trouble. I have a Web application, which is built on Struts, Spring and Hibernate. At beginning, I added all of dependencies in one POM, then my real application project extends the POM(artifact). But since more and more artifacts are depended. The POM is more and more bigger. Now I split the POM into six smaller POMs. They declare dependencies on Struts, Spring, Hibernate, Apache, javax and others respectively. And they have following extension hierarchy, others-->javax-->Apache-->Hibernate-->Spring-->Struts
But in fact, the relation on dependency is complicated. Because many dependencies have transitive dependencies. Some dependencies may have same transitive dependencies, but version are different. For example, on servlet-api artiface. I declare servlet-api-2.4.jar in others POM, but commons-loggin(in Apache POM) has transitive dependency servlet-api-2.3.jar. Both of them are compile scope. When I run "mvn package" for the Web project, I found that servlet-api-2.3.jar, but servlet-api-2.4.jar, in WEB-INF/lib. If I modified POM of commons-loggin, and declared servlet-api-2.3.jar as provided dependency, then none of them would be put into WEB-INF/lib! For example, on jta artifact. others POM declares jta-1.0.B.jar as dependency directly, and spring-parent.pom(Spring artifacts' parent POM) declares jta as optional. Then jta-1.0.B.jar wasn't in WEB-INF/lib, too. The trouble is very very trouble. How to explain and solve the problem? Thanks in advance! a cup of Java, cheers! Sha Jiang Jörg Schaible wrote: > > jiangshachina wrote on Wednesday, November 22, 2006 2:38 AM: > >> Hi guys, >> I found the key. >> >> In management-1.0.pom, I excludes jta from hibernate dependency. >> At beginning, I didn't use jta-1.0.1B, but j2ee-1.4.jar, because >> jta-1.0.1B.jar isn't at central repository. >> But jta is transitive dependency of yy another dependency >> hibernate-3.0.jar, so I excludes it. >> >> Serval days later, I wanted to use jta directly and installed >> jta-1.0.1B.jar by manual. >> Unfortunately, I didn't remove the statements of excluding. >> >> According to the case, it seems that excluding scripts have higher >> priority. > > No, it is worse. It depends on the internal sequence the deps are > processed. If the local jta declaration is found before the hibernate one, > jta would have been *not* excluded. Since the sequence of this list > changes with every arbitrary added or removed dep (or new version) I > believe that is based on a iterator over a hash map ... which makes it > really annoying. > > The bug is supposed to be fixed since months in subversion though ... like > so many other ones. > > - Jörg > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > -- View this message in context: http://www.nabble.com/Don%27t-add-dependency--tf2677027s177.html#a7537433 Sent from the Maven - Users mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
