首页 > 解决方案 > 如果打包设置为 pom,wildfly.maven.plugin 不会部署任何内容

问题描述

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

由于我不是在构建工件,而是在下载它,所以我并没有真正制作 JAR(或任何存档的工件)。

我目前遇到的问题是:如果将包装设置为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,我可以让它在我使用的更复杂的那个中工作。

标签: mavenwildfly-maven-plugin

解决方案


看看deploy-artifact目标。文档中有一个例子


推荐阅读