It works fine for me, I had a test with Maven 3.0.2 and the following POM :

<project>
...
  <properties>
         <prop.to.override>111</prop.to.override>
  </properties>

  <profiles>
    <profile>
        <id>profile-test</id>
        <properties>
          <prop.to.override>444</prop.to.override>
        </properties>
    </profile>
  </profiles>

   <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <version>2.3.1</version>
         <executions>
          <execution>
            <id>default-jar</id>
            <phase>package</phase>
            <goals>
              <goal>jar</goal>
            </goals>
            <configuration>
              <archive>
                <manifestEntries>
                  <mode>development</mode>
                   <key>${prop.to.override}</key>
                </manifestEntries>
              </archive>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</project>

Then execute

1) mvn help:effective-pom -Doutput=pom-default.xml
<key>${prop.to.override}</key> => <key>111</key>

2) mvn help:effective-pom -Dprop.to.override=222 -Doutput=pom-override.xml
<key>${prop.to.override}</key> => <key>222</key>

3) mvn help:effective-pom -P profile-test -Dprop.to.override=333
-Doutput=pom-profile-override.xml
<key>${prop.to.override}</key> => <key>333</key>

4) mvn help:effective-pom -P profile-test -Doutput=pom-profile.xml
<key>${prop.to.override}</key> => <key>444</key>

Regards.

Maxime Gréau.
mgreau.com
*Auteur du livre **Apache Maven - Maîtriser l'infrastructure d'un projet
Java EE* <http://goo.gl/ivCZW>



2011/5/19 EJ Ciramella <[email protected]>

> Yep, I can clearly see that the -D property is NOT overriding the same
> property set in a profile.
>
> Just so I'm clear, there is a profile that has a bunch of settings that we
> want ALL of but ONE.  On occasion.
>
> So instead of creating an entirely new profile, it would be so much simpler
> to just set the property (on those rare occasions) via -D.
>
> It seems like it's a known issue and it seems like it is supposedly
> resolved, so I can't tell if this is a regression or this is so simple I'm
> missing it.
>
> Thanks again for the feedback!
>
> -----Original Message-----
> From: Maxime Gréau [mailto:[email protected]]
> Sent: Wednesday, May 18, 2011 5:51 AM
> To: Maven Users List
> Subject: Re: overriding properties via -D
>
> Hi,
>
> To be sure that properties are correctly overridden, you can use
> maven-help-plugin with the goal effective-pom, like this :
>
> 1) mvn help:effective-pom  -Doutput=pom-default.xml
> 2) mvn help:effective-pom -Dfoo=bar -Doutput=pom-override.xml
> 3) mvn help:effective-pom -P profil -Dfoo=bar
> -Doutput=pom-profil-override.xml
> 4) mvn help:effective-pom -P profil -Doutput=pom-profil.xml
>
> Then compare the foo properties in this files.
>
> Regards.
>
> Maxime Gréau.
> mgreau.com
> *Auteur du livre **Apache Maven - Maîtriser l'infrastructure d'un projet
> Java EE* <http://goo.gl/ivCZW>
>
>
>
> 2011/5/17 EJ Ciramella <[email protected]>
>
> > For what it's worth, I've stumbled across a series of bugs surrounding
> this
> > issue.
> >
> > This one either duplicates or is duplicated:
> >
> > http://jira.codehaus.org/browse/MNG-1992
> >
> >
> > -----Original Message-----
> > From: EJ Ciramella [mailto:[email protected]]
> > Sent: Tuesday, May 17, 2011 11:08 AM
> > To: [email protected]
> > Subject: overriding properties via -D
> >
> > Hi all -
> >
> > I've googled around and searched the mailing lists as I think this is a
> > pretty simple thing to do, but didn't find a clear answer.
> >
> > If there is a profile that has a <properties> stanza in it and in turn is
> > setting a property, are you not allowed to override that setting via a
> > -Dfoo=bar commandline option?
> >
> > There are a couple of places where instead of defining a whole new
> profiles
> > with just the value I'd like to change is inefficient.
> >
> >
> >
> > ________________________________
> > CONFIDENTIALITY NOTICE: This e-mail and the information transmitted
> within
> > including any attachments is only for the recipient(s) to which it is
> > intended and may contain confidential and/or privileged material. Any
> > review, retransmission, dissemination or other use of; or taking of any
> > action in reliance upon this information by persons or entities other
> than
> > the intended recipient is prohibited. If you received this in error,
> please
> > send the e-mail back by replying to the sender and permanently delete the
> > entire message and its attachments from all computers and network systems
> > involved in its receipt.
> >
> > CONFIDENTIALITY NOTICE:  This e-mail and the information transmitted
> within
> > including any attachments is only for the recipient(s) to which it is
> > intended and may contain confidential and/or privileged material. Any
> > review, retransmission, dissemination or other use of; or taking of any
> > action in reliance upon this information by persons or entities other
> than
> > the intended recipient is prohibited. If you received this in error,
> please
> > send the e-mail back by replying to the sender and permanently delete the
> > entire message and its attachments from all computers and network systems
> > involved in its receipt.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [email protected]
> > For additional commands, e-mail: [email protected]
> >
> >
>
> CONFIDENTIALITY NOTICE:  This e-mail and the information transmitted within
> including any attachments is only for the recipient(s) to which it is
> intended and may contain confidential and/or privileged material. Any
> review, retransmission, dissemination or other use of; or taking of any
> action in reliance upon this information by persons or entities other than
> the intended recipient is prohibited. If you received this in error, please
> send the e-mail back by replying to the sender and permanently delete the
> entire message and its attachments from all computers and network systems
> involved in its receipt.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>

Reply via email to