You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Roland Bali <ro...@gmail.com> on 2005/10/03 22:06:28 UTC

[m2] How to get info about valid expressions?

Hi,

I'm trying to create a pom.xml that copies the project dependencies to
a folder inside the target folder.

I've tried using maven-antrun-plugin but I can't figure out how to
write the copy task since I can't access the dependencies. Is there a
way to know what expressions I can use inside the pom?

Part of my pom:

<tasks>
  <copy todir="${project.build.directory}/install">
    <fileset refid="${maven.dependencies.fileset}"/>
  </copy>
</tasks>

Kind regards,
Roland

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


Re: [m2] How to get info about valid expressions?

Posted by Brett Porter <br...@gmail.com>.
In java (or beanshell) plugin:

step 1): create the plugin
m2 archetype:create -DgroupId=... -DartifactId=... \
-DarchetypeArtifactId=maven-archetype-mojo

step 2): create the mojo:

/** @parameter default-value="lib" */
private File outputDirectory;

/** @parameter expression="${project.artifacts}" */
private List artifacts;

public void execute()
{
  for ( Iterator i = artifacts.iterator(); i.hasNext(); )
  {
    FileUtils.copy( (File) i.next, outputDirectory );
  }
}

Once this is done, this plugin can be used on any project.

- Brett

On 10/5/05, Roland Bali <ro...@gmail.com> wrote:
> Thanks, that gave me some clues and information about where to find
> information..
>
> But I still haven't figured out how to reference a fileset to be able
> to copy my dependencies. Is there a way to specify this in the pom or
> do I have to write a Ant task. If I have to write a task how do I
> write the fileset to fetch my dependencies, I'd like to write
> something like this:
>
>    <copy todir="${project.build.directory}/lib">
>       <fileset dir="${project.dependencies}"/>
>    </copy>
>
> I know I could hardcode all my dependencies in <copy> tasks but I
> REALLY don't want to do that unless I have to.
>
> Kind regards,
> Roland
>
> On 10/4/05, John Casey <jd...@commonjava.org> wrote:
> > -----BEGIN PGP SIGNED MESSAGE-----
> > Hash: SHA1
> >
> > that's the third part of the puzzle. I've already turned this stuff into
> > a modello model, and there is a class called ExpressionDocumenter in
> > maven-core/o.a.m.usability.plugin which will load the documentation
> > docs. We could simply generate doco from these files, though. I needed
> > this information for diagnosing errors in plugin configuration, so I
> > think this is a pretty good way of centralizing the doco...short of
> > somehow generating the plugin parameter expression evaluator, that is.
> >
> > - -j
> >
> > Brett Porter wrote:
> > | John,
> > |
> > | I'd much rather we just had a document that list these (can be
> > | generated from modello, if needed).
> > |
> > | - Brett
> > |
> > | On 10/4/05, John Casey <jd...@commonjava.org> wrote:
> > |
> > | We've sort of informally identified this as a need already, and I've
> > | started writing an API that will help with this. Ideally, the user would
> > | be able to issue something like:
> > |
> > | m2 projecthelp:supported-parameters -DparameterPattern="project.*"
> > |
> > | and have it spit out information about all of the parameters that are
> > | derived from the MavenProject instance. We're getting there WRT having
> > | that information in the system, but this mojo has not yet been written.
> > | Right now, that information is mostly being used to help diagnose plugin
> > | configuration errors.
> > |
> > | For now, I can tell you that plugin parameters - for the most part - are
> > | reflective lookups against the object graphs derived from a few key
> > | runtime instances:
> > |
> > | - project = The current MavenProject being built
> > | ~                (org.apache.maven.project.MavenProject)
> > |
> > | - settings = The Settings from ~/.m2/settings.xml
> > | ~                (org.apache.maven.settings.Settings)
> > |
> > | - plugin = The PluginDescriptor instance for the currently executing
> > | plugin.
> > | ~                (org.apache.maven.plugin.descriptor.PluginDescriptor)
> > |
> > | - session = The current build session instance
> > | ~                (org.apache.maven.execution.MavenSession)
> > |
> > | in addition to some miscellaneous "rootless" expressions, like:
> > |
> > | - basedir = The current project's root directory
> > |
> > | - localRepository = The ArtifactRepository instance for locally cached
> > | artifacts
> > |
> > | FYI, I've also filed MNG-1077[1] to formalize this need, and provide a
> > | place to track progress.
> > |
> > | Cheers,
> > |
> > | john
> > |
> > | [1] http://jira.codehaus.org/browse/MNG-1077
> > |
> > | Roland Bali wrote:
> > | | Hi,
> > | |
> > | | I'm trying to create a pom.xml that copies the project dependencies to
> > | | a folder inside the target folder.
> > | |
> > | | I've tried using maven-antrun-plugin but I can't figure out how to
> > | | write the copy task since I can't access the dependencies. Is there a
> > | | way to know what expressions I can use inside the pom?
> > | |
> > | | Part of my pom:
> > | |
> > | | <tasks>
> > | |   <copy todir="${project.build.directory}/install">
> > | |     <fileset refid="${maven.dependencies.fileset}"/>
> > | |   </copy>
> > | | </tasks>
> > | |
> > | | Kind regards,
> > | | Roland
> > | |
> > | | ---------------------------------------------------------------------
> > | | 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
> >
> >
> >
> >
> > | ---------------------------------------------------------------------
> > | To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > | For additional commands, e-mail: users-help@maven.apache.org
> >
> >
> >
> > -----BEGIN PGP SIGNATURE-----
> > Version: GnuPG v1.2.6 (GNU/Linux)
> >
> > iD8DBQFDQgFRK3h2CZwO/4URAiCmAJ9liJquhM4/VxmYUntf1TeVhS0i1gCfYT4e
> > TqCho7ad7A7ErpyN1Hz00Q0=
> > =Pk13
> > -----END PGP SIGNATURE-----
> >
> > ---------------------------------------------------------------------
> > 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
>
>

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


