0

根据指南 - https://github.com/WASdev/ci.maven#deploy,我制作了如下所示的 pom.xml


             <plugin>
                <groupId>net.wasdev.wlp.maven.plugins</groupId>
                <artifactId>liberty-maven-plugin</artifactId> 
                <version>1.0</version>
               <configuration>
                    <serverHome>D:\eclipses\eGovFrameDev-2.7.0-64bit_Liberty\wlp</serverHome>
                    <serverName>defaultServer</serverName>
                </configuration>
                <executions>
                        <execution>
                        <id>deploy-app</id>
                        <phase>post-integration-test</phase>
                        <goals>
                            <goal>deploy</goal>
                        </goals>
                        <configuration>
                            <appArchive>D:\eclipses\eGovFrameDev-2.7.0-64bit_Liberty\workspace\Test\target\Test-0.0.1-SNAPSHOT.war</appArchive>                  
                        </configuration>
                    </execution>
                </executions>

当我运行 'mvn -X liberty:deploy' 时,出现如下异常


[错误] 无法在项目测试中执行目标 net.wasdev.wlp.maven.plugins:liberty-maven-plugin:1.0:deploy (default-cli):CWWKM2155E:没有应用程序按 appArchive 属性指定部署-> [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: 无法在项目测试中执行目标 net.wasdev.wlp.maven.plugins:liberty-maven-plugin:1.0:deploy (default-cli): CWWKM2155E:在 org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor .java:153) 在 org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) 在 org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84) 在 org. org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183) 在 org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161) 在 org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320) 在 org.apache.maven.DefaultMaven .execute(DefaultMaven.java:156) 在 org.apache.maven.cli.MavenCli.execute(MavenCli.java:537) 在 org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196) 在 org. apache.maven.cli.MavenCli.main(MavenCli.java:141) 在 sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 在 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:94) 在 sun.reflect.DelegatingMethodAccessorImpl。在 org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290) 在 org.codehaus 的 java.lang.reflect.Method.invoke(Method.java:619) 调用(DelegatingMethodAccessorImpl.java:55) .丛。classworlds.launcher.Launcher.launch(Launcher.java:230) 在 org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409) 在 org.codehaus.plexus.classworlds.launcher.Launcher.main( Launcher.java:352) 原因:org.apache.maven.plugin.MojoExecutionException: CWWKM2155E: CWWKM2155E: org.codehaus.mojo.pluginsupport.MojoSupport.execute(MojoSupport) 中的 appArchive 属性指定没有要部署的应用程序.java:129) 在 org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101) 在 org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209) ... 还有 19 个原因:org.apache.maven.plugin.MojoExecutionException:CWWKM2155E:CWWKM2155E:没有应用程序要部署,如 net.appArchive 属性所指定的那样。wasdev.wlp.maven.plugins.applications.DeployAppMojo.doExecute(DeployAppMojo.java:76) at org.codehaus.mojo.pluginsupport.MojoSupport.execute(MojoSupport.java:122)

... 21 更多

请给我专家建议如何解决此问题,然后使用 maven 在 IBM WAS Liberty 上部署应用程序

谢谢,

4

1 回答 1

0

Using Maven command line you can execute a goal (as you are doing in this case) or a lifecycle phase (for example install). In the pom.xml snippet you attached you have a plugin-level configuration (with serverHome and serverName) and execution-level configuration (with appArchive). The issue is when executing a specific goal of a plugin from the command line only the plugin-level configuration is used. That's why the plug-in does not see the appArchive configuration. However, if you were the execute a Maven phase such as install, the execution-level configuration would be used (at the right time) and the application would be deployed.

If you want the deploy goal to work from the command line just move the appArchive configuration to the plugin-level configuration. Also, the following might be helpful: http://maven.apache.org/guides/mini/guide-default-execution-ids.html

于 2014-07-08T16:49:23.597 回答