gpt4 book ai didi

java - Maven 的配置文件问题

转载 作者:行者123 更新时间:2023-12-02 02:17:52 24 4
gpt4 key购买 nike

我尝试使用配置文件构建一个项目。

在 pom.xml 中,每个环境都有 3 个配置文件。例如,本地配置文件如下所示:

<profile>
<id>local</id>
<build>
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<configuration>
<tasks>
<delete>
<fileset dir="${project.build.outputDirectory}/wsdl" includes="*.wsdl" />
</delete>
<copy file="src/main/resources/wsdl/WebService-LOCAL.wsdl"
tofile="${project.build.outputDirectory}/wsdl/WebService.wsdl"/>
</tasks>
</configuration>
<phase>package</phase>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.jvnet.jax-ws-commons</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
<version>2.2</version>
<executions>
<execution>
<id>generate-stubs</id>
<phase>generate-sources</phase>
<goals>
<goal>wsimport</goal>
</goals>
<configuration>
<wsdlUrls>
<wsdlUrl>http://localhost:8080/WebService/WebServiceBean?wsdl</wsdlUrl>
</wsdlUrls>
<packageName>com.company.WebService.ws.generated</packageName>
<extension>true</extension>
<verbose>true</verbose>
<keep>true</keep>
<catalog>${basedir}/main/resources/catalog.xml</catalog>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<!--This plugin's configuration is used to store Eclipse m2e settings
only. It has no influence on the Maven build itself. -->
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>
org.jvnet.jax-ws-commons
</groupId>
<artifactId>
jaxws-maven-plugin
</artifactId>
<versionRange>
[2.2,)
</versionRange>
<goals>
<goal>wsimport</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore />
</action>
</pluginExecution>
<pluginExecution>
<pluginExecutionFilter>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-dependency-plugin
</artifactId>
<versionRange>
[2.1,)
</versionRange>
<goals>
<goal>unpack</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore />
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</profile>

当我运行以下命令时:

mvn clean package -P local

项目已成功构建,但是,WebService.wsdl 被复制到 target/wsdl 文件夹中,而不是生成的 jar 文件中,我仍然看到其他环境文件而不仅仅是 WebService.wsdl。在构建过程中,我注意到 jar 文件是在复制环境文件之前生成的,如何才能使其在生成 jar 文件之前复制?

最佳答案

将您的插件绑定(bind)到早期阶段,而不是包,而是它之前的任何内容。

关于java - Maven 的配置文件问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57290311/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com