5 Replies Latest reply on Jul 27, 2009 1:23 PM by jaikiran pai

    Overriding the default pom.xml during AS build

    jaikiran pai Master

      Currently in trunk, during the build process the thirdparty build step includes generating the dependency:

      <maven:dependencies filesetId="pom.dependencies"
       versionsId="pom.dependencies.versions"
       scopes="compile, runtime" type="pom, jar, zip, war"
       addArtifactFileSetRefs="true">
       <pom file="../thirdparty/pom.xml"/>
       </maven:dependencies>
      


      (Core) Maven has the option of using a custom pom file (instead of pom.xml) by specifying

      mvn -f my-overriden-pom.xml


      Would it be possible to allow something similar here in these tasks? Not just for thirdparty task but maybe other tasks too? So that if i want to override the pom.xml and build the AS then i could probably pass the file name as the param.

      P.S: I haven't checked the Branch_5_x, but if possible could this feature be allowed there too?


        • 1. Re: Overriding the default pom.xml during AS build
          Paul Gier Master

          Just to clarify, the code that you referenced is in build/build.xml and now also in testsuite/build.xml.

          The one in build/build.xml generates the properties and filesets that are used to gather all the jars into the distribution. You could certainly parameterize this just by changing

          <pom file="../thirdparty/pom.xml"/>
          

          To something like:
          <pom file="${thirdparty.pom}"/>
          


          But changing this wouldn't affect the module builds, so I'm not sure if it would accomplish what you are asking for.

          If the goal is to build against various versions of dependencies then what would have to change is component-matrix/pom.xml. And there isn't any way that I know of to tell maven to use a different file for that module because the -f option only affects the current directory. I looked into something similar to this a while back (MNG-3150)

          So when building the whole app server from the root directory, I'm kind of stuck with whatever is in component-matrix/pom.xml.


          • 2. Re: Overriding the default pom.xml during AS build
            jaikiran pai Master

             

            "pgier" wrote:
            Just to clarify, the code that you referenced is in build/build.xml and now also in testsuite/build.xml.

            Correct.

            "pgier" wrote:

            The one in build/build.xml generates the properties and filesets that are used to gather all the jars into the distribution. You could certainly parameterize this just by changing
            <pom file="../thirdparty/pom.xml"/>
            

            To something like:
            <pom file="${thirdparty.pom}"/>
            


            That would be helpful.

            "pgier" wrote:

            But changing this wouldn't affect the module builds, so I'm not sure if it would accomplish what you are asking for.

            Right. But i will be ensuring that i will use the same overriden pom file during the module builds too.


            And there isn't any way that I know of to tell maven to use a different file for that module because the -f option only affects the current directory. I looked into something similar to this a while back (MNG-3150)

            That's interesting. Infact i was going to try using the -f option for multi-module project.

            The usecase that i am working on involves a custom plugin which will trigger the Maven build for a given project. So if the thirdparty pom file name could be configurable then i could use that param through my plugin to trigger the build.


            • 3. Re: Overriding the default pom.xml during AS build
              jaikiran pai Master

               

              "pgier" wrote:

              The one in build/build.xml generates the properties and filesets that are used to gather all the jars into the distribution. You could certainly parameterize this just by changing
              <pom file="../thirdparty/pom.xml"/>
              

              To something like:
              <pom file="${thirdparty.pom}"/>
              




              Paul, should i open a feature request for this?

              • 4. Re: Overriding the default pom.xml during AS build
                Paul Gier Master

                I added a property to the distribution build/bulid.xml and the testsuite build.xml called thirdparty.pom.file, so you should be able to override these now.

                • 5. Re: Overriding the default pom.xml during AS build
                  jaikiran pai Master

                  Thanks Paul. I'll give this a try against the latest trunk.