gpt4 book ai didi

maven-2 - Maven 将 src/main/resources/services 文件夹复制到/META-INF

转载 作者:行者123 更新时间:2023-12-05 08:35:08 25 4
gpt4 key购买 nike

编辑

好的,我现在可以更具体一些:

我的 scr/main/resources 中有一个文件夹 META-INF,其中包含 services/javax.annotation.processing.Processor

我的 pom 还是一样(有注释)。如果我执行“mvn clean install”,输出 jar 将只包含 META-INF 文件夹。

但是如果我重命名文件夹 services,输出 jar 包含我的类和 META-INF 文件夹以及新重命名的文件夹及其内容。


我有 - 我想 - 对于普通 maven2 用户来说是一个简单的问题。我有一个简单的子项目的简单 pom

<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>aida</groupId>
<version>0.0.1-SNAPSHOT</version>
<artifactId>aida-annotationProcessors</artifactId>
<packaging>jar</packaging>
<name>AIDA Annotation Processors</name>


<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
<!-- <resources> -->
<!-- <resource> -->
<!-- <directory>src/main/resources/services</directory> -->
<!-- <targetPath>META-INF/services</targetPath> -->
<!-- </resource> -->
<!-- </resources> -->
</build>

<dependencies>
</dependencies>

</project>

我的目标很简单:我只想将我的 src/main/resources/services/javax.annotation.processing.Processor 文件复制到我生成的 jar 的 {root}/META-INF/services 文件夹中。

但是如果我取消注释资源部分,我的 jar 将只包含一个没有类的 META-INF 文件夹!

你能帮帮我吗?

最佳答案

这是 Maven 编译器插件中的错误/功能。

http://jira.codehaus.org/browse/MCOMPILER-97

解决方法是为包含处理器的项目禁用注释处理,-proc:none。

关于maven-2 - Maven 将 src/main/resources/services 文件夹复制到/META-INF,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10320078/

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