我正在尝试使用 Maven Wagon 插件将工件复制到服务器。
我已将其设置如下:
<build>
<extensions>
<extension>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-ssh</artifactId>
<version>${maven.wagon.version}</version>
</extension>
</extensions>
<plugins>
<plugin>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-maven-plugin</artifactId>
<version>${maven.wagon.version}</version>
<!-- <dependencies>
<dependency>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-ssh</artifactId>
<version>${maven.wagon.version}</version>
</dependency>
</dependencies> -->
<configuration>
<serverId>appui</serverId>
<fromFile>${project.build.directory}</fromFile>
<includes>${project.build.finalName}.war</includes>
<url>scp://localhost:2221/</url>
<toDir>/opt/jboss/jboss-as-7.1.1.Final/standalone/deployments</toDir>
</configuration>
<executions>
<execution>
<id>upload-war-to-server</id>
<phase>upload</phase>
<goals>
<goal>upload-single</goal>
</goals>
<configuration>
<serverId>appui</serverId>
<fromFile>${project.build.directory}</fromFile>
<includes>${project.build.finalName}.war</includes>
<url>scp://localhost:2221/opt/jboss/jboss-as-7.1.1.Final/standalone/deployments</url>
</configuration>
</execution>
</executions>
</plugin>
但是,当我运行它时,我收到以下错误:
[ERROR] Failed to execute goal org.codehaus.mojo:wagon-maven-plugin:1.0:upload-single (default-cli) on project app.ui: The parameters 'fromFile', 'url' for goal org.codehaus.mojo:wagon-maven-plugin:1.0:upload-single are missing or invalid -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:wagon-maven-plugin:1.0:upload-single (default-cli) on project app.ui: The parameters 'fromFile', 'url' for goal org.codehaus.mojo:wagon-maven-plugin:1.0:upload-single are missing or invalid
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:221)
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:320)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
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 'fromFile', 'url' for goal org.codehaus.mojo:wagon-maven-plugin:1.0:upload-single are missing or invalid
at org.apache.maven.plugin.internal.DefaultMavenPluginManager.populatePluginFields(DefaultMavenPluginManager.java:576)
at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getConfiguredMojo(DefaultMavenPluginManager.java:529)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:92)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
... 19 more
[ERROR]
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginParameterException
我搜索了 github 以了解其他人如何使用 Maven Wagon,但我看不出我使用它的方式有什么问题。