1) I run it in phase generate-resources
2) I run it with profile, because I need to unpack different artifacteId for
different profile
3) I do unpacking in a separate module(children pom)
What is funny with this plugin if I put this in a parent(root) pom:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.2</version>
<executions>
<execution>
<id>unpack_sfinga2</id>
<phase>generate-resources</phase>
<goals>
<goal>unpack</goal>
</goals>
</execution>
</executions>
<configuration>
<artifactItems>
<artifactItem>
<groupId>si.arnes</groupId>
<artifactId>aris-entities-sfinga2</artifactId>
<version>0.0.1</version>
<type>jar</type>
<overWrite>true</overWrite>
<outputDirectory>${sfinga2.dist.build.aris}</outputDirectory>
</artifactItem>
</artifactItems>
</configuration>
</plugin>
It works, but if I this put in my child pom(module), it fails with error:
Caused by: org.apache.maven.plugin.PluginParameterException: The parameters
'artifactItems' for goal
org.apache.maven.plugins:maven-dependency-plugin:2.2:unpack are missing or
invalid
And this error is the same if I put artifactItems configuration in side
execution
So for me and most the people on forums I look, people have a lot of problems
with this plugin, and it is so basic operation as unjaring the library.
Ok, maybe I miss some basic maven fundamentals, but according to doc site, even
the examples doesn't work
I run it;
mvn generate-resources dependency:unpack -P sfinga2
Regards, Tomaz
S, Stephen Connolly piše:
>
>
> On 23 March 2011 08:19, TomazM <[email protected]
> <mailto:[email protected]>> wrote:
>
> No this is not issue, probably bad design of maven plugin.
> Because if I take configuration out of executions then it is working
> other wise throw ridiculous error.
>
>
> Nope that is F.A.D. not a bug but E.B.K.A.C.
>
>
>
> But if I aggregate pom's then unpacking doesn't work at all (where ever
> you put configuration for this plugin doesn't work, because it can not read
> artifactItems)
>
> For me this is bug of plugin or maven design, it doesn't matter it just
> not work
>
>
> It works the way it is intended to work. You are not supposed to just invoke
> random plugin goals from the command line.... you are supposed to invoke
> lifecycle phases. The plugin goals are to support debugging the lifecycle
> and some simple one-off tasks.... if it is something you have to do a lot
> then it should be bound to the lifecycle via executions... if it is not to
> happen every time, then put the binding in a profile.... you can even put a
> default lifecycle phase in the profile so that all you need to do is
>
> mvn -PmySuperProfile
>
> and it will invoke the lifecycle and all the profile bound executions
>
> -Stephen
>
>
> Regards, Tomaz
>
> S, Stephen Connolly piše:
> > The first(Andrew) and the last comment (Brian) explains it all..
> >
> > In general in Maven you do not invoke goals directly, but instead you
> invoke the phase that the goal is bound to (or any later phase)
> >
> > The example code binds the goal to the package phase, and also puts the
> configuration for that binding into the execution. Therefore when you
> run the
> > goal directly from the CLI as "mvn dependency:unpack" the plugin is
> missing its required configuration because the configuration is contained
> within a
> > lifecycle execution.
> >
> > The example illustrated best practice, which is what examples should do.
> >
> > If you read the second half of the page you
> > link:
> http://maven.apache.org/plugins/maven-dependency-plugin/examples/unpacking-artifacts.html#Unpacking_from_the_command_line
> >
> > It will tell you how to make things work the way you are trying to make
> them work, but you should only do that while trying to figure out how to use
> > the plugin. Once you have that figured out, move the configuration
> back into an execution (or if it is something that is only occasional, move it
> > into a profile or best an execution in a profile) and just use the
> lifecycle to invoke it as needed
> >
> > -Stephen
> >
> > On 22 March 2011 12:28, TomazM <[email protected]
> <mailto:[email protected]> <mailto:[email protected]
> <mailto:[email protected]>>> wrote:
> >
> > On this site http://jira.codehaus.org/browse/MDEP-163 you have a
> bug report, but this gay saying that this is not a bug, what else is then.
> >
> > ----------------------------------------
> > Dan Tran made changes - 31/Dec/09 5:57 PM
> > Status Open [ 1 ] Closed [ 6 ]
> > Resolution Not A Bug [ 6 ]
> > ---------------------------------------
> >
> > If you are distributing something and basic example from your site
> >
> http://maven.apache.org/plugins/maven-dependency-plugin/examples/unpacking-artifacts.html
> >
> > throw an exception:
> > [ERROR] Failed to execute goal
> org.apache.maven.plugins:maven-dependency-plugin:2.2:unpack (default-cli) on
> project ozwizard_lu_dev: The
> parameters
> > 'artifactItems' for goal
> org.apache.maven.plugins:maven-dependency-plugin:2.2:unpack are missing or
> invalid -> [Help 1]
> >
> >
> > 1) Or change your documentation how to use it
> > 2) Or actually look and test for your bug
> >
> >
> > Regards, Tomaz
> >
> >
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [email protected]
> <mailto:[email protected]>
> <mailto:[email protected]
> <mailto:[email protected]>>
> > For additional commands, e-mail: [email protected]
> <mailto:[email protected]> <mailto:[email protected]
> <mailto:[email protected]>>
> >
> >
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]