wildfly.maven.plugin 如果打包设置为 pom,则不部署任何内容

wildfly.maven.plugin deploys nothing if packaging is set to pom

我正在使用 Maven 以自动下载依赖项设置(并启动)JBoss 服务器 部署下载的依赖项。我创建了一个 pom.xml,它使用了多个 Maven 插件。对于 JBoss 相关的 交互,我使用的是 wildfly-maven.plugin(当前版本 2.0.1.Final ).

由于我不是在构建工件,而是在下载它,因此我并不是真正在生成 JAR(或任何存档工件)。

我目前遇到的问题是:如果 packaging 设置为 pom,wildfly-maven-plugin 似乎没有任何作用.

作为解决方法,我目前将项目打包设置为 JAR 并添加以下内容以防止构建项目 JAR:

<properties>
    <jar.skipIfEmpty>true</jar.skipIfEmpty>
    <maven.install.skip>true</maven.install.skip>
</properties>

更新 04.03 这就是我的 pom.xml 的基本样子:

<project xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>some.group</groupId>
    <artifactId>artifact</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>jar</packaging>

    <name>~y</name>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>

        <maven.install.skip>true</maven.install.skip>
        <jar.skipIfEmpty>true</jar.skipIfEmpty>

        <plugin.wildfly.version>2.0.1.Final</plugin.wildfly.version>
        <plugin.wildfly.jboss-home>D:\server\jboss-eap-7.1</plugin.wildfly.jboss-home>
        <plugin.wildfly.hostname>localhost</plugin.wildfly.hostname>
        <plugin.wildfly.port>9990</plugin.wildfly.port>
        <plugin.wildfly.debug.port>9991</plugin.wildfly.debug.port>
    </properties>

    <build>
        <plugins>
            <plugin>
                <groupId>org.wildfly.plugins</groupId>
                <artifactId>wildfly-maven-plugin</artifactId>
                <version>${plugin.wildfly.version}</version>
                <configuration>
                    <jboss-home>${plugin.wildfly.jboss-home}</jboss-home>
                    <id>local-jboss</id>
                    <hostname>${plugin.wildfly.hostname}</hostname>
                    <port>${plugin.wildfly.port}</port>
                    <filename>y.ear</filename>
                    <force>true</force>
                </configuration>
                <executions>
                    <execution>
                        <id>deploy-ear</id>
                        <phase>install</phase>
                        <goals>
                            <goal>deploy-only</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>

我会尝试 deploy-artifact,但总的来说,我希望 wildfly.maven.plugin 即使 <packaging> 也能正常工作设置为 pom.

命令行上的 Maven 命令来构建它:mvn clean install.

我的真实 pom.xml 有点复杂,但如果它可以使用这个简单的 pom.xml,我可以让它在我使用的更复杂的 [=18] 中工作。 =]

查看文档中的 deploy-artifact goal. There is an example

如果打包设置为 pom

wildfly-maven-plugin 似乎没有任何作用。将 packaging-type jarjar.skipIfEmpty 一起使用会有所帮助。

使用wildfly-maven-plugindeploy-only目标时,发布作品(通过管理界面)。