Re: [m2] How to get info about valid expressions?

Posted by Roland Bali <ro...@gmail.com>.
Thanks, that gave me some clues and information about where to find
information..

But I still haven't figured out how to reference a fileset to be able
to copy my dependencies. Is there a way to specify this in the pom or
do I have to write a Ant task. If I have to write a task how do I
write the fileset to fetch my dependencies, I'd like to write
something like this:

   <copy todir="${project.build.directory}/lib">
      <fileset dir="${project.dependencies}"/>
   </copy>

I know I could hardcode all my dependencies in <copy> tasks but I
REALLY don't want to do that unless I have to.

Kind regards,
Roland

On 10/4/05, John Casey <jd...@commonjava.org> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> that's the third part of the puzzle. I've already turned this stuff into
> a modello model, and there is a class called ExpressionDocumenter in
> maven-core/o.a.m.usability.plugin which will load the documentation
> docs. We could simply generate doco from these files, though. I needed
> this information for diagnosing errors in plugin configuration, so I
> think this is a pretty good way of centralizing the doco...short of
> somehow generating the plugin parameter expression evaluator, that is.
>
> - -j
>
> Brett Porter wrote:
> | John,
> |
> | I'd much rather we just had a document that list these (can be
> | generated from modello, if needed).
> |
> | - Brett
> |
> | On 10/4/05, John Casey <jd...@commonjava.org> wrote:
> |
> | We've sort of informally identified this as a need already, and I've
> | started writing an API that will help with this. Ideally, the user would
> | be able to issue something like:
> |
> | m2 projecthelp:supported-parameters -DparameterPattern="project.*"
> |
> | and have it spit out information about all of the parameters that are
> | derived from the MavenProject instance. We're getting there WRT having
> | that information in the system, but this mojo has not yet been written.
> | Right now, that information is mostly being used to help diagnose plugin
> | configuration errors.
> |
> | For now, I can tell you that plugin parameters - for the most part - are
> | reflective lookups against the object graphs derived from a few key
> | runtime instances:
> |
> | - project = The current MavenProject being built
> | ~                (org.apache.maven.project.MavenProject)
> |
> | - settings = The Settings from ~/.m2/settings.xml
> | ~                (org.apache.maven.settings.Settings)
> |
> | - plugin = The PluginDescriptor instance for the currently executing
> | plugin.
> | ~                (org.apache.maven.plugin.descriptor.PluginDescriptor)
> |
> | - session = The current build session instance
> | ~                (org.apache.maven.execution.MavenSession)
> |
> | in addition to some miscellaneous "rootless" expressions, like:
> |
> | - basedir = The current project's root directory
> |
> | - localRepository = The ArtifactRepository instance for locally cached
> | artifacts
> |
> | FYI, I've also filed MNG-1077[1] to formalize this need, and provide a
> | place to track progress.
> |
> | Cheers,
> |
> | john
> |
> | [1] http://jira.codehaus.org/browse/MNG-1077
> |
> | Roland Bali wrote:
> | | Hi,
> | |
> | | I'm trying to create a pom.xml that copies the project dependencies to
> | | a folder inside the target folder.
> | |
> | | I've tried using maven-antrun-plugin but I can't figure out how to
> | | write the copy task since I can't access the dependencies. Is there a
> | | way to know what expressions I can use inside the pom?
> | |
> | | Part of my pom:
> | |
> | | <tasks>
> | |   <copy todir="${project.build.directory}/install">
> | |     <fileset refid="${maven.dependencies.fileset}"/>
> | |   </copy>
> | | </tasks>
> | |
> | | Kind regards,
> | | Roland
> | |
> | | ---------------------------------------------------------------------
> | | 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
>
>
>
>
> | ---------------------------------------------------------------------
> | To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> | For additional commands, e-mail: users-help@maven.apache.org
>
>
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.2.6 (GNU/Linux)
>
> iD8DBQFDQgFRK3h2CZwO/4URAiCmAJ9liJquhM4/VxmYUntf1TeVhS0i1gCfYT4e
> TqCho7ad7A7ErpyN1Hz00Q0=
> =Pk13
> -----END PGP SIGNATURE-----
>
> ---------------------------------------------------------------------
> 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


