Get the scm settings from plugin

2007-02-22 Thread Paul Gier
I would like to be able to access the scm settings (connection, tag, 
etc) in the pom.xml from within a plugin.  Is this possible?  It seems 
like there should be an easy way to get access to all of the pom 
configuration from within a plugin, but I haven't found it yet.  I tried 
looking in project.properties, but it was empty.  Is project.properties 
used for anything?


Thanks!

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Get the scm settings from plugin

2007-02-22 Thread Dan Tran

all you need is to have access to 'project' instance and use it to get pom's
info.

put the below fragment in your mojo


/**

* [EMAIL PROTECTED] expression=${project}

* [EMAIL PROTECTED]
*

*/

*protected* MavenProject project;



On 2/22/07, Paul Gier [EMAIL PROTECTED] wrote:


I would like to be able to access the scm settings (connection, tag,
etc) in the pom.xml from within a plugin.  Is this possible?  It seems
like there should be an easy way to get access to all of the pom
configuration from within a plugin, but I haven't found it yet.  I tried
looking in project.properties, but it was empty.  Is project.properties
used for anything?

Thanks!

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Get the scm settings from plugin

2007-02-22 Thread David Jackman
It seems project.properties will always be empty (I've been working on
that issue in the Mojo accessing project properties thread in this
forum).

However, what you want isn't in the properties anyway.  What you want is
the project.scm value.  Declare your plugin field like this:

/**
 * Source control information.
 * @parameter expression=${project.scm}
 * @required
 * @readonly
 */
private org.apache.maven.model.Scm scm;
 
You'll need to add maven-model as a dependency to your plugin as well:
dependency
groupIdorg.apache.maven/groupId
artifactIdmaven-model/artifactId
version2.0.4/version
/dependency

That should be enough to get the scm information in your plugin.

..David..

-Original Message-
From: Paul Gier [mailto:[EMAIL PROTECTED] 
Sent: Thursday, February 22, 2007 9:01 AM
To: users@maven.apache.org
Subject: Get the scm settings from plugin

I would like to be able to access the scm settings (connection, tag,
etc) in the pom.xml from within a plugin.  Is this possible?  It seems
like there should be an easy way to get access to all of the pom
configuration from within a plugin, but I haven't found it yet.  I tried
looking in project.properties, but it was empty.  Is project.properties
used for anything?

Thanks!

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Get the scm settings from plugin

2007-02-22 Thread Paul Gier

Thanks, it works!
Does that work for the other objects in the model?
For example if I also want to get the license information can I use 
${project.license} to get a License object from model?

Is that functionality documented anywhere?

David Jackman wrote:

It seems project.properties will always be empty (I've been working on
that issue in the Mojo accessing project properties thread in this
forum).

However, what you want isn't in the properties anyway.  What you want is
the project.scm value.  Declare your plugin field like this:

/**
 * Source control information.
 * @parameter expression=${project.scm}
 * @required
 * @readonly
 */
private org.apache.maven.model.Scm scm;
 
You'll need to add maven-model as a dependency to your plugin as well:

dependency
groupIdorg.apache.maven/groupId
artifactIdmaven-model/artifactId
version2.0.4/version
/dependency

That should be enough to get the scm information in your plugin.

..David..

-Original Message-
From: Paul Gier [mailto:[EMAIL PROTECTED] 
Sent: Thursday, February 22, 2007 9:01 AM

To: users@maven.apache.org
Subject: Get the scm settings from plugin

I would like to be able to access the scm settings (connection, tag,
etc) in the pom.xml from within a plugin.  Is this possible?  It seems
like there should be an easy way to get access to all of the pom
configuration from within a plugin, but I haven't found it yet.  I tried
looking in project.properties, but it was empty.  Is project.properties
used for anything?

Thanks!

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

  



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Get the scm settings from plugin

2007-02-22 Thread David Jackman
It's not documented anywhere that I know of.  I've been sitting on the
source code with this project.properties problem and figured out how
most things come out.  I should create a wiki page for it--a mapping of
pom elements to their respective Maven-model types.

..David..
 

-Original Message-
From: Paul Gier [mailto:[EMAIL PROTECTED] 
Sent: Thursday, February 22, 2007 11:04 AM
To: Maven Users List
Subject: Re: Get the scm settings from plugin

Thanks, it works!
Does that work for the other objects in the model?
For example if I also want to get the license information can I use
${project.license} to get a License object from model?
Is that functionality documented anywhere?

David Jackman wrote:
 It seems project.properties will always be empty (I've been working on

 that issue in the Mojo accessing project properties thread in this 
 forum).

 However, what you want isn't in the properties anyway.  What you want 
 is the project.scm value.  Declare your plugin field like this:

 /**
  * Source control information.
  * @parameter expression=${project.scm}
  * @required
  * @readonly
  */
 private org.apache.maven.model.Scm scm;
  
 You'll need to add maven-model as a dependency to your plugin as well:
 dependency
 groupIdorg.apache.maven/groupId
 artifactIdmaven-model/artifactId
 version2.0.4/version
 /dependency

 That should be enough to get the scm information in your plugin.

 ..David..

 -Original Message-
 From: Paul Gier [mailto:[EMAIL PROTECTED]
 Sent: Thursday, February 22, 2007 9:01 AM
 To: users@maven.apache.org
 Subject: Get the scm settings from plugin

 I would like to be able to access the scm settings (connection, tag,
 etc) in the pom.xml from within a plugin.  Is this possible?  It seems

 like there should be an easy way to get access to all of the pom 
 configuration from within a plugin, but I haven't found it yet.  I 
 tried looking in project.properties, but it was empty.  Is 
 project.properties used for anything?

 Thanks!

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]

   


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]