You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by rickbryant <ri...@gxs.com> on 2009/07/20 18:51:13 UTC
maven2 plug-in reading user-defined parameters
we're currently migrating from maven1 to maven2 and are building a maven2
plug-in to read runtime parameters and do some work. have set up the
following profiles.xml with several properties to mimic what we did
previously with build.properties:
<?xml version="1.0" encoding="UTF-8"?>
<profilesXml>
<activeProfiles>
<activeProfile>my-dev-profile</activeProfile>
</activeProfiles>
<profiles>
<profile>
<id>my-dev-profile</id>
<properties>
<webserverName>jakartaTomcat</webserverName>
<webserverDirectory>c:/Program
Files/jakarta-tomcat-5.5.9</webserverDirectory>
<webserverContextRoot>dpm</webserverContextRoot>
<buildEnvironment>dev</buildEnvironment>
<communityId>109</communityId>
<jdbcDriver>db2luw</jdbcDriver>
<debugFile>c:/projects/dpm7.5/web.log</debugFile>
<batchLogFile>c:/projects/dpm7.5/batch.log</batchLogFile>
<logLevel>4</logLevel>
<dbMinConnections>1</dbMinConnections>
<PricingAllowedInd>false</PricingAllowedInd>
<dpmCacheServerEnable>true</dpmCacheServerEnable>
<maven.test.skip>true</maven.test.skip>
<exec.classpathScope>${classPathScope}</exec.classpathScope>
<exec.args>-classpath %classpath ${packageClassName} 113
InboundXmlProcess upcexp 9999</exec.args>
<exec.executable>java</exec.executable>
</properties>
</profile>
</profiles>
</profilesXml>
in our plug-in we can easily read in known parameters (e.g. <webserverName>)
that are required for execution:
public abstract class DPMBaseAbstractMojo extends AbstractMojo
{
/**
* @parameter default-value="${webserverName}"
*/
private String webserverName;
but we also need to need to read in other user-defined parameters from
profiles.xml that are not known at runtime and not required for execution
such as:
<debugFile>c:/projects/dpm7.5/web.log</debugFile>
<batchLogFile>c:/projects/dpm7.5/batch.log</batchLogFile>
these parameters are then reformatted and used to build a master properties
file that is packaged with our application. is there a way for the plug-in
to read in these parameters into a collection? for that matter, is there a
way to read in all parameters specified in the profiles.xml into a
collection?
thanks so much,
rick
--
View this message in context: http://www.nabble.com/maven2-plug-in-reading-user-defined-parameters-tp24573473p24573473.html
Sent from the Maven - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: maven2 plug-in reading user-defined parameters
Posted by Dan Tran <da...@gmail.com>.
sounds like the work of properties-maven-plugin
-D
On Mon, Jul 20, 2009 at 9:51 AM, rickbryant<ri...@gxs.com> wrote:
>
> we're currently migrating from maven1 to maven2 and are building a maven2
> plug-in to read runtime parameters and do some work. have set up the
> following profiles.xml with several properties to mimic what we did
> previously with build.properties:
> <?xml version="1.0" encoding="UTF-8"?>
> <profilesXml>
> <activeProfiles>
> <activeProfile>my-dev-profile</activeProfile>
> </activeProfiles>
> <profiles>
> <profile>
> <id>my-dev-profile</id>
> <properties>
> <webserverName>jakartaTomcat</webserverName>
> <webserverDirectory>c:/Program
> Files/jakarta-tomcat-5.5.9</webserverDirectory>
> <webserverContextRoot>dpm</webserverContextRoot>
> <buildEnvironment>dev</buildEnvironment>
> <communityId>109</communityId>
> <jdbcDriver>db2luw</jdbcDriver>
> <debugFile>c:/projects/dpm7.5/web.log</debugFile>
> <batchLogFile>c:/projects/dpm7.5/batch.log</batchLogFile>
> <logLevel>4</logLevel>
> <dbMinConnections>1</dbMinConnections>
> <PricingAllowedInd>false</PricingAllowedInd>
> <dpmCacheServerEnable>true</dpmCacheServerEnable>
> <maven.test.skip>true</maven.test.skip>
> <exec.classpathScope>${classPathScope}</exec.classpathScope>
> <exec.args>-classpath %classpath ${packageClassName} 113
> InboundXmlProcess upcexp 9999</exec.args>
> <exec.executable>java</exec.executable>
> </properties>
> </profile>
> </profiles>
> </profilesXml>
>
> in our plug-in we can easily read in known parameters (e.g. <webserverName>)
> that are required for execution:
> public abstract class DPMBaseAbstractMojo extends AbstractMojo
> {
> /**
> * @parameter default-value="${webserverName}"
> */
> private String webserverName;
>
> but we also need to need to read in other user-defined parameters from
> profiles.xml that are not known at runtime and not required for execution
> such as:
> <debugFile>c:/projects/dpm7.5/web.log</debugFile>
> <batchLogFile>c:/projects/dpm7.5/batch.log</batchLogFile>
>
> these parameters are then reformatted and used to build a master properties
> file that is packaged with our application. is there a way for the plug-in
> to read in these parameters into a collection? for that matter, is there a
> way to read in all parameters specified in the profiles.xml into a
> collection?
>
> thanks so much,
> rick
> --
> View this message in context: http://www.nabble.com/maven2-plug-in-reading-user-defined-parameters-tp24573473p24573473.html
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> 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