3 Replies Latest reply on Feb 16, 2010 3:15 PM by pgier

    AS build - Overriding the versions in component-matrix/pom.xml through version ranges

    jaikiran

      I am seeing some weirdness with the AS build on our EJB3 build environment when version ranges are specified as system properties. In our EJB3 continuous integration builds, we build the AS with the following command:

      mvn clean install -Dskip-download-sources -U '-Dversion.org.jboss.ejb3=[0,)' 
      '-Dversion.org.jboss.ejb3.common.client=[0,)' 
      '-Dversion.org.jboss.ejb3.core.client=[0,)' 
      '-Dversion.org.jboss.ejb3.proxy.client=[0,)' 
      '-Dversion.org.jboss.ejb3.proxy.clustered.client=[0,)' 
      '-Dversion.org.jboss.ejb3.security.client=[0,)' 
      '-Dversion.org.jboss.ejb3.jpa.int=[0,)' 
      '-Dversion.org.jboss.metadata.ejb=[0,)'
      
      

       

      (All the -D params are on a single line in the actual setup. I had to split them into multiple lines in this post to get past the forum editor problem).

       

      Let's take the -Dversion.org.jboss.ejb3=[0,) as an example. Assuming that the latest available version is 1.0.5-SNAPSHOT, i would have expected that the entire AS build would use this version and copy the 1.0.5-SNAPSHOT jar of this artifact to common/lib. This used to work so far (don't know when it stopped working). The issue we are currently seeing, is that "some" parts of the AS build correctly pick up 1.0.5-SNAPSHOT of this jar where as other parts of the build use 1.0.4 (the version that is explicitly set in component-matrix/pom.xml). I can see that the part of the build which uses the properties of the following format (just an example):

       

      ${maven.dependency.org.jboss.ejb3.jboss-ejb3_1.jar.path}
      

       

      picks up the correct (latest SNAPSHOT) version. However, the "thirdparty" target in the build/build.xml picks up the version specified in the component-matrix/pom.xml.

       

      I tried to figure out what's going on, and from what i see, it appears like the version ranges are *not* supported with the maven ant plugin's dependencies goal:

       

      <maven:dependencies filesetId="pom.dependencies"
                              versionsId="pom.dependencies.versions"
                              scopes="compile, runtime">
            <pom refid="pom.project"/>
          </maven:dependencies>
      

       

      (I printed out the "versionsId" property through a echo statement and i could see that it doesn't honour the version ranges)

       

      If i change the build command to override using a specific version:

       

      mvn clean install -Dskip-download-sources -U '-Dversion.org.jboss.ejb3=1.0.3' 
      

       

      things start working fine. But the moment i override through (any) version range, i start seeing the issue. Is it expected that the dependencies goal doesn't support version ranges?

        • 1. Re: AS build - Overriding the versions in component-matrix/pom.xml through version ranges
          pgier

          I would think the Maven Ant Tasks would not have a problem with version ranges.  I have a feeling this has to do with the communication of the properties between the maven antrun plugin and the ant tasks.  Are your command line properties being passed from Maven to the Ant build correctly?  Can you try just echoing one of the properties that you are passing?

           

          I started working on some improvements to the antrun plugin that should simplify things a bit and possibly resolve this issue, but I probably won't be finished for a few more weeks.

          • 2. Re: AS build - Overriding the versions in component-matrix/pom.xml through version ranges
            jaikiran

            pgier wrote:

             

            Can you try just echoing one of the properties that you are passing?

             

             

            Since i suspect that it's the maven:dependencies in the "init-dependencies" target of build/build.xml, i added a echo statement to print one of the system properties being passed before the call to maven:dependencies. I then added one more echo statement after the maven:dependencies to print out the resolved version numbers (stored in the pom.dependencies.versions property):

             

            Index: build.xml
            ===================================================================
            --- build.xml   (revision 101012)
            +++ build.xml   (working copy)
            @@ -40,7 +40,7 @@
                 
                 <!-- Set a default file to use to define the thirdparty dependencies. -->
                 <property name="dist.pom.file" location="pom.xml"/>
            -    
            +    <echo>Property passed from command line ${version.org.jboss.ejb3}</echo>
                 <!-- 
                   -  Initialize properties for each dependency in the thirdparty pom 
                   -  The properties take the form "groupId:artifactId:packaging"
            @@ -51,6 +51,7 @@
                                     scopes="compile, runtime">
                   <pom refid="pom.project"/>
                 </maven:dependencies>
            +    <echo>versions are: ${pom.dependencies.versions}</echo> 
             
                 <mapper id="remove-versions" classpathref="maven-ant-tasks.classpath"
                           classname="org.apache.maven.artifact.ant.VersionMapper"
            
            

             

            I then ran mvn clean install from AS-trunk/build folder with the following properties (In this example the property -Dversion.org.jboss.ejb3 in that command line is the one that we are interested in):

             

            mvn clean install -Dskip-download-sources  -Dversion.org.jboss.ejb3=\(,1.0] -Dversion.org.jboss.ejb3.common.client=[0,\) 
            -Dversion.org.jboss.ejb3.core.client=[0,\) -Dversion.org.jboss.ejb3.proxy.client=[0,\) 
            -Dversion.org.jboss.ejb3.proxy.clustered.client=[0,\) 
            -Dversion.org.jboss.ejb3.security.client=[0,\) -Dversion.org.jboss.ejb3.jpa.int=[0,\) 
            -Dversion.org.jboss.metadata.ejb=[0,\)
            

             

            So i am passing -Dversion.org.jboss.ejb3=\(,1.0] (i.e. version <=1.0). The version specified in component-matrix/pom.xml for this artifact is 1.0.4. After running the command, here's the output:

             

            init-dependencies:
                 [echo] Property passed from command line (,1.0]
                 
                 [echo] versions are: 2.0.0-alpha-10:1.0.0-Beta-1:1.5.0.GA:6.0.0-20100216.180345-703:
                 6.0.0-20100216.180345-702:2.1.1.GA:3.0.1-native-2.0.4.GA:1.0.0.GA:
                 1.8.0:3.11.0.GA:3.0.0.GA:1.0-alpha-1:1.0:6.0.0-20100216.180345-705:1.0.0-CR-1:1.3:1.2:
                 6.0.0-20100216.180345-708:1.2.14:1.1:1.0_02.CR2:2.0.1:2.0.0:2.0.2-FCS:2.1.1.SP1:3.2.0.Beta1:
                 2.7.0.patch02-brew:1:2.0.0.CR3:1.1b:1.1.0.GA_SP1:1.0.0.Alpha1:1.0.0.Alpha2:3.2.1.GA:
                 6.0.0-20100216.180345-725:1.3.0:6.0.0-20100216.180345-723:6.0.0-20100216.180345-721:1.0.12-brew:
                 1.2.0.GA:0.3.4:3.0.0.GA_SP1:1.4.0.Beta1:6.0.0-Alpha8:1.0.0.CR7:5.2.0.Beta1:5.0.4.GA:
                 1.0.0.CR2:1.8.0.8-brew:1.0.0.CR3:3.1.0.GA:1.1.0:1.4.6.GA:1.1.1:2.2.17.GA:
                 1.0.3.GA:6.0.0-20100216.180345-713:0.1.0:1.0.2.GA:2.0.5.CR1:0.1.4:1.0.0.CR16:
                 1.1.0.GA:3.3.0.Beta3:3.3.0.Beta2:1.7.1:6.0.0-20100216.180345-715:1.5.2:2.1.2.GA:1.1-brew:
                 2.6.13.GA:6.0.0-20100216.180345-743:2.5-20081211:6.0.0-20100216.180345-740:2.5.6:6.0.0.Beta6:
                 6.0.0-20100216.180345-746:1.21-brew:1.5.6:6.0.0.Beta5:6.0.0-20100216.180345-749:
                 6.0.0-20100216.180345-748:3.0.0-beta-2:2.0.0.GA:1.1.0.Beta1:2.1.1:3.5.0-CR-1:2.1.3:2.1.8.GA:2.2.0.CR1:
                 4.0.2.GA:2.0-b01:5.0.3.GA:2.0.0.Alpha:2.0.0.Alpha13:6.1.16:6.0.0-20100216.180345-738:4.9.0.GA:2.5.2.SP2:
                 1.1.0.jboss:2.0.3.SP1:20050927:2.9.1:1.0-RC2:2.2.0.Alpha2:2.2.0.Alpha1:2.1.0.20091223:2.2.0.Alpha6:0.9RC4:
                 1.3.4-jboss-update1:2.0.0-alpha-1:3.2.3:2.0.0-alpha-4:0.1.0-alpha-2:2.0.0-alpha-3:3.2.6:2.0.0-alpha-2:2.1.0.CR1:
                 1.0.1.GA:2.0.0-alpha-6:3.0.4.GA:2.0.0.Alpha2:6.0.0-20100216.180345-381:1.4jboss:1.6.1:
                 1.0.4-20100215.041517-66:3.1:6.0.0-20100216.180345-750:1.0.2:1.0.1:5.1.0.CR1:5.1:1.0.0:1.0-MR1:
                 1.0.6:1.3.0.Beta2:1.0.4:2.7.6-brew:1.0.3:2.0.2.Beta3:2.2:1.0.0-alpha-4:1.2.2:1.2.8:1.4.3:2.4.0:
                 1.1.1.GA:2.3.1jboss.patch01-brew:1.4.2
            

            The first echo statement output shows that the property is being correctly passed. The second echo statement output (after maven:dependencies) shows that the version is being resolved to 1.0.4 (i.e. the one specified in component-matrix). Search for the string ":1.0.4:" in that echo statement output. So looks like the version range is completely ignored

             

            For the sake of testing, i then passed an explicit version override of 1.0.3 (i.e. not a version range) from the command line:

             

            mvn clean install -Dskip-download-sources  -Dversion.org.jboss.ejb3=1.0.3 -Dversion.org.jboss.ejb3.common.client=[0,\) 
            -Dversion.org.jboss.ejb3.core.client=[0,\) -Dversion.org.jboss.ejb3.proxy.client=[0,\) 
            -Dversion.org.jboss.ejb3.proxy.clustered.client=[0,\) 
            -Dversion.org.jboss.ejb3.security.client=[0,\) -Dversion.org.jboss.ejb3.jpa.int=[0,\) 
            -Dversion.org.jboss.metadata.ejb=[0,\)
            

             

            And here's the output:

             

            init-dependencies:
                 [echo] Property passed from command line 1.0.3
                 
                 [echo] versions are: 2.0.0-alpha-10:1.0.0-Beta-1:1.5.0.GA:6.0.0-20100216.180345-703:6.0.0-20100216.180345-702:
                 2.1.1.GA:3.0.1-native-2.0.4.GA:1.0.0.GA:1.8.0:3.11.0.GA:3.0.0.GA:1.0-alpha-1:1.0:6.0.0-20100216.180345-705:
                 1.0.0-CR-1:1.3:1.2:6.0.0-20100216.180345-708:1.2.14:1.1:1.0_02.CR2:2.0.1:2.0.0:2.0.2-FCS:2.1.1.SP1:
                 3.2.0.Beta1:2.7.0.patch02-brew:1:2.0.0.CR3:1.1b:1.1.0.GA_SP1:1.0.0.Alpha1:1.0.0.Alpha2:3.2.1.GA:
                 6.0.0-20100216.180345-725:1.3.0:6.0.0-20100216.180345-723:6.0.0-20100216.180345-721:1.0.12-brew:1.2.0.GA:
                 0.3.4:3.0.0.GA_SP1:1.4.0.Beta1:6.0.0-Alpha8:1.0.0.CR7:5.2.0.Beta1:5.0.4.GA:1.0.0.CR2:1.8.0.8-brew:
                 1.0.0.CR3:3.1.0.GA:1.1.0:1.4.6.GA:1.1.1:2.2.17.GA:1.0.3.GA:6.0.0-20100216.180345-713:0.1.0:
                 1.0.2.GA:2.0.5.CR1:0.1.4:1.0.0.CR16:1.1.0.GA:3.3.0.Beta3:3.3.0.Beta2:1.7.1:6.0.0-20100216.180345-715:
                 1.5.2:2.1.2.GA:1.1-brew:2.6.13.GA:6.0.0-20100216.180345-743:2.5-20081211:6.0.0-20100216.180345-740:2.5.6:
                 6.0.0.Beta6:6.0.0-20100216.180345-746:1.21-brew:1.5.6:6.0.0.Beta5:6.0.0-20100216.180345-749:
                 6.0.0-20100216.180345-748:3.0.0-beta-2:2.0.0.GA:1.1.0.Beta1:2.1.1:3.5.0-CR-1:2.1.3:2.1.8.GA:
                 2.2.0.CR1:4.0.2.GA:2.0-b01:5.0.3.GA:2.0.0.Alpha:2.0.0.Alpha13:6.1.16:6.0.0-20100216.180345-738:
                 4.9.0.GA:2.5.2.SP2:1.1.0.jboss:2.0.3.SP1:20050927:2.9.1:1.0-RC2:2.2.0.Alpha2:2.2.0.Alpha1:
                 2.1.0.20091223:2.2.0.Alpha6:0.9RC4:1.3.4-jboss-update1:2.0.0-alpha-1:3.2.3:2.0.0-alpha-4:0.1.0-alpha-2:
                 2.0.0-alpha-3:3.2.6:2.0.0-alpha-2:2.1.0.CR1:1.0.1.GA:2.0.0-alpha-6:3.0.4.GA:2.0.0.Alpha2:
                 6.0.0-20100216.180345-381:1.4jboss:1.6.1:1.0.4-20100215.041517-66:3.1:6.0.0-20100216.180345-750:
                 1.0.2:1.0.1:5.1.0.CR1:5.1:1.0.0:1.0-MR1:1.0.6:1.3.0.Beta2:2.7.6-brew:1.0.3:2.0.2.Beta3:2.2:
                 1.0.0-alpha-4:1.2.1:1.2.2:1.2.8:1.4.3:2.4.0:1.1.1.GA:2.3.1jboss.patch01-brew:1.4.2
            

            The echo statement after the maven:dependencies, shows that it picked up the version override and correctly resolved the version to 1.0.3 (search for ":1.0.3:") instead of the one specified in component-matrix/pom.xml.

             

            So this appears to be something around the maven:dependencies and it's version range resolution.

            • 3. Re: AS build - Overriding the versions in component-matrix/pom.xml through version ranges
              pgier
              Interesting, I'm not sure why the Ant tasks would be able to pass a single version to the dependency resolver, but not a version range.  Looks like you are probably correct that this is a bug in the Maven Ant tasks.