You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Mark Russell <ma...@instantiations.com> on 2007/10/02 07:46:26 UTC
access to MavenProject help
I am trying to develop a plugin and get access to the MavenProject. Here is my code:
/**
* parameter expression="${project}"
*/
private MavenProject mavenProject;
. . .
if (mavenProject != null) {
List repositories = mavenProject.getRepositories();
for (Object object : repositories) {
getLog().info(object.getClass().getName());
}
}
else {
getLog().info("no project");
}
All I ever get printed out is the no project message. I also tried with artifact repository and get the same results. Here is
my dependencies in my pom:
<dependencies>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-api</artifactId>
<version>2.0</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-project</artifactId>
<version>2.0</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-artifact</artifactId>
<version>2.0</version>
</dependency>
</dependencies>
I would like any help on this that I could get. I need to get this code up and running I have several people waiting for this.
I have read the book "Better Builds with Maven" and the MOJO Developer's handbook and can not seem to get this working.
thanks for your help in advance!
--
Mark Russell
Instantiations, Inc.
724-368-3331 (land line)
http://www.instantiations.com
Re: access to MavenProject help
Posted by Mark Russell <ma...@instantiations.com>.
Thanks for the help. I must have been working on that too long to see the error.
Many thanks for pointing that out to me that worked
Hervé BOUTEMY wrote:
> I see 1 typo that would explain the problem: parameter instead of @parameter
>
> regards,
>
> Hervé
>
> Le mardi 2 octobre 2007, Mark Russell a écrit :
>> I am trying to develop a plugin and get access to the MavenProject. Here
>> is my code: /**
>> * parameter expression="${project}"
>> */
>> private MavenProject mavenProject;
>>
>> . . .
>> if (mavenProject != null) {
>> List repositories = mavenProject.getRepositories();
>> for (Object object : repositories) {
>> getLog().info(object.getClass().getName());
>> }
>> }
>> else {
>> getLog().info("no project");
>> }
>>
>> All I ever get printed out is the no project message. I also tried with
>> artifact repository and get the same results. Here is my dependencies in
>> my pom:
>> <dependencies>
>> <dependency>
>> <groupId>org.apache.maven</groupId>
>> <artifactId>maven-plugin-api</artifactId>
>> <version>2.0</version>
>> </dependency>
>> <dependency>
>> <groupId>org.apache.maven</groupId>
>> <artifactId>maven-project</artifactId>
>> <version>2.0</version>
>> </dependency>
>> <dependency>
>> <groupId>org.apache.maven</groupId>
>> <artifactId>maven-artifact</artifactId>
>> <version>2.0</version>
>> </dependency>
>> </dependencies>
>>
>> I would like any help on this that I could get. I need to get this code up
>> and running I have several people waiting for this. I have read the book
>> "Better Builds with Maven" and the MOJO Developer's handbook and can not
>> seem to get this working.
>>
>> thanks for your help in advance!
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
--
Mark Russell
Instantiations, Inc.
724-368-3331 (land line)
http://www.instantiations.com
Re: access to MavenProject help
Posted by Mark Russell <ma...@instantiations.com>.
I got that code directly from the Mojo Developer Cookbook wiki page
(http://docs/codehaus.org/MAVENUSER/Mojo+Developer+Cookbook). It was wrong on the page so I went in and fixed the page. It now
contains the correct code.
Hervé BOUTEMY wrote:
> I see 1 typo that would explain the problem: parameter instead of @parameter
>
> regards,
>
> Hervé
>
--
Mark Russell
Instantiations, Inc.
724-368-3331 (land line)
http://www.instantiations.com
Re: access to MavenProject help
Posted by Hervé BOUTEMY <he...@free.fr>.
I see 1 typo that would explain the problem: parameter instead of @parameter
regards,
Hervé
Le mardi 2 octobre 2007, Mark Russell a écrit :
> I am trying to develop a plugin and get access to the MavenProject. Here
> is my code: /**
> * parameter expression="${project}"
> */
> private MavenProject mavenProject;
>
> . . .
> if (mavenProject != null) {
> List repositories = mavenProject.getRepositories();
> for (Object object : repositories) {
> getLog().info(object.getClass().getName());
> }
> }
> else {
> getLog().info("no project");
> }
>
> All I ever get printed out is the no project message. I also tried with
> artifact repository and get the same results. Here is my dependencies in
> my pom:
> <dependencies>
> <dependency>
> <groupId>org.apache.maven</groupId>
> <artifactId>maven-plugin-api</artifactId>
> <version>2.0</version>
> </dependency>
> <dependency>
> <groupId>org.apache.maven</groupId>
> <artifactId>maven-project</artifactId>
> <version>2.0</version>
> </dependency>
> <dependency>
> <groupId>org.apache.maven</groupId>
> <artifactId>maven-artifact</artifactId>
> <version>2.0</version>
> </dependency>
> </dependencies>
>
> I would like any help on this that I could get. I need to get this code up
> and running I have several people waiting for this. I have read the book
> "Better Builds with Maven" and the MOJO Developer's handbook and can not
> seem to get this working.
>
> thanks for your help in advance!
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org