gpt4 book ai didi

java - Maven-ejb-插件。如何从生成的客户端中排除 Artifact ?

转载 作者:行者123 更新时间:2023-11-29 09:02:09 25 4
gpt4 key购买 nike

我有一个 EJB maven 模块。它与编译范围有一些依赖关系。我如何从生成的客户端中排除这种依赖关系?

<dependencies>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.2</version>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ejb-plugin</artifactId>
<version>2.3</version>
<configuration>
<generateClient>true</generateClient>
</configuration>
</plugin>
</plugins>
</build>

最佳答案

你可以使用这样的东西来排除传递依赖:

<project>
...
<dependencies>
<dependency>
<groupId>sample.ProjectA</groupId>
<artifactId>Project-A</artifactId>
<version>1.0</version>
<scope>compile</scope>
<exclusions>
<exclusion> <!-- declare the exclusion here -->
<groupId>sample.ProjectB</groupId>
<artifactId>Project-B</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</project>

如果您有这样的依赖项,您不希望将其打包到您的 EJB 模块(通常是一个 jar 文件)中:

<project>
...
<dependencies>
<dependency>
<groupId>sample.ProjectA</groupId>
<artifactId>Project-A</artifactId>
<version>1.0</version>
</dependency>
</dependencies>

定义 scope of the dependency as provided like this 可能会有用:

<project>
...
<dependencies>
<dependency>
<groupId>sample.ProjectA</groupId>
<artifactId>Project-A</artifactId>
<version>1.0</version>
<scope>provided</scope>
</dependency>
</dependencies>

更新:也许您可以尝试使用可选标志:

<project>
...
<dependencies>
<dependency>
<groupId>sample.ProjectA</groupId>
<artifactId>Project-A</artifactId>
<version>1.0</version>
<scope>compile</scope>
<optional>true</optional>
</dependency>
</dependencies>

关于java - Maven-ejb-插件。如何从生成的客户端中排除 Artifact ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16706709/

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