我找到了这个很好的食谱,并希望用它在我们的存储库中部署一些第三方文件
命令行上的调用是
mvn -P deploy-libs
如果我为一个文件执行此操作,它将完全按预期工作
deploy-libs deploy:deploy-file org.apache.maven.plugins maven-deploy-plugin 2.4 deploy-file openscada-external ${openscada.distrib.repository} ../openscada_opc_dcom/lib/j-interop.jar ../openscada_opc_dcom/lib/j-interop.pom
如果我使用具有多个执行的执行块,则它不起作用.这是一个错误,还是这个预期的行为?
deploy-libs deploy:deploy-file org.apache.maven.plugins maven-deploy-plugin 2.4 openscada-external ${openscada.distrib.repository} j-interop deploy-file ../openscada_opc_dcom/lib/j-interop.jar ../openscada_opc_dcom/lib/j-interop.pom j-interopdeps deploy-file ../openscada_opc_dcom/lib/j-interopdeps.jar ../openscada_opc_dcom/lib/j-interopdeps.pom jcifs deploy-file ../openscada_opc_dcom/lib/jcifs-1.2.9.jar ../openscada_opc_dcom/lib/jcifs-1.2.9.pom
我得到的错误是:
[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:... -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 moreVALUE
有任何想法吗?
发生这种情况的原因是,当您从命令行调用插件时,它就没有与之相关的阶段或执行.这意味着它会获取未命名的执行配置,这是执行块之外的配置.
如果您确实想要运行多个执行,请将它们绑定到某个阶段,然后调用该阶段.在这种情况下,每次执行都将使用自己的配置运行.
这里真正未解决的问题是你使用deploy-file来部署这样的一堆东西的原因?如果它是第三方的东西,你应该得到像Nexus这样的回购经理,并将它们上传到一个存储库供整个团队使用.