Maven error with multiple executions in maven-deploy-plugin

admin

Administrator
Staff member
I found <a href="http://ionixx.wordpress.com/2008/03...nt-tasks-within-maven2-outside-the-lifecycle/" rel="nofollow noreferrer">this nice recipe</a> and want to use it to deploy some 3rd-party files in our repository

The call on the command line is

Code:
mvn -P deploy-libs

If I do this for <strong>one</strong> file it works exactly as intended

Code:
&lt;profiles&gt;
    &lt;profile&gt;
        &lt;id&gt;deploy-libs&lt;/id&gt;
        &lt;build&gt;
            &lt;defaultGoal&gt;deploy:deploy-file&lt;/defaultGoal&gt;
            &lt;plugins&gt;
                &lt;plugin&gt;
                    &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                    &lt;artifactId&gt;maven-deploy-plugin&lt;/artifactId&gt;
                    &lt;version&gt;2.4&lt;/version&gt;
                    &lt;goals&gt;
                        &lt;goal&gt;deploy-file&lt;/goal&gt;
                    &lt;/goals&gt;
                    &lt;configuration&gt;
                        &lt;repositoryId&gt;openscada-external&lt;/repositoryId&gt;
                        &lt;url&gt;${openscada.distrib.repository}&lt;/url&gt;
                        &lt;file&gt;../openscada_opc_dcom/lib/j-interop.jar&lt;/file&gt;
                        &lt;pomFile&gt;../openscada_opc_dcom/lib/j-interop.pom&lt;/pomFile&gt;
                    &lt;/configuration&gt;
                &lt;/plugin&gt;
            &lt;/plugins&gt;
        &lt;/build&gt;
    &lt;/profile&gt;
&lt;/profiles&gt;

If I use an execution block with multiple executions, it doesn't work. Is this a bug, or is this intended behavior?

Code:
&lt;profiles&gt;
    &lt;profile&gt;
        &lt;id&gt;deploy-libs&lt;/id&gt;
        &lt;build&gt;
            &lt;defaultGoal&gt;deploy:deploy-file&lt;/defaultGoal&gt;
            &lt;plugins&gt;
                &lt;plugin&gt;
                    &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                    &lt;artifactId&gt;maven-deploy-plugin&lt;/artifactId&gt;
                    &lt;version&gt;2.4&lt;/version&gt;
                    &lt;configuration&gt;
                        &lt;repositoryId&gt;openscada-external&lt;/repositoryId&gt;
                        &lt;url&gt;${openscada.distrib.repository}&lt;/url&gt;
                    &lt;/configuration&gt;
                    &lt;executions&gt;
                        &lt;execution&gt;
                            &lt;id&gt;j-interop&lt;/id&gt;
                            &lt;goals&gt;
                                &lt;goal&gt;deploy-file&lt;/goal&gt;
                            &lt;/goals&gt;
                            &lt;configuration&gt;
                                &lt;file&gt;../openscada_opc_dcom/lib/j-interop.jar&lt;/file&gt;
                                &lt;pomFile&gt;../openscada_opc_dcom/lib/j-interop.pom&lt;/pomFile&gt;
                            &lt;/configuration&gt;
                        &lt;/execution&gt;
                        &lt;execution&gt;
                            &lt;id&gt;j-interopdeps&lt;/id&gt;
                            &lt;goals&gt;
                                &lt;goal&gt;deploy-file&lt;/goal&gt;
                            &lt;/goals&gt;
                            &lt;configuration&gt;
                                &lt;file&gt;../openscada_opc_dcom/lib/j-interopdeps.jar&lt;/file&gt;
                                &lt;pomFile&gt;../openscada_opc_dcom/lib/j-interopdeps.pom&lt;/pomFile&gt;
                            &lt;/configuration&gt;
                        &lt;/execution&gt;
                        &lt;execution&gt;
                            &lt;id&gt;jcifs&lt;/id&gt;
                            &lt;goals&gt;
                                &lt;goal&gt;deploy-file&lt;/goal&gt;
                            &lt;/goals&gt;
                            &lt;configuration&gt;
                                &lt;file&gt;../openscada_opc_dcom/lib/jcifs-1.2.9.jar&lt;/file&gt;
                                &lt;pomFile&gt;../openscada_opc_dcom/lib/jcifs-1.2.9.pom&lt;/pomFile&gt;
                            &lt;/configuration&gt;
                        &lt;/execution&gt;
                    &lt;/executions&gt;
                &lt;/plugin&gt;
            &lt;/plugins&gt;
        &lt;/build&gt;
    &lt;/profile&gt;
&lt;/profiles&gt;

The error I get is:

Code:
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] One or more required plugin parameters are invalid/missing for 'deploy:deploy-file'

[0] Inside the definition for plugin 'maven-deploy-plugin' specify the following:

&lt;configuration&gt;
  ...
  &lt;file&gt;VALUE&lt;/file&gt;
&lt;/configuration&gt;

-OR-

on the command line, specify: '-Dfile=VALUE'

[INFO] ------------------------------------------------------------------------
[INFO] Trace
org.apache.maven.lifecycle.LifecycleExecutionException: Error configuring: org.apache.maven.plugins:maven-deploy-plugin. Reason: Invalid or missing parameters: [Mojo parameter [name: 'file'; alias: 'null']] for mojo: org.apache.maven.plugins:maven-deploy-plugin:2.4:deploy-file
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:587)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:512)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:482)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:330)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:227)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:142)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:336)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:129)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:287)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
    at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
    at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
    at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: org.apache.maven.plugin.PluginParameterException: Error configuring: org.apache.maven.plugins:maven-deploy-plugin. Reason: Invalid or missing parameters: [Mojo parameter [name: 'file'; alias: 'null']] for mojo: org.apache.maven.plugins:maven-deploy-plugin:2.4:deploy-file
    at org.apache.maven.plugin.DefaultPluginManager.checkRequiredParameters(DefaultPluginManager.java:1042)
    at org.apache.maven.plugin.DefaultPluginManager.getConfiguredMojo(DefaultPluginManager.java:659)
    at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:429)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:558)
    ... 16 more

Any ideas?