6 Replies Latest reply on Jul 12, 2011 6:14 AM by wolfc

    Maven dependency issue

    ales_d

      Hello I'm developing against JBoss AS 5 using Maven.

       

      I use https://repository.jboss.org/nexus/content/repositories/releases to resolve JBoss specific artefacts, but the the artefacts there depend on greate number of other artefacts they should not. Example:

       

      I'd like annotate class with org.jboss.ejb3.annotation.Service. So I include org.jboss.ejb3:jboss-ejb3-ext-api:1.1.1 in dependencies of my project. This will however drag in things like Xerces implementation, wutka DTD parser and much much more and many of the artefacts are not resolvable against the release repository (not the maven central). This is due dependencies on jboss-ejb-ext-api parent.

       

      The API package should not depend on any implementation library and, to be a good API, on as few es possible other APIs.

       

      Is this considered "bug" by JBoss standards?

       

      How do you normally use maven to develop agains JBoss? The APIs are normally "provided" by JBoss so the project only needs common J2EE APIs (available from maven central) and in special cases few JBoss specific interfaces or annotations.

       

      Ales

        • 1. Re: Maven dependency issue
          alesj

          <dependency>

            ...

             <exclusions>

                <exclude>

                 ...

           

          ;-)

          • 2. Re: Maven dependency issue
            ales_d

            Yes - I do it this way now. But have you seen the list?

             

            I was interested if there is some other solution that I might be missing. Can't belive that everyone who use maven for development against JBoss is building the exclude list manually like me.

             

            I was also interested on "principle". IMHO it is wrong to have for example XercesImpl listed in API dependency?

             

            I'll give it 2 or 3 days and if no good reasoning why it is this way is posted I'll try opening bug against the EJB3.

             

            Thanks

            • 3. Re: Maven dependency issue
              alesj

              Yes - I do it this way now. But have you seen the list?

               

              I was interested if there is some other solution that I might be missing. Can't belive that everyone who use maven for development against JBoss is building the exclude list manually like me.

              This is how Maven works, so I guess you should complain there. :-)

               

              I was also interested on "principle". IMHO it is wrong to have for example XercesImpl listed in API dependency?

              It depends what's the scope of this dependency -- probaby provided.

              • 4. Re: Maven dependency issue
                jaikiran

                The entire org.jboss.ejb3:jboss-ejb3-ext-api should be marked as "provided" scope within the  <dependency> of your project. It (like other JBoss jars) shouldn't be bundled within your application.

                • 5. Re: Maven dependency issue
                  ales_d

                  I definitelly would not complain to "how maven works" - it works as expected. Setting scope of jboss-ejb3-ext-api to provided would not help as long as the scope of its dependencies is "compile". See the table at  http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Dependency_Scope

                   

                  The problem IS jboss-ejb3-ext-api. Either it

                   

                  1) should not reference it's parent which "drags" in the unneeded dependencies, or

                  2) the parent should used provided scope for its dependencies

                   

                  Seems that the folks here are not strong in maven "theory" and go with defaults since they "just work". There are however differences and in this case they matter. :-)

                   

                  Ales

                  • 6. Re: Maven dependency issue
                    wolfc

                    Jaikiran is right, you should set the dependency to 'provided'. As seen in the table any transitive dependency would then also be in 'provided'.

                     

                    There is however a dependency on jboss-metadata in jboss-ejb3-ext-api, which is wrong.

                     

                    This is fixed in version 2 of jboss-ejb3-ext-api.