Re: [m2] How to get info about valid expressions?

Posted by John Casey <jd...@commonjava.org>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

that's the third part of the puzzle. I've already turned this stuff into
a modello model, and there is a class called ExpressionDocumenter in
maven-core/o.a.m.usability.plugin which will load the documentation
docs. We could simply generate doco from these files, though. I needed
this information for diagnosing errors in plugin configuration, so I
think this is a pretty good way of centralizing the doco...short of
somehow generating the plugin parameter expression evaluator, that is.

- -j

Brett Porter wrote:
| John,
|
| I'd much rather we just had a document that list these (can be
| generated from modello, if needed).
|
| - Brett
|
| On 10/4/05, John Casey <jd...@commonjava.org> wrote:
|
| We've sort of informally identified this as a need already, and I've
| started writing an API that will help with this. Ideally, the user would
| be able to issue something like:
|
| m2 projecthelp:supported-parameters -DparameterPattern="project.*"
|
| and have it spit out information about all of the parameters that are
| derived from the MavenProject instance. We're getting there WRT having
| that information in the system, but this mojo has not yet been written.
| Right now, that information is mostly being used to help diagnose plugin
| configuration errors.
|
| For now, I can tell you that plugin parameters - for the most part - are
| reflective lookups against the object graphs derived from a few key
| runtime instances:
|
| - project = The current MavenProject being built
| ~                (org.apache.maven.project.MavenProject)
|
| - settings = The Settings from ~/.m2/settings.xml
| ~                (org.apache.maven.settings.Settings)
|
| - plugin = The PluginDescriptor instance for the currently executing
| plugin.
| ~                (org.apache.maven.plugin.descriptor.PluginDescriptor)
|
| - session = The current build session instance
| ~                (org.apache.maven.execution.MavenSession)
|
| in addition to some miscellaneous "rootless" expressions, like:
|
| - basedir = The current project's root directory
|
| - localRepository = The ArtifactRepository instance for locally cached
| artifacts
|
| FYI, I've also filed MNG-1077[1] to formalize this need, and provide a
| place to track progress.
|
| Cheers,
|
| john
|
| [1] http://jira.codehaus.org/browse/MNG-1077
|
| Roland Bali wrote:
| | Hi,
| |
| | I'm trying to create a pom.xml that copies the project dependencies to
| | a folder inside the target folder.
| |
| | I've tried using maven-antrun-plugin but I can't figure out how to
| | write the copy task since I can't access the dependencies. Is there a
| | way to know what expressions I can use inside the pom?
| |
| | Part of my pom:
| |
| | <tasks>
| |   <copy todir="${project.build.directory}/install">
| |     <fileset refid="${maven.dependencies.fileset}"/>
| |   </copy>
| | </tasks>
| |
| | Kind regards,
| | Roland
| |
| | ---------------------------------------------------------------------
| | 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




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



-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)

iD8DBQFDQgFRK3h2CZwO/4URAiCmAJ9liJquhM4/VxmYUntf1TeVhS0i1gCfYT4e
TqCho7ad7A7ErpyN1Hz00Q0=
=Pk13
-----END PGP SIGNATURE-----

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


Re: [m2] How to get info about valid expressions?

Posted by Brett Porter <br...@gmail.com>.
John,

I'd much rather we just had a document that list these (can be
generated from modello, if needed).

- Brett

