You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by dvicente <dv...@gmail.com> on 2007/01/18 12:00:06 UTC

[m2] help with maven API

Hello with all, I am improving my plugin Dashboard (
http://mojo.codehaus.org/dashboard-maven-plugin/
http://mojo.codehaus.org/dashboard-maven-plugin/ ).

I have a small concern.
I wish to be able to recover the configuration of the plugin Surefire via
API Maven, in particular the property “reportsDirectory”. 

What enabled me to avoid adding a parameter config on my plugin but
especially in the case of a multi-module project, it may be that this value
is not the same one for each module and thus my paramétre would not be good
any more from one module to another. 

I want to be able to be sure to be able to recover the absolute path
parameter “reportsDirectory” of Surefire for each module while passing by
the API one. 

If somebody has an idea of API which could do that? (Plexus, Maven Model….) 

thank you in advance for your assistance
-- 
View this message in context: http://www.nabble.com/-m2--help-with-maven-API-tf3033510s177.html#a8428681
Sent from the Maven Developers mailing list archive at Nabble.com.

Re: [m2] help with maven API

Posted by dvicente <dv...@gmail.com>.
Thanks Vincent

it's awesome


-- 
View this message in context: http://www.nabble.com/-m2--help-with-maven-API-tf3033510s177.html#a8433298
Sent from the Maven Developers mailing list archive at Nabble.com.


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


Re: [m2] help with maven API

Posted by Vincent Siveton <vi...@gmail.com>.
Hi again,

You could use the RegexBasedInterpolator class from plexus-utils.
Something like the following:

RegexBasedInterpolator interpolator = new RegexBasedInterpolator();
interpolator.addValueSource( new ObjectBasedValueSource( aProject ) );
interpolator.addValueSource( new MapBasedValueSource(
aProject.getProperties() ) );

String result = interpolator.interpolate( aStringWithInterpolatedProp,
"project" );

Cheers,

Vincent

2007/1/18, dvicente <dv...@gmail.com>:
>
> Thanks Vincent, it works great but my second question is :
>
> How to resolve maven properties resolution ?
>
> if i configure my pom as :
>
> <build>
>                <plugins>
>                        <plugin>
>                                <groupId>org.apache.maven.plugins</groupId>
>                                <artifactId>maven-surefire-plugin</artifactId>
>                                <version>2.2</version>
>                                <configuration>
>                                        <testFailureIgnore>true</testFailureIgnore>
>                                        <reportsDirectory>
>                 ${project.build.directory}/site/sunfire-reports
>         </reportsDirectory>
>                                </configuration>
>                        </plugin>
>                </plugins>
>        </build>
>
> when i use the getMavenPluginConfiguration method,
>
> i get "${project.build.directory}/site/sunfire-reports" string.
>
> it exists a method which can resolve "${project.build.directory}" string to
> a real file path ?
>
>
>
> Vincent Siveton wrote:
> >
> > Hi David,
> >
> > Have a glance to
> > https://svn.apache.org/repos/asf/maven/plugins/trunk/maven-ant-plugin/src/main/java/org/apache/maven/plugin/ant/AntBuildWriterUtil.java
> >
> > Specially #getMavenPluginConfiguration() HTH
> >
> > Cheers,
> >
> > Vincent
> >
> > 2007/1/18, dvicente <dv...@gmail.com>:
> >>
> >> Hello with all, I am improving my plugin Dashboard (
> >> http://mojo.codehaus.org/dashboard-maven-plugin/
> >> http://mojo.codehaus.org/dashboard-maven-plugin/ ).
> >>
> >> I have a small concern.
> >> I wish to be able to recover the configuration of the plugin Surefire via
> >> API Maven, in particular the property "reportsDirectory".
> >>
> >> What enabled me to avoid adding a parameter config on my plugin but
> >> especially in the case of a multi-module project, it may be that this
> >> value
> >> is not the same one for each module and thus my paramétre would not be
> >> good
> >> any more from one module to another.
> >>
> >> I want to be able to be sure to be able to recover the absolute path
> >> parameter "reportsDirectory" of Surefire for each module while passing by
> >> the API one.
> >>
> >> If somebody has an idea of API which could do that? (Plexus, Maven
> >> Model….)
> >>
> >> thank you in advance for your assistance
> >> --
> >> View this message in context:
> >> http://www.nabble.com/-m2--help-with-maven-API-tf3033510s177.html#a8428681
> >> Sent from the Maven Developers mailing list archive at Nabble.com.
> >>
> >>
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> > For additional commands, e-mail: dev-help@maven.apache.org
> >
> >
> >
>
> --
> View this message in context: http://www.nabble.com/-m2--help-with-maven-API-tf3033510s177.html#a8430267
> Sent from the Maven Developers mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
>
>

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


Re: [m2] help with maven API

Posted by dvicente <dv...@gmail.com>.
Thanks Vincent, it works great but my second question is :

How to resolve maven properties resolution ?

if i configure my pom as :

<build>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-surefire-plugin</artifactId>
				<version>2.2</version>
				<configuration>
					<testFailureIgnore>true</testFailureIgnore>
					<reportsDirectory>
                 ${project.build.directory}/site/sunfire-reports
         </reportsDirectory>
				</configuration>
			</plugin>
		</plugins>
	</build>

when i use the getMavenPluginConfiguration method,

i get "${project.build.directory}/site/sunfire-reports" string.

it exists a method which can resolve "${project.build.directory}" string to
a real file path ?



Vincent Siveton wrote:
> 
> Hi David,
> 
> Have a glance to
> https://svn.apache.org/repos/asf/maven/plugins/trunk/maven-ant-plugin/src/main/java/org/apache/maven/plugin/ant/AntBuildWriterUtil.java
> 
> Specially #getMavenPluginConfiguration() HTH
> 
> Cheers,
> 
> Vincent
> 
> 2007/1/18, dvicente <dv...@gmail.com>:
>>
>> Hello with all, I am improving my plugin Dashboard (
>> http://mojo.codehaus.org/dashboard-maven-plugin/
>> http://mojo.codehaus.org/dashboard-maven-plugin/ ).
>>
>> I have a small concern.
>> I wish to be able to recover the configuration of the plugin Surefire via
>> API Maven, in particular the property "reportsDirectory".
>>
>> What enabled me to avoid adding a parameter config on my plugin but
>> especially in the case of a multi-module project, it may be that this
>> value
>> is not the same one for each module and thus my paramétre would not be
>> good
>> any more from one module to another.
>>
>> I want to be able to be sure to be able to recover the absolute path
>> parameter "reportsDirectory" of Surefire for each module while passing by
>> the API one.
>>
>> If somebody has an idea of API which could do that? (Plexus, Maven
>> Model….)
>>
>> thank you in advance for your assistance
>> --
>> View this message in context:
>> http://www.nabble.com/-m2--help-with-maven-API-tf3033510s177.html#a8428681
>> Sent from the Maven Developers mailing list archive at Nabble.com.
>>
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/-m2--help-with-maven-API-tf3033510s177.html#a8430267
Sent from the Maven Developers mailing list archive at Nabble.com.


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


Re: [m2] help with maven API

Posted by Vincent Siveton <vi...@gmail.com>.
Hi David,

Have a glance to
https://svn.apache.org/repos/asf/maven/plugins/trunk/maven-ant-plugin/src/main/java/org/apache/maven/plugin/ant/AntBuildWriterUtil.java

Specially #getMavenPluginConfiguration() HTH

Cheers,

Vincent

2007/1/18, dvicente <dv...@gmail.com>:
>
> Hello with all, I am improving my plugin Dashboard (
> http://mojo.codehaus.org/dashboard-maven-plugin/
> http://mojo.codehaus.org/dashboard-maven-plugin/ ).
>
> I have a small concern.
> I wish to be able to recover the configuration of the plugin Surefire via
> API Maven, in particular the property "reportsDirectory".
>
> What enabled me to avoid adding a parameter config on my plugin but
> especially in the case of a multi-module project, it may be that this value
> is not the same one for each module and thus my paramétre would not be good
> any more from one module to another.
>
> I want to be able to be sure to be able to recover the absolute path
> parameter "reportsDirectory" of Surefire for each module while passing by
> the API one.
>
> If somebody has an idea of API which could do that? (Plexus, Maven Model….)
>
> thank you in advance for your assistance
> --
> View this message in context: http://www.nabble.com/-m2--help-with-maven-API-tf3033510s177.html#a8428681
> Sent from the Maven Developers mailing list archive at Nabble.com.
>
>

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