You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Mike Darretta <mi...@metnet.navy.mil> on 2006/02/10 19:34:09 UTC

Can't Figure Out How to Add System Properties For My Modules

I'm new to maven2 and can't seem to figure out how to replace my old 
build.properties.

I've done *all* of the following:

(1) Created ~/.m2/settings.xml:

<settings>
   <profiles>
     <profile>
       <id>project_name</id>
       <activation>
         <activeByDefault/>
       </activation>
       <properties>
         <system.property.name>
           system_property_value
         </system.property.name>
       </properties>
     </profile>
   </profiles>
</settings>

(2) Createed ${PROJECT_HOME}/profiles.xml (with the assumption that this 
is used for all modules as well):

<profilesXml>
   <profiles>
     <profile>
       <id>project_name</id>
       <activation>
         <activeByDefault/>
       </activation>
       <properties>
         <system.property.name>
           system_property_value
         </system.property.name>
       </properties>
     </profile>
   </profiles>
</profilesXml>

(3) Added filters to top-level pom.xml, and referenced my old 
build.properties file. In this instance, *some* of my resources had the 
properties properly inserted, but not the ones that count. For example, 
web.xml was filtered within the target/classes directory, but *not* 
within the target/${PROJECT_NAME}/WEB-INF directory, nor the actual 
repository version.

(4) Tried CLI maven -Dsystem.property.name=system_property_value clean 
install - nothing...

(5) Of course, all of my property keys are written as 
${system.property.name} within my module resoures.

This *has* to be an easy task, but I just am not getting it! Can anyone 
provide some assistance, maybe in the form of a good example file(s)?

By the way, I don't want the key/value pairs defined in my pom.xml 
(unless they are referencing the value as a variable).

Thanks.
Mike


-- 

Mike Darretta
Computer Sciences Corporation (CSC)
Sr. Software Engineer
(o) 831.656.4324
(c) 209.814.2774
michael.darretta.ctr@metnet.navy.mil

------------------------------------------------------------
This is a PRIVATE message. If you are not the intended recipient, please 
delete without copying and kindly advise us by e-mail of the mistake in 
delivery. NOTE: Regardless of content, this e-mail shall not operate to 
bind CSC to any order or other contract unless pursuant to explicit 
written agreement or government initiative expressly permitting the use 
of e-mail for such purpose.
------------------------------------------------------------


Re: Can't Figure Out How to Add System Properties For My Modules

Posted by Ray Ward <wa...@gmail.com>.
You're probably right about build.properties and project.properties, I'm
just now picking up m2.

I went through the Getting Started docs on "How do I filter resource files?"
and successfully set property values using their examples.  But I still have
questions about their syntax, as there seems to be a lot of implicit
defaults I haven't learned yet.
http://maven.apache.org/guides/getting-started/index.html

One thing you might try is to set the properties in a <properties> section
of the pom.xml:

<project>
  ...
  <dependencies>
          ...
  </dependencies>
  <build>
    ...
  </build>
  <properties>
    <my.filter.value>hello</my.filter.value>
  </properties>
</project>

This worked when I tried it.

