gpt4 book ai didi

java - maven:从生成的源创建一个 jar 并在编译之前将其添加为依赖项

转载 作者:行者123 更新时间:2023-11-29 08:56:30 24 4
gpt4 key购买 nike

我想包含一个 jar 文件而不是添加源。最终结果就像添加依赖项,我的 war 文件在 WEB-INF/lib 中获得一个额外的 jar,而不是在 WEB-INF/classes 中获得额外的类。

        <plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.8</version>
<configuration>
<sources>
<source>target/generated-sources/wsimport</source>
</sources>
</configuration>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
</execution>
</executions>
</plugin>

我在想:

第 1 步)生成源

第 2 步)从 target/generated-sources/wsimport 生成一个 jar 文件

步骤 3) 在编译之前将其安装到本地存储库 (mvn install:install-file -Dfile=MyWsImport.jar)

第四步)添加MyWsImport.jar依赖

第五步)编译

最佳答案

正如 Peter Butkovic 在上面提到的那样,使用模块是可行的。

https://github.com/gertcuykens/gcl-11

<?xml version="1.0" encoding="UTF-8"?>
<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>com.google.appengine.gcl</groupId>
<artifactId>gcl-11</artifactId>
<version>0.0-SNAPSHOT</version>
<packaging>pom</packaging>

<modules>
<module>rs</module>
<module>ws</module>
</modules>

</project>

关于java - maven:从生成的源创建一个 jar 并在编译之前将其添加为依赖项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20079834/

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