0

我有一个在 WebSphere Liberty 中运行的应用程序。通过mvn install命令,我需要将我的应用程序部署到 liberty apps目录,因为我没有使用dropins目录。

Bellow 是我可以部署到dropins目录的工作 maven 插件代码。

        <plugin>
            <groupId>net.wasdev.wlp.maven.plugins</groupId>
            <artifactId>liberty-maven-plugin</artifactId>
            <version>1.2.1</version>
            <executions>
                <execution>
                    <id>start-server</id>
                    <phase>pre-integration-test</phase>
                    <goals>
                        <goal>start-server</goal>
                    </goals>
                    <configuration>
                        <verifyTimeout>60</verifyTimeout>
                    </configuration>
                </execution>
                <execution>
                    <id>deploy</id>
                    <phase>install</phase>
                    <goals>
                        <goal>deploy</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <serverHome>${wlp.dir}</serverHome>
                <serverName>${server}</serverName>
                <appArtifact>
                    <groupId>${project.groupId}</groupId>
                    <artifactId>${project.artifactId}</artifactId>
                    <version>${project.version}</version>
                    <type>${project.packaging}</type>
                </appArtifact>
                <appDeployName>${project.artifactId}.${project.packaging}</appDeployName>
            </configuration>
        </plugin>

我在任何地方都找不到需要添加/更改哪些配置才能将应用程序直接部署到应用程序目录。有人可以让我知道这里缺少什么吗?

4

2 回答 2

1

添加install-apps执行步骤而不是部署(部署执行步骤只会将应用程序部署到 dropins 文件夹)步骤将解决问题。版本必须更新到 1.3,这是目前最新的

参考:https ://github.com/WASdev/ci.maven/blob/master/docs/install-apps.md

完整的 Maven 插件代码如下

<plugin>
        <groupId>net.wasdev.wlp.maven.plugins</groupId>
        <artifactId>liberty-maven-plugin</artifactId>
        <version>1.3</version>
        <executions>
            <execution>
                <id>start-server</id>
                <phase>pre-integration-test</phase>
                <goals>
                    <goal>start-server</goal>
                </goals>
                <configuration>
                    <verifyTimeout>60</verifyTimeout>
                </configuration>
            </execution>
            <execution>
                <id>install-apps</id>
                <phase>pre-integration-test</phase>
                <goals>
                    <goal>install-apps</goal>
                </goals>
                <configuration>
                    <appsDirectory>apps</appsDirectory>
                    <installAppPackages>project</installAppPackages>
                </configuration>
            </execution>
        </executions>
        <configuration>
            <serverHome>${wlp.dir}</serverHome>
            <serverName>${server}</serverName>
            <appArtifact>
                <groupId>${project.groupId}</groupId>
                <artifactId>${project.artifactId}</artifactId>
                <version>${project.version}</version>
                <type>${project.packaging}</type>
            </appArtifact>
            <appDeployName>${project.artifactId}.${project.packaging}</appDeployName>
        </configuration>
    </plugin>
于 2017-05-24T09:04:46.833 回答
0

您也可以尝试插件的当前 2.0-SNAPSHOT 版本。只需包含父 pom 和插件的一些配置。2.0 版将于 6 月初发布。

如果您不想包含父 pom,您可以<pluginManagement/>从父 pom 中复制包含 liberty-maven-plugin 目标绑定到 Maven 默认构建生命周期的部分。见https://github.com/WASdev/ci.maven/blob/master/docs/parent-pom.md

<parent>
    <groupId>net.wasdev.wlp.maven.parent</groupId>
    <artifactId>liberty-maven-app-parent</artifactId>
    <version>2.0-SNAPSHOT</version>
</parent>

<repositories>
    <repository>
        <id>sonatype-nexus-snapshots</id>
        <name>Sonatype Nexus Snapshots</name>
        <url>https://oss.sonatype.org/content/repositories/snapshots/
        </url>
        <releases>
            <enabled>false</enabled>
        </releases>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
    </repository>
</repositories>
<pluginRepositories>
    <pluginRepository>
        <id>sonatype-nexus-snapshots</id>
        <name>Sonatype Nexus Snapshots</name>
        <url>https://oss.sonatype.org/content/repositories/snapshots/
        </url>
        <releases>
            <enabled>false</enabled>
        </releases>
        <snapshots>
            <enabled>true</enabled>
         </snapshots>
    </pluginRepository>
</pluginRepositories>

...

<build>
    <finalName>${project.artifactId}</finalName>
    <plugins>
        ...
        <plugin>
            <groupId>net.wasdev.wlp.maven.plugins</groupId>
            <artifactId>liberty-maven-plugin</artifactId>
            <version>2.0-SNAPSHOT</version>
            <configuration>
                <assemblyArtifact>
                    <groupId>com.ibm.websphere.appserver.runtime</groupId>
                    <artifactId>wlp-webProfile7</artifactId>
                    <version>17.0.0.1</version>
                    <type>zip</type>
                </assemblyArtifact>
                <serverName>${project.artifactId}Server</serverName>
                <configFile>src/main/liberty/config/server.xml</configFile>
            </configuration>
        </plugin>
    </plugins>

    ...
</build>
于 2017-05-24T14:40:23.510 回答