You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Anuerin Diaz <ra...@gmail.com> on 2005/11/14 10:31:44 UTC

[m2] how to define inherited properties for plugins?

hi,

  is there a way to define properties for specific plugins? i have two
problems related to properties that maven profiles doesn't seem to
solve.

  - properties defined in the pom.xml are not assured to be carried
over to the plugin. i have already defined properties in the pom.xml
(e.g. current.server) but the assembly does not get this when it tries
to parse its assembly descriptor. the aim to have certain artifacts
assembled in their own directory like this:

      <fileSet>
         <directory>EJB/EJB1/target</directory>
         <outputDirectory>${current.server}</outputDirectory>
         <includes>
             <include>*.jar</include>
         </includes>
      <fileSet>

    but the "${current.server}" property is taken as is and not
interpolated. i was hoping it was going to be resovled to
"websphere5.1" during the execution of the assembly plugin.


   - i need to specify properties for certain build phases only. our
application is web-based in nature but the unit tests will have to be
done offline and on a stand-alone basis. properties specified in the
project descriptor such as this

      <properties>
         <config.dir>${basedir}/target/test-config</config.dir>
      </properties>

   does not work. even if it works, the property should not be
specified at a project level because the value for the test phase is
different to the value to be used during the packaging phase. i tried
using the configuration element of the plugin such as this

     <build>
        <plugins>
	   <plugin>
	      <artifactId>maven-surefire-plugin</artifactId>
	      <configuration>
	         <config.dir>${basedir}/target/test-config</config.dir>
	      </configuration>
	   </plugin>
	</plugins>
     </build>

   which causes a null pointer exception. i also tried to replace
"<config.dir>${basedir}/target/test-config</config.dir>" with
"<name>config.dir</name><value>${basedir}/target</value>" but although
the parser seems to accept it, the value is still not inherited by the
plugin. passing the property on the commandline
"-Dconfig.dir=target/test-config" ensures the assembly will get the
value but since not all modules will have the same value set for its
properties then this is not going to work and specifying 10 or more 
properties on the commandline is going to be tedious.

   any suggestions on how to proceed is very much appreciated.

 ciao!


--

"Programming, an artform that fights back"

Anuerin G. Diaz
Registered Linux User #246176
Friendly Linux Board @ http://mandrivausers.org/index.php
http://capsule.ramfree17.org , when you absolutely have nothing else
better to do

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


Re: [m2] how to define inherited properties for plugins?

Posted by Anuerin Diaz <ra...@gmail.com>.
hi,

   the build-phase specific properties is solved (at least) for the
test phase since surefire allows the user to set properties to be
passed to junit tests
(http://maven.apache.org/plugins/maven-surefire-plugin/howto.html).

   maybe the same could be implemented for the assembly plugin. :)

ciao!

On 11/14/05, Anuerin Diaz <ra...@gmail.com> wrote:
> hi,
>
>  is there a way to define properties for specific plugins? i have two
> problems related to properties that maven profiles doesn't seem to
> solve.
>
>  - properties defined in the pom.xml are not assured to be carried
> over to the plugin. i have already defined properties in the pom.xml
> (e.g. current.server) but the assembly does not get this when it tries
> to parse its assembly descriptor. the aim to have certain artifacts
> assembled in their own directory like this:
>
>      <fileSet>
>         <directory>EJB/EJB1/target</directory>
>         <outputDirectory>${current.server}</outputDirectory>
>         <includes>
>             <include>*.jar</include>
>         </includes>
>      <fileSet>
>
>    but the "${current.server}" property is taken as is and not
> interpolated. i was hoping it was going to be resovled to
> "websphere5.1" during the execution of the assembly plugin.
>
>
>   - i need to specify properties for certain build phases only. our
> application is web-based in nature but the unit tests will have to be
> done offline and on a stand-alone basis. properties specified in the
> project descriptor such as this
>
>      <properties>
>         <config.dir>${basedir}/target/test-config</config.dir>
>      </properties>
>
>   does not work. even if it works, the property should not be
> specified at a project level because the value for the test phase is
> different to the value to be used during the packaging phase. i tried
> using the configuration element of the plugin such as this
>
>     <build>
>        <plugins>
>           <plugin>
>              <artifactId>maven-surefire-plugin</artifactId>
>              <configuration>
>                 <config.dir>${basedir}/target/test-config</config.dir>
>              </configuration>
>           </plugin>
>        </plugins>
>     </build>
>
>   which causes a null pointer exception. i also tried to replace
> "<config.dir>${basedir}/target/test-config</config.dir>" with
> "<name>config.dir</name><value>${basedir}/target</value>" but although
> the parser seems to accept it, the value is still not inherited by the
> plugin. passing the property on the commandline
> "-Dconfig.dir=target/test-config" ensures the assembly will get the
> value but since not all modules will have the same value set for its
> properties then this is not going to work and specifying 10 or more
> properties on the commandline is going to be tedious.
>
>   any suggestions on how to proceed is very much appreciated.
>
>  ciao!
>
>
> --
>
> "Programming, an artform that fights back"
>
> Anuerin G. Diaz
> Registered Linux User #246176
> Friendly Linux Board @ http://mandrivausers.org/index.php
> http://capsule.ramfree17.org , when you absolutely have nothing else
> better to do
>


--

"Programming, an artform that fights back"

Anuerin G. Diaz
Registered Linux User #246176
Friendly Linux Board @ http://mandrivausers.org/index.php
http://capsule.ramfree17.org , when you absolutely have nothing else
better to do

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