jira.codehaus.org

  • Log In Access more options
    • Online Help
    • Keyboard Shortcuts
    • About JIRA
    • JIRA Credits
    • What?s New
  • Dashboards Access more options (Alt+d)
  • Projects Access more options (Alt+p)
  • Issues Access more options (Alt+i)
  • Maven 2.x Resources Plugin
  • MRESOURCES-85

command line cannot overwrite pom properties

  • Log In
  • Views
    • XML
    • Word
    • Printable

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Duplicate
  • Affects Version/s: 2.2
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None

Description

With a pom like this

<properties>
<jboss.bind.address>localhost</jboss.bind.address>
</properties>

and a command line like this

mvn -Pjboss422 -Djboss.bind.address=foo clean test-compilecxf.xml

I get a filtered resource like this

<jaxws:endpoint id='TestService' address='http://localhost:8080/jaxws-cxf-descriptor'
implementor='org.jboss.test.ws.jaxws.cxf.descriptor.DescriptorEndpointImpl'>

<jaxws:invoker>
<bean class='org.jboss.wsf.stack.cxf.InvokerJSE'/>
</jaxws:invoker>

</jaxws:endpoint>

Note, the bind address is localhost

Issue Links

duplicates

Bug - A problem which impairs or prevents the functions of the product. MRESOURCES-39 Filtering fails for command line properties

  • Critical - Crashes, loss of data, severe memory leak.
  • Closed - The issue is considered finished, the resolution is correct. Issues which are not closed can be reopened.
relates to

Bug - A problem which impairs or prevents the functions of the product. MNG-1992 CLI -D should override properties in settings.xml

  • Major - Major loss of function.
  • Closed - The issue is considered finished, the resolution is correct. Issues which are not closed can be reopened.

Activity

Ascending order - Click to sort in descending order
  • All
  • Comments
  • Work Log
  • History
  • Activity
Hide
Permalink
Thomas Diesler added a comment - 24/Apr/08 3:11 AM

As a workaround, I can define the property in a profile

<!--
Name: no-jboss-bind-address
Descr: Set the default jboss.bind.address
-->
<profile>
<id>no-jboss-bind-address</id>
<activation>
<property>
<name>!jboss.bind.address</name>
</property>
</activation>
<properties>
<jboss.bind.address>localhost</jboss.bind.address>
</properties>
</profile>

Show
Thomas Diesler added a comment - 24/Apr/08 3:11 AM As a workaround, I can define the property in a profile <!-- Name: no-jboss-bind-address Descr: Set the default jboss.bind.address --> <profile> <id>no-jboss-bind-address</id> <activation> <property> <name>!jboss.bind.address</name> </property> </activation> <properties> <jboss.bind.address>localhost</jboss.bind.address> </properties> </profile>
Hide
Permalink
David Bernhard added a comment - 24/Apr/08 3:19 AM

I've noticed this one too - it's to do with the fact that system properties (and that includes command-line ones) are processed first and then overwritten by project (pom) ones. I don't see another way of doing this that won't mean all system properties take preference over pom ones, which is not desirable.

I've solved it locally by extending the resources-plugin so any property on the command-line that begins with "override." is applied last, i.e. "-Doverride.foo=bar" becomes "foo=bar" and overrides everything else. It's more a workaround than a fix though.

Show
David Bernhard added a comment - 24/Apr/08 3:19 AM I've noticed this one too - it's to do with the fact that system properties (and that includes command-line ones) are processed first and then overwritten by project (pom) ones. I don't see another way of doing this that won't mean all system properties take preference over pom ones, which is not desirable. I've solved it locally by extending the resources-plugin so any property on the command-line that begins with "override." is applied last, i.e. "-Doverride.foo=bar" becomes "foo=bar" and overrides everything else. It's more a workaround than a fix though.
Hide
Permalink
Thomas Diesler added a comment - 24/Apr/08 5:55 AM

Why is it not ok for system properties to take preference over pom ones?

Show
Thomas Diesler added a comment - 24/Apr/08 5:55 AM Why is it not ok for system properties to take preference over pom ones?
Hide
Permalink
Mikolaj Radwan added a comment - 03/Jun/08 6:09 AM - edited

EDIT: I have deleted the content of my comment, as it is, in fact, crap. Sry.

Show
Mikolaj Radwan added a comment - 03/Jun/08 6:09 AM - edited EDIT: I have deleted the content of my comment, as it is, in fact, crap. Sry.
Hide
Permalink
Thomas Diesler added a comment - 04/Sep/08 1:26 AM - edited

Also, a property defined in profiles.xml is not seen in module profile activation

