2
votes

I am trying to push json report file to Nexus repo. I set Jenkins job to run

mvn -X -e deploy:deploy-file "-DgeneratePom=true" "-Durl=http://repo_location" -DrepositoryId=internal-repository" "-DgroupId=com.devsys" "-DartifactId=report" "-Dbuild.number=%BUILD_NUMBER%" "-Dpackaging=json" "-Dfile=%WORKSPACE%\backend-acceptance-tests\target\cucumber.json"

However, getting error:

The parameters 'file' for goal org.apache.maven.plugins:maven-deploy-plugin:2.8.1:deploy-file are missing or invalid

I even tried absolute path, still same error, json is sitting in the location specified.

Hope to get another set of eyes to provide feedback on such matter?

Full error

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.8.1:deploy-file (default-cli) on project workbrain-automation-framework: The parameters 'file' for goal org.apache.maven.plugins:maven-deploy-plugin:2.8.1:deploy-file are missing or invalid -> [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.8.1:deploy-file (default-cli) on project workbrain-automation-framework: The parameters 'file' for goal org.apache.maven.plugins:maven-deploy-plugin:2.8.1:deploy-file are missing or invalid at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:220) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59) at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:317) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:152) at org.apache.maven.cli.MavenCli.execute(MavenCli.java:555) at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:214) at org.apache.maven.cli.MavenCli.main(MavenCli.java:158) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289) at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415) at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356) Caused by: org.apache.maven.plugin.PluginParameterException: The parameters 'file' for goal org.apache.maven.plugins:maven-deploy-plugin:2.8.1:deploy-file are missing or invalid at org.apache.maven.plugin.internal.DefaultMavenPluginManager.populatePluginFields(DefaultMavenPluginManager.java:581) at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getConfiguredMojo(DefaultMavenPluginManager.java:534) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:97) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208) ... 19 more

1
what is there in the console output in jenkins for the command, file parameter would be of particular interest. - pradosh nair
@pradoshnair I added full error. Not sure what do you mean by file parameter as I listed in maven command as -Dfile - Vanatomas
I am assuming that you have missed the quotes while editing the question for a generic repo location else it can be an issue. Also assuming, that jenkins is running on windows box else backslash in file attribute needs to be replaced with forward slash, forward slash works in both environments . Wanted to see what the whole mvn line is getting resolved to, but the console output shown here is not displaying that. - pradosh nair
thanks, that bloody " I missed, interesting that Dbuild.number=%BUILD_NUMBER%" is not being used for some reason, had to change to -Dversion=%BUILD_NUMBER%" - Vanatomas

1 Answers

4
votes

You're missing a quote before -DrepositoryId=. All of your quotes need to be matched up correctly for this to work.