【问题标题】:Error invoking command! when deploying war to WebSphere Liberty server using Maven Cargo调用命令出错!使用 Maven Cargo 将战争部署到 WebSphere Liberty 服务器时
【发布时间】:2019-03-30 02:43:26
【问题描述】:

我目前正在尝试将 war 文件部署到 Websphere Liberty 服务器。

    <profile>
        <id>integration</id>
        <build>
            <plugins>
                <plugin>
                    <groupId>org.codehaus.cargo</groupId>
                    <artifactId>cargo-maven2-plugin</artifactId>
                    <version>1.6.11</version>
                    <configuration>
                        <!-- Container configuration -->
                        <container>
                            <containerId>websphere85x</containerId>
                            <type>installed</type>
                        </container>
                        <configuration>
                            <type>existing</type>
                            <home>WebSphere server location</home>
                        </configuration>
                        <deployables>
                            <deployable>
                                <artifactId>artifact</artifactId>
                                <groupId>com.group</groupId>
                                <type>war</type>
                            </deployable>
                        </deployables>
                    </configuration>
                </plugin>
            </plugins>
        </build>
    </profile>

当我跑步时

货物:部署-Pintegration

我收到以下错误

[错误] 无法执行目标 org.codehaus.cargo:cargo-maven2->plugin:1.6.11:deploy (default-cli) on project artifact: Execution >default-cli of goal org.codehaus.cargo: cargo-maven2-plugin:1.6.11:deploy >failed:部署失败:无法执行 jython 脚本。调用命令出错! >Cannot run program "null\bin\wsadmin.bat": CreateProcess error=2, The system >cannot find the file specified

有人知道这是什么原因吗?

我应该使用什么插件\依赖项来获取 wsadmin.bat?

或者我该如何解决这个问题?

提前致谢

更新

我几乎可以让这个工作 新配置如下

<profile>
    <id>integration</id>
    <build>
        <plugins>
            <plugin>
                <groupId>org.codehaus.cargo</groupId>
                <artifactId>cargo-maven2-plugin</artifactId>
                <version>1.6.11</version>
                <configuration>
                    <!-- Container configuration -->
                    <container>
                        <containerId>liberty</containerId>
                        <type>installed</type>
                    </container>
                    <configuration>
                        <home>LibertyServer</home>
                    </configuration>
                    <deployables>
                        <deployable>
                            <artifactId>SIS-AM-CONSOL-GSPWeb</artifactId>
                            <groupId>com.group</groupId>
                            <type>war</type>
                        </deployable>
                    </deployables>
                </configuration>
            </plugin>
        </plugins>
    </build>
</profile>

现在的问题是war文件正在部署到

LibertyServer\servers\defaultServer\apps

而正确的位置应该是

LibertyServer\usr\servers\defaultServer\apps

我一直在查看 the reference guide,但我没有看到自定义目录的方法。

我确实尝试添加

<files>
    <copy>
        <file>war file</file>
        <toDir>LibertyServer\usr\servers\defaultServer\apps</toDir>
        <overwrite>true</overwrite>
    </copy>
</files>

进入配置设置。

但正如预期的那样,这不起作用。

有什么想法吗?

再次感谢。

【问题讨论】:

  • 您当前的配置是针对 tWAS 而不是针对 Liberty。对于 Liberty,您应该使用 &lt;containerId&gt;liberty&lt;/containerId&gt;。如果它现在可以工作,请将您的工作配置添加为其他人参考的答案。

标签: java maven websphere cargo


【解决方案1】:

使用以下代码进行部署

<profile>
    <id>integration</id>
    <build>
        <plugins>
            <plugin>
                <groupId>org.codehaus.cargo</groupId>
                <artifactId>cargo-maven2-plugin</artifactId>
                <version>1.6.11</version>
                <configuration>
                    <!-- Container configuration -->
                    <container>
                        <timeout>600000</timeout>
                        <containerId>liberty</containerId>
                        <type>installed</type>
                        <home>ServerHome</home>
                    </container>
                    <configuration>
                        <type>standalone</type>
                        <home>ServerHome</home>
                    </configuration>
                    <deployables>
                        <deployable>
                            <artifactId>Artifact</artifactId>
                            <groupId>com.group</groupId>
                            <type>war</type>
                        </deployable>
                    </deployables>
                </configuration>
            </plugin>
        </plugins>
    </build>
</profile>

此外,您似乎无法配置 war 文件的部署位置。 它只会部署到 defaultServer。

【讨论】:

    【解决方案2】:

    更新 &lt;home&gt;WebSphere server location&lt;/home&gt; 以指向您的 WAS_HOME 位置。当它尝试定位 wsadmin 以执行 jython 脚本时,它失败了:null\bin\wsadmin.bat。 null 应该是 WAS_HOME 的值...

    【讨论】:

    • 感谢您的快速回复。不幸的是 wsadmin.bat 不在那个 bin 文件夹中:-(。关于如何生成它的任何建议?
    • 如果您在 Win box 上并且 wsadmin.bat 不在 WAS_HOME/bin 中,那么您的 WAS 安装有问题
    猜你喜欢
    • 1970-01-01
    • 2015-12-30
    • 1970-01-01
    • 2015-02-13
    • 1970-01-01
    • 1970-01-01
    • 2010-11-01
    • 1970-01-01
    • 2011-10-20
    相关资源
    最近更新 更多