On 10/4/05, John Casey <jd...@commonjava.org> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> We've sort of informally identified this as a need already, and I've
> started writing an API that will help with this. Ideally, the user would
> be able to issue something like:
>
> m2 projecthelp:supported-parameters -DparameterPattern="project.*"
>
> and have it spit out information about all of the parameters that are
> derived from the MavenProject instance. We're getting there WRT having
> that information in the system, but this mojo has not yet been written.
> Right now, that information is mostly being used to help diagnose plugin
> configuration errors.
>
> For now, I can tell you that plugin parameters - for the most part - are
> reflective lookups against the object graphs derived from a few key
> runtime instances:
>
> - - project = The current MavenProject being built
> ~                (org.apache.maven.project.MavenProject)
>
> - - settings = The Settings from ~/.m2/settings.xml
> ~                (org.apache.maven.settings.Settings)
>
> - - plugin = The PluginDescriptor instance for the currently executing
> plugin.
> ~                (org.apache.maven.plugin.descriptor.PluginDescriptor)
>
> - - session = The current build session instance
> ~                (org.apache.maven.execution.MavenSession)
>
> in addition to some miscellaneous "rootless" expressions, like:
>
> - - basedir = The current project's root directory
>
> - - localRepository = The ArtifactRepository instance for locally cached
> artifacts
>
> FYI, I've also filed MNG-1077[1] to formalize this need, and provide a
> place to track progress.
>
> Cheers,
>
> john
>
> [1] http://jira.codehaus.org/browse/MNG-1077
>
> Roland Bali wrote:
> | Hi,
> |
> | I'm trying to create a pom.xml that copies the project dependencies to
> | a folder inside the target folder.
> |
> | I've tried using maven-antrun-plugin but I can't figure out how to
> | write the copy task since I can't access the dependencies. Is there a
> | way to know what expressions I can use inside the pom?
> |
> | Part of my pom:
> |
> | <tasks>
> |   <copy todir="${project.build.directory}/install">
> |     <fileset refid="${maven.dependencies.fileset}"/>
> |   </copy>
> | </tasks>
> |
> | Kind regards,
> | Roland
> |
> | ---------------------------------------------------------------------
> | To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> | For additional commands, e-mail: users-help@maven.apache.org
> |
> |
> |
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.2.6 (GNU/Linux)
>
> iD8DBQFDQZVbK3h2CZwO/4URAoYnAJ9AZHgzZ1AQFEr3jeSJjnUAtRbKBQCgoPvP
> xDVwWmgLU6u8lfLcUvGVYT0=
> =PcRz
> -----END PGP SIGNATURE-----
>
> ---------------------------------------------------------------------
> 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


Re: [m2] How to get info about valid expressions?

Posted by John Casey <jd...@commonjava.org>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

We've sort of informally identified this as a need already, and I've
started writing an API that will help with this. Ideally, the user would
be able to issue something like:

m2 projecthelp:supported-parameters -DparameterPattern="project.*"

and have it spit out information about all of the parameters that are
derived from the MavenProject instance. We're getting there WRT having
that information in the system, but this mojo has not yet been written.
Right now, that information is mostly being used to help diagnose plugin
configuration errors.

For now, I can tell you that plugin parameters - for the most part - are
reflective lookups against the object graphs derived from a few key
runtime instances:

- - project = The current MavenProject being built
~                (org.apache.maven.project.MavenProject)

- - settings = The Settings from ~/.m2/settings.xml
~                (org.apache.maven.settings.Settings)

- - plugin = The PluginDescriptor instance for the currently executing 
plugin.
~                (org.apache.maven.plugin.descriptor.PluginDescriptor)

- - session = The current build session instance
~                (org.apache.maven.execution.MavenSession)

in addition to some miscellaneous "rootless" expressions, like:

- - basedir = The current project's root directory

- - localRepository = The ArtifactRepository instance for locally cached
artifacts

FYI, I've also filed MNG-1077[1] to formalize this need, and provide a
place to track progress.

Cheers,

john

[1] http://jira.codehaus.org/browse/MNG-1077

Roland Bali wrote:
| Hi,
|
| I'm trying to create a pom.xml that copies the project dependencies to
| a folder inside the target folder.
|
| I've tried using maven-antrun-plugin but I can't figure out how to
| write the copy task since I can't access the dependencies. Is there a
| way to know what expressions I can use inside the pom?
|
| Part of my pom:
|
| <tasks>
|   <copy todir="${project.build.directory}/install">
|     <fileset refid="${maven.dependencies.fileset}"/>
|   </copy>
| </tasks>
|
| Kind regards,
| Roland
|
| ---------------------------------------------------------------------
| To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
| For additional commands, e-mail: users-help@maven.apache.org
|
|
|
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)

iD8DBQFDQZVbK3h2CZwO/4URAoYnAJ9AZHgzZ1AQFEr3jeSJjnUAtRbKBQCgoPvP
xDVwWmgLU6u8lfLcUvGVYT0=
=PcRz
-----END PGP SIGNATURE-----

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