You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by dan tran <da...@gmail.com> on 2005/08/29 07:52:29 UTC

[M2] Proposal to add Inheritent property in pom.xml

Hello all,

 I would like to add 

  <properties>
     <key1>value1</key1>
     <keyX>valueX</keyX>
  <properties>

I can see the following benefits:

   - Using single version property at the root pom to handle all sub project
     parent and dependencies versions

     For example:

         <parent>
            <groupId>parentgroupid<groupId>
            <artifactId>parentid</artifactId>
            <version>${my.version}</version>
         </parent>

         <artifactId>myid</artifactId>

         <dependencies>
            <dependency>
              <groupId>parentgroupid<groupId>
              <artifactId>parentid</artifactId>
              <version>${my.version}</version>
            </dependency>
         </dependencies>

         This will help tremendously interm usabitlity where can just modify my
         root pom and cut a new release without going to every sub project
         to change the version numbers and deal with SCM.

      - Second benefit is to have common string replacement in build
configuration.
        For example in mutlitplatform native build projects, I can
have the parent
        pom to hold some common property in include paths

       parent
           pom.xml
           windows-x86
              pom.xml
           aix-ppc
              pom.xml
           linux-x86
              pom.xml
           hpux-ia64
              pom.xml
           hpux-parisc
              pom.xml
           solaris-sparc
              pom.xml

     In parent pom i can have

           <properties>
              <otherprojectincludepath>
                    ${basedir}/../../licencemanager/src/main/h
              </otherprojectincludepath>
               many more....
           </properties>

      this way each platfrom specific project can reuse the parent property
        
      Currently I have to repeat many paths in each platforms which 
      become annoyed and hard to maintain

Other plugins can benefit this as well. For example multiple plugins can reused
${finalName} expression in their builds configuration

Is it possible in term of M2 architecture?

Thanks 

-Dan

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: [M2] Proposal to add Inheritent property in pom.xml

Posted by dan tran <da...@gmail.com>.
On 8/28/05, Brett Porter <br...@gmail.com> wrote:
> On 8/29/05, dan tran <da...@gmail.com> wrote:
> >      For example:
> >
> >          <parent>
> >             <groupId>parentgroupid<groupId>
> >             <artifactId>parentid</artifactId>
> >             <version>${my.version}</version>
> >          </parent>
> 
> This won't work without specifying my.version in every POM (you need
> to know what the parent is to find the value of my.version in the
> parent).

Agree that I need to specify <version>${my.version} in every pom.

> 
> >          <dependencies>
> >             <dependency>
> >               <groupId>parentgroupid<groupId>
> >               <artifactId>parentid</artifactId>
> >               <version>${my.version}</version>
> >             </dependency>
> >          </dependencies>
> 
> You can achieve this with <dependencyManagement/> in the root POM. You
> can already use ${version} there to use the current version.

I am currently place all possible external artifacts and internal
build artifacts under dependencyManagement.  however, for every new
created sub project, the developer will need to remember to add 
his/her artifact's dependencyMangement at the root level. This can
create repeated confusion that I hope to avoid.

In my dependencyManagement section, I also have other external projects that
have many artifacts using their own version for every artifact. So the property
reuse would help here.

But reuse of ${version} at the root pom is a big help here specially for 
developer. Big plus!!!!!

> 
> >
> >          This will help tremendously interm usabitlity where can just modify my
> >          root pom and cut a new release without going to every sub project
> >          to change the version numbers and deal with SCM.
> >
> 
> We plan to look at not requiring a parent version and doing some
> intelligent discovery of the parent. It was controversial so it may or
> may not go ahead.

I saw the JIRA for this issue.  It think it only works well when the
user has entired source tree on his/her local space where M2 can
traverse up all the way to the root pom in file system.

For now, I will need to write a custom plugin to traverse to all sub poms
checkout (clearcase term) to make each pom writeable, change 
the parent pom version, and checkin the pom.xml for each new release
( we do new release daily)

> 
> >      In parent pom i can have
> >
> >            <properties>
> >               <otherprojectincludepath>
> >                     ${basedir}/../../licencemanager/src/main/h
> >               </otherprojectincludepath>
> >                many more....
> >            </properties>
> 
> Why can't you just inherit the plugin configuration for this? Also,
> this won't work if the paths aren't exactly ../...

Like you say, there are many cases, where I can reuse a property expression in 
a bunch of configurations

    for example
       ${somepath}/windows for windows build
       ${somepath}/linux for  linux build
 
Inherit configuration wont help here.


> 
> > Other plugins can benefit this as well. For example multiple plugins can reused
> > ${finalName} expression in their builds configuration
> 
> That already works - ${build.finalName}
> 