On 2/10/06, Mike Darretta <mi...@metnet.navy.mil> wrote:
>
> My understanding of maven 2 is that build.properties and
> project.properties are no longer required or even read. Am I mistaken?
>
> Please note that there is a top level project (nicweb) with several
> second-tier modules that actually contain the property key references. I
> assume that, if I run the "mvn install" from the top-level, that all
> modules will share the read properties.
>
> There are several properties (which I probably should have referred to
> as 'application' properties, but I don't think it matters) in my app.
> The one I am using for testing is:
>
> >> nicweb.ufs.application.properties.location =
> /etc/jboss/iaportal/nicweb/nicweb-ufs-application.properties
>
> Maybe I am misunderstanding the concept of profiles, and what the
> <properties> tag actual represents. I wish there were more real-life
> examples in the documentation. (Maybe I just haven't found it??)
>
> Thanks,
> Mike
>
> Ray Ward wrote:
>
> > I think the precedence for properties is:
> > command line
> > ~/build.properties
> > <project> build.properties
> > <project> project.properties
> > <parent_project> build.properties
> > <parent_project> project.properties
> >
> > So I have no idea why your (4) didn't work.  What is the value name?
> >
> >
> > On 2/10/06, Mike Darretta <mi...@metnet.navy.mil> wrote:
> >
> >>I'm new to maven2 and can't seem to figure out how to replace my old
> >>build.properties.
> >>
> >>I've done *all* of the following:
> >>
> >>(1) Created ~/.m2/settings.xml:
> >>
> >><settings>
> >>  <profiles>
> >>    <profile>
> >>      <id>project_name</id>
> >>      <activation>
> >>        <activeByDefault/>
> >>      </activation>
> >>      <properties>
> >>        <system.property.name>
> >>          system_property_value
> >>        </system.property.name>
> >>      </properties>
> >>    </profile>
> >>  </profiles>
> >></settings>
> >>
> >>(2) Createed ${PROJECT_HOME}/profiles.xml (with the assumption that this
> >>is used for all modules as well):
> >>
> >><profilesXml>
> >>  <profiles>
> >>    <profile>
> >>      <id>project_name</id>
> >>      <activation>
> >>        <activeByDefault/>
> >>      </activation>
> >>      <properties>
> >>        <system.property.name>
> >>          system_property_value
> >>        </system.property.name>
> >>      </properties>
> >>    </profile>
> >>  </profiles>
> >></profilesXml>
> >>
> >>(3) Added filters to top-level pom.xml, and referenced my old
> >>build.properties file. In this instance, *some* of my resources had the
> >>properties properly inserted, but not the ones that count. For example,
> >>web.xml was filtered within the target/classes directory, but *not*
> >>within the target/${PROJECT_NAME}/WEB-INF directory, nor the actual
> >>repository version.
> >>
> >>(4) Tried CLI maven -Dsystem.property.name=system_property_value clean
> >>install - nothing...
> >>
> >>(5) Of course, all of my property keys are written as
> >>${system.property.name} within my module resoures.
> >>
> >>This *has* to be an easy task, but I just am not getting it! Can anyone
> >>provide some assistance, maybe in the form of a good example file(s)?
> >>
> >>By the way, I don't want the key/value pairs defined in my pom.xml
> >>(unless they are referencing the value as a variable).
> >>
> >>Thanks.
> >>Mike
> >>
> >>
> >>--
> >>
> >>Mike Darretta
> >>Computer Sciences Corporation (CSC)
> >>Sr. Software Engineer
> >>(o) 831.656.4324
> >>(c) 209.814.2774
> >>michael.darretta.ctr@metnet.navy.mil
> >>
> >>------------------------------------------------------------
> >>This is a PRIVATE message. If you are not the intended recipient, please
> >>delete without copying and kindly advise us by e-mail of the mistake in
> >>delivery. NOTE: Regardless of content, this e-mail shall not operate to
> >>bind CSC to any order or other contract unless pursuant to explicit
> >>written agreement or government initiative expressly permitting the use
> >>of e-mail for such purpose.
> >>------------------------------------------------------------
> >>
> >>
> >>
> >>---------------------------------------------------------------------
> >>To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> >>For additional commands, e-mail: users-help@maven.apache.org
> >>
> >>
> >
> >
>
> --
>
> Mike Darretta
> Computer Sciences Corporation (CSC)
> Sr. Software Engineer
> (o) 831.656.4324
> (c) 209.814.2774
> michael.darretta.ctr@metnet.navy.mil
>
> ------------------------------------------------------------
> This is a PRIVATE message. If you are not the intended recipient, please
> delete without copying and kindly advise us by e-mail of the mistake in
> delivery. NOTE: Regardless of content, this e-mail shall not operate to
> bind CSC to any order or other contract unless pursuant to explicit
> written agreement or government initiative expressly permitting the use
> of e-mail for such purpose.
> ------------------------------------------------------------
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: Can't Figure Out How to Add System Properties For My Modules

Posted by Mike Darretta <mi...@metnet.navy.mil>.
My understanding of maven 2 is that build.properties and 
project.properties are no longer required or even read. Am I mistaken?

Please note that there is a top level project (nicweb) with several 
second-tier modules that actually contain the property key references. I 
assume that, if I run the "mvn install" from the top-level, that all 
modules will share the read properties.

There are several properties (which I probably should have referred to 
as 'application' properties, but I don't think it matters) in my app. 
The one I am using for testing is:

 >> nicweb.ufs.application.properties.location = 
/etc/jboss/iaportal/nicweb/nicweb-ufs-application.properties

Maybe I am misunderstanding the concept of profiles, and what the 
<properties> tag actual represents. I wish there were more real-life 
examples in the documentation. (Maybe I just haven't found it??)

Thanks,
Mike

Ray Ward wrote:

> I think the precedence for properties is:
> command line
> ~/build.properties
> <project> build.properties
> <project> project.properties
> <parent_project> build.properties
> <parent_project> project.properties
> 
> So I have no idea why your (4) didn't work.  What is the value name?
> 
> 
> On 2/10/06, Mike Darretta <mi...@metnet.navy.mil> wrote:
> 
>>I'm new to maven2 and can't seem to figure out how to replace my old
>>build.properties.
>>
>>I've done *all* of the following:
>>
>>(1) Created ~/.m2/settings.xml:
>>
>><settings>
>>  <profiles>
>>    <profile>
>>      <id>project_name</id>
>>      <activation>
>>        <activeByDefault/>
>>      </activation>
>>      <properties>
>>        <system.property.name>
>>          system_property_value
>>        </system.property.name>
>>      </properties>
>>    </profile>
>>  </profiles>
>></settings>
>>
>>(2) Createed ${PROJECT_HOME}/profiles.xml (with the assumption that this
>>is used for all modules as well):
>>
>><profilesXml>
>>  <profiles>
>>    <profile>
>>      <id>project_name</id>
>>      <activation>
>>        <activeByDefault/>
>>      </activation>
>>      <properties>
>>        <system.property.name>
>>          system_property_value
>>        </system.property.name>
>>      </properties>
>>    </profile>
>>  </profiles>
>></profilesXml>
>>
>>(3) Added filters to top-level pom.xml, and referenced my old
>>build.properties file. In this instance, *some* of my resources had the
>>properties properly inserted, but not the ones that count. For example,
>>web.xml was filtered within the target/classes directory, but *not*
>>within the target/${PROJECT_NAME}/WEB-INF directory, nor the actual
>>repository version.
>>
>>(4) Tried CLI maven -Dsystem.property.name=system_property_value clean
>>install - nothing...
>>
>>(5) Of course, all of my property keys are written as
>>${system.property.name} within my module resoures.
>>
>>This *has* to be an easy task, but I just am not getting it! Can anyone
>>provide some assistance, maybe in the form of a good example file(s)?
>>
>>By the way, I don't want the key/value pairs defined in my pom.xml
>>(unless they are referencing the value as a variable).
>>
>>Thanks.
>>Mike
>>
>>
>>--
>>
>>Mike Darretta
>>Computer Sciences Corporation (CSC)
>>Sr. Software Engineer
>>(o) 831.656.4324
>>(c) 209.814.2774
>>michael.darretta.ctr@metnet.navy.mil
>>
>>------------------------------------------------------------
>>This is a PRIVATE message. If you are not the intended recipient, please
>>delete without copying and kindly advise us by e-mail of the mistake in
>>delivery. NOTE: Regardless of content, this e-mail shall not operate to
>>bind CSC to any order or other contract unless pursuant to explicit
>>written agreement or government initiative expressly permitting the use
>>of e-mail for such purpose.
>>------------------------------------------------------------
>>
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>For additional commands, e-mail: users-help@maven.apache.org
>>
>>
> 
> 

-- 

Mike Darretta
Computer Sciences Corporation (CSC)
Sr. Software Engineer
(o) 831.656.4324
(c) 209.814.2774
michael.darretta.ctr@metnet.navy.mil

------------------------------------------------------------
This is a PRIVATE message. If you are not the intended recipient, please 
delete without copying and kindly advise us by e-mail of the mistake in 
delivery. NOTE: Regardless of content, this e-mail shall not operate to 
bind CSC to any order or other contract unless pursuant to explicit 
written agreement or government initiative expressly permitting the use 
of e-mail for such purpose.
------------------------------------------------------------


Re: Can't Figure Out How to Add System Properties For My Modules

Posted by Ray Ward <wa...@gmail.com>.
I think the precedence for properties is:
command line
~/build.properties
<project> build.properties
<project> project.properties
<parent_project> build.properties
<parent_project> project.properties

So I have no idea why your (4) didn't work.  What is the value name?


On 2/10/06, Mike Darretta <mi...@metnet.navy.mil> wrote:
>
> I'm new to maven2 and can't seem to figure out how to replace my old
> build.properties.
>
> I've done *all* of the following:
>
> (1) Created ~/.m2/settings.xml:
>
> <settings>
>   <profiles>
>     <profile>
>       <id>project_name</id>
>       <activation>
>         <activeByDefault/>
>       </activation>
>       <properties>
>         <system.property.name>
>           system_property_value
>         </system.property.name>
>       </properties>
>     </profile>
>   </profiles>
> </settings>
>
> (2) Createed ${PROJECT_HOME}/profiles.xml (with the assumption that this
> is used for all modules as well):
>
> <profilesXml>
>   <profiles>
>     <profile>
>       <id>project_name</id>
>       <activation>
>         <activeByDefault/>
>       </activation>
>       <properties>
>         <system.property.name>
>           system_property_value
>         </system.property.name>
>       </properties>
>     </profile>
>   </profiles>
> </profilesXml>
>
> (3) Added filters to top-level pom.xml, and referenced my old
> build.properties file. In this instance, *some* of my resources had the
> properties properly inserted, but not the ones that count. For example,
> web.xml was filtered within the target/classes directory, but *not*
> within the target/${PROJECT_NAME}/WEB-INF directory, nor the actual
> repository version.
>
> (4) Tried CLI maven -Dsystem.property.name=system_property_value clean
> install - nothing...
>
> (5) Of course, all of my property keys are written as
> ${system.property.name} within my module resoures.
>
> This *has* to be an easy task, but I just am not getting it! Can anyone
> provide some assistance, maybe in the form of a good example file(s)?
>
> By the way, I don't want the key/value pairs defined in my pom.xml
> (unless they are referencing the value as a variable).
>
> Thanks.
> Mike
>
>
> --
>
> Mike Darretta
> Computer Sciences Corporation (CSC)
> Sr. Software Engineer
> (o) 831.656.4324
> (c) 209.814.2774
> michael.darretta.ctr@metnet.navy.mil
>
> ------------------------------------------------------------
> This is a PRIVATE message. If you are not the intended recipient, please
> delete without copying and kindly advise us by e-mail of the mistake in
> delivery. NOTE: Regardless of content, this e-mail shall not operate to
> bind CSC to any order or other contract unless pursuant to explicit
> written agreement or government initiative expressly permitting the use
> of e-mail for such purpose.
> ------------------------------------------------------------
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: Can't Figure Out How to Add System Properties For My Modules

Posted by Stephen Duncan <st...@gmail.com>.
I'm not sure what <activeByDefault /> does, but it's not going to turn
it on automatically.  What you want is:

<settings>
  <profiles>
    <profile>
      <id>project_name</id>
      <activation>
        <activeByDefault/>
      </activation>
      <properties>
        <system.property.name>
          system_property_value
        </system.property.name>
      </properties>
    </profile>
  </profiles>
  <activeProfiles>
    <activeProfile>project_name</activeProfile>
  </activeProfiles>
</settings>

-Stephen


On 2/10/06, Mike Darretta <mi...@metnet.navy.mil> wrote:
> I'm new to maven2 and can't seem to figure out how to replace my old
> build.properties.
>
> I've done *all* of the following:
>
> (1) Created ~/.m2/settings.xml:
>
> <settings>
>    <profiles>
>      <profile>
>        <id>project_name</id>
>        <activation>
>          <activeByDefault/>
>        </activation>
>        <properties>
>          <system.property.name>
>            system_property_value
>          </system.property.name>
>        </properties>
>      </profile>
>    </profiles>
> </settings>
>
> (2) Createed ${PROJECT_HOME}/profiles.xml (with the assumption that this
> is used for all modules as well):
>
> <profilesXml>
>    <profiles>
>      <profile>
>        <id>project_name</id>
>        <activation>
>          <activeByDefault/>
>        </activation>
>        <properties>
>          <system.property.name>
>            system_property_value
>          </system.property.name>
>        </properties>
>      </profile>
>    </profiles>
> </profilesXml>
>
> (3) Added filters to top-level pom.xml, and referenced my old
> build.properties file. In this instance, *some* of my resources had the
> properties properly inserted, but not the ones that count. For example,
> web.xml was filtered within the target/classes directory, but *not*
> within the target/${PROJECT_NAME}/WEB-INF directory, nor the actual
> repository version.
>
> (4) Tried CLI maven -Dsystem.property.name=system_property_value clean
> install - nothing...
>
> (5) Of course, all of my property keys are written as
> ${system.property.name} within my module resoures.
>
> This *has* to be an easy task, but I just am not getting it! Can anyone
> provide some assistance, maybe in the form of a good example file(s)?
>
> By the way, I don't want the key/value pairs defined in my pom.xml
> (unless they are referencing the value as a variable).
>
> Thanks.
> Mike
>
>
> --
>
> Mike Darretta
> Computer Sciences Corporation (CSC)
> Sr. Software Engineer
> (o) 831.656.4324
> (c) 209.814.2774
> michael.darretta.ctr@metnet.navy.mil
>
> ------------------------------------------------------------
> This is a PRIVATE message. If you are not the intended recipient, please
> delete without copying and kindly advise us by e-mail of the mistake in
> delivery. NOTE: Regardless of content, this e-mail shall not operate to
> bind CSC to any order or other contract unless pursuant to explicit
> written agreement or government initiative expressly permitting the use
> of e-mail for such purpose.
> ------------------------------------------------------------
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>


--
Stephen Duncan Jr
www.stephenduncanjr.com

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