<profilesXml xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/profiles-1.0.0.xsd">
  <profiles>
    
    <!-- This profile can also be defined in ~/.m2/settings.xml -->   
    <profile>
      <id>jboss-home-profile</id>
      <activation>
        <property>
          <name>user.name</name>
        </property>
      </activation>
      <properties>
        <jboss422.home>/home/tdiesler/svn/jbossas/tags/JBoss_4_2_2_GA/build/output/jboss-4.2.2.GA</jboss422.home>
        <jboss.bind.address>foo</jboss.bind.address>
      </properties>
    </profile>
    
  </profiles>
</profilesXml>
<!-- Profiles -->
  <profiles>
    <!-- 
    Name:  no-jboss-bind-address
    Descr: Set the default jboss.bind.address
    
    command line cannot overwrite pom properties
    http://jira.codehaus.org/browse/MNG-3546   
    -->
    <profile>
      <id>no-jboss-bind-address</id>
      <activation>
        <property>
          <name>!jboss.bind.address</name>
        </property>
      </activation>
      <properties>
        <jboss.bind.address>localhost</jboss.bind.address>
      </properties>
    </profile>
  </profiles>

The effective pom should show foo for all modules, but does not

[tdiesler@tdvaio trunk]$ mvn help:effective-pom | grep jboss.bind.address
    <jboss.bind.address>foo</jboss.bind.address>
    <jboss.bind.address>foo</jboss.bind.address>
    <jboss.bind.address>foo</jboss.bind.address>
    <jboss.bind.address>foo</jboss.bind.address>
    <jboss.bind.address>foo</jboss.bind.address>
    <jboss.bind.address>foo</jboss.bind.address>
    <jboss.bind.address>foo</jboss.bind.address>
    <jboss.bind.address>foo</jboss.bind.address>
    <jboss.bind.address>foo</jboss.bind.address>
    <jboss.bind.address>foo</jboss.bind.address>
      <id>no-jboss-bind-address</id>
          <name>!jboss.bind.address</name>
        <jboss.bind.address>localhost</jboss.bind.address>
    <jboss.bind.address>localhost</jboss.bind.address>
Show
Thomas Diesler added a comment - 04/Sep/08 1:26 AM - edited Also, a property defined in profiles.xml is not seen in module profile activation
<profilesXml xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/profiles-1.0.0.xsd">
  <profiles>
    
    <!-- This profile can also be defined in ~/.m2/settings.xml -->   
    <profile>
      <id>jboss-home-profile</id>
      <activation>
        <property>
          <name>user.name</name>
        </property>
      </activation>
      <properties>
        <jboss422.home>/home/tdiesler/svn/jbossas/tags/JBoss_4_2_2_GA/build/output/jboss-4.2.2.GA</jboss422.home>
        <jboss.bind.address>foo</jboss.bind.address>
      </properties>
    </profile>
    
  </profiles>
</profilesXml>
<!-- Profiles -->
  <profiles>
    <!-- 
    Name:  no-jboss-bind-address
    Descr: Set the default jboss.bind.address
    
    command line cannot overwrite pom properties
    http://jira.codehaus.org/browse/MNG-3546   
    -->
    <profile>
      <id>no-jboss-bind-address</id>
      <activation>
        <property>
          <name>!jboss.bind.address</name>
        </property>
      </activation>
      <properties>
        <jboss.bind.address>localhost</jboss.bind.address>
      </properties>
    </profile>
  </profiles>
The effective pom should show foo for all modules, but does not
[tdiesler@tdvaio trunk]$ mvn help:effective-pom | grep jboss.bind.address
    <jboss.bind.address>foo</jboss.bind.address>
    <jboss.bind.address>foo</jboss.bind.address>
    <jboss.bind.address>foo</jboss.bind.address>
    <jboss.bind.address>foo</jboss.bind.address>
    <jboss.bind.address>foo</jboss.bind.address>
    <jboss.bind.address>foo</jboss.bind.address>
    <jboss.bind.address>foo</jboss.bind.address>
    <jboss.bind.address>foo</jboss.bind.address>
    <jboss.bind.address>foo</jboss.bind.address>
    <jboss.bind.address>foo</jboss.bind.address>
      <id>no-jboss-bind-address</id>
          <name>!jboss.bind.address</name>
        <jboss.bind.address>localhost</jboss.bind.address>
    <jboss.bind.address>localhost</jboss.bind.address>

People

  • Assignee:
    Benjamin Bentmann
    Reporter:
    Thomas Diesler
Vote (4)
Watch (4)

Dates

  • Created:
    24/Apr/08 3:10 AM
    Updated:
    24/Mar/09 6:11 AM
    Resolved:
    24/Mar/09 6:11 AM
  • Atlassian JIRA (v5.0.4#731-sha1:3aa7374)
  • Report a problem
  • Powered by a free Atlassian JIRA open source license for Codehaus. Try JIRA - bug tracking software for your team.