Cool, it is new to me. My appology for missing this.

> > Is it possible in term of M2 architecture?
> 
> Certainly, but I don't think it is necessary...

> 
> Cheers,
> Brett
> 

Thanks for the feedback.

-Dan

> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Réf. : Re: [M2] Proposal to add Inheritent property in pom.xml

Posted by Brett Porter <br...@gmail.com>.
the artifactId is automatically appended to the SCM connection when it
is inherited. This can actually help in the case of a default.

I think you want access to ${parent.scm.connection}. I think that is a
good feature request for JIRA.

- Brett

On 8/29/05, fabrice.belingard@mpsa.com <fa...@mpsa.com> wrote:
> 
> 
> 
> 
> > > Is it possible in term of M2 architecture?
> >
> > Certainly, but I don't think it is necessary...
> 
> Brett,
> 
> I have a multiple project application developed under Eclipse, so my
> projects are at the same level as my root project (use of the "../" in the
> <modules> list). As a consequence, for every project, the SCM connection is
> configured like this:
> 
> Project 1 :
> <connection>scm:cvs:pserver:username@servername:/myCvsRootPath:projectModule1</connection>
> 
> Project 2 :
> <connection>scm:cvs:pserver:username@servername:/myCvsRootPath:projectModule2</connection>
> 
> Parent Project :
> <connection>scm:cvs:pserver:username@servername:/myCvsRootPath:projectRoot</connection>
> 
> In this case, I'd like to avoid repeating "
> scm:cvs:pserver:username@servername:/myCvsRootPath" in every pom of all the
> subprojects. Is there a way to do that currently? IMHO, properties would
> help in this case (and I can find other cases where this would be helpful
> as well, especially when you have naming conventions that make it easy to
> avoid repeating values in a pom or when you have values that are commons to
> all the projects of a company).
> 
> Cheers,
> Fabrice.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Réf. : Re: [M2] Proposal to add Inheritent property in pom.xml

Posted by fa...@mpsa.com.



> > Is it possible in term of M2 architecture?
>
> Certainly, but I don't think it is necessary...

Brett,

I have a multiple project application developed under Eclipse, so my
projects are at the same level as my root project (use of the "../" in the
<modules> list). As a consequence, for every project, the SCM connection is
configured like this:

Project 1 :
<connection>scm:cvs:pserver:username@servername:/myCvsRootPath:projectModule1</connection>

Project 2 :
<connection>scm:cvs:pserver:username@servername:/myCvsRootPath:projectModule2</connection>

Parent Project :
<connection>scm:cvs:pserver:username@servername:/myCvsRootPath:projectRoot</connection>

In this case, I'd like to avoid repeating "
scm:cvs:pserver:username@servername:/myCvsRootPath" in every pom of all the
subprojects. Is there a way to do that currently? IMHO, properties would
help in this case (and I can find other cases where this would be helpful
as well, especially when you have naming conventions that make it easy to
avoid repeating values in a pom or when you have values that are commons to
all the projects of a company).

Cheers,
Fabrice.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: [M2] Proposal to add Inheritent property in pom.xml

Posted by Brett Porter <br...@gmail.com>.
On 8/29/05, dan tran <da...@gmail.com> wrote:
>      For example:
> 
>          <parent>
>             <groupId>parentgroupid<groupId>
>             <artifactId>parentid</artifactId>
>             <version>${my.version}</version>
>          </parent>

This won't work without specifying my.version in every POM (you need
to know what the parent is to find the value of my.version in the
parent).

>          <dependencies>
>             <dependency>
>               <groupId>parentgroupid<groupId>
>               <artifactId>parentid</artifactId>
>               <version>${my.version}</version>
>             </dependency>
>          </dependencies>

You can achieve this with <dependencyManagement/> in the root POM. You
can already use ${version} there to use the current version.

> 
>          This will help tremendously interm usabitlity where can just modify my
>          root pom and cut a new release without going to every sub project
>          to change the version numbers and deal with SCM.
> 

We plan to look at not requiring a parent version and doing some
intelligent discovery of the parent. It was controversial so it may or
may not go ahead.

>      In parent pom i can have
> 
>            <properties>
>               <otherprojectincludepath>
>                     ${basedir}/../../licencemanager/src/main/h
>               </otherprojectincludepath>
>                many more....
>            </properties>

Why can't you just inherit the plugin configuration for this? Also,
this won't work if the paths aren't exactly ../...

> Other plugins can benefit this as well. For example multiple plugins can reused
> ${finalName} expression in their builds configuration

That already works - ${build.finalName}

> Is it possible in term of M2 architecture?

Certainly, but I don't think it is necessary...

Cheers,
Brett

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org