有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java Maven wildflymavenplugin定制独立版。xml

如何使用自定义单机版。运行wildfly maven插件时的xml:start(不仅仅是添加数据源、驱动程序等等)

使用wildfly-maven-plugin-1.0.2。最终:

<groupId>org.wildfly.plugins</groupId>
<artifactId>wildfly-maven-plugin</artifactId>
<version>1.0.2.Final</version>
...
<execution>
    <id>pre-integration-phase</id>
    <phase>pre-integration-test</phase>
    <goals>
        <goal>start</goal>
        <goal>deploy</goal>
    </goals>
</execution>
...

我曾尝试使用maven resources插件复制wildfly配置文件夹中的资源(standalone.xml),但似乎wildfly:start覆盖并删除wildfly(配置)目录中的每个(其他)文件

这个任务用于jenkins集成测试,这就是为什么我需要在测试进行时运行jboss


共 (1) 个答案

  1. # 1 楼答案

    您可以解压缩WildFly安装,然后在WildFly maven插件中设置jbossHome配置元素

    配置示例:

        <version.wildfly>8.2.0.Final</version.wildfly>
        <jboss.home>${project.build.directory}/wildfly-${version.wildfly}</jboss.home>
        <server.config>standalone.xml</server.config>
    
    
            <!  Unpack the distribution  >
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <id>unpack-wildfly</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>unpack</goal>
                        </goals>
                        <inherited>false</inherited>
                        <configuration>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>org.wildfly</groupId>
                                    <artifactId>wildfly-dist</artifactId>
                                    <version>${version.wildfly}</version>
                                    <type>zip</type>
                                    <overWrite>false</overWrite>
                                    <outputDirectory>${project.build.directory}</outputDirectory>
                                </artifactItem>
                            </artifactItems>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <!  Copy server configuration  >
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
                <version>${version.plugin.resources}</version>
                <executions>
                    <execution>
                        <id>copy-standalone-xml</id>
                        <phase>generate-test-sources</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${jboss.home}/standalone/configuration</outputDirectory>
                            <resources>
                                <resource>
                                    <directory>src/main/resources</directory>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <!  WildFly plugin to deploy war  >
            <plugin>
                <groupId>org.wildfly.plugins</groupId>
                <artifactId>wildfly-maven-plugin</artifactId>
                <version>${version.wildfly.maven.plugin}</version>
                <configuration>
                    <jbossHome>${jboss.home}</jbossHome>
                    <serverConfig>${server.config}</serverConfig>
                </configuration>
                <executions>
                    <execution>
                        <id>pre-integration-phase</id>
                        <phase>pre-integration-test</phase>
                        <goals>
                            <goal>start</goal>
                            <goal>deploy</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>