在我的 pom.xml 中,我配置了一个插件来将某些 Protobuf 文件转换为 Java 类文件。它看起来像这样:
<plugin>
<groupId>com.github.igor-petruk.protobuf</groupId>
<artifactId>protobuf-maven-plugin</artifactId>
<version>0.5.3-SNAPSHOT</version>
<executions>
<execution>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
<configuration>
<protocCommand>${basedir}/protoc/bin/protoc</protocCommand>
<inputDirectories>
<inputDirectory>proto</inputDirectory>
</inputDirectories>
</configuration>
</plugin>
从此 Maven 生成具有以下条目的 .classpath
文件:
<classpathentry kind="src" output="target/classes" path="target/generated-sources/protobuf">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
我现在希望 Maven 做的是向该类路径条目添加一个额外的“属性”条目,以便该条目看起来像这样:
<classpathentry kind="src" output="target/classes" path="target/generated-sources/protobuf">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="ignore_optional_problems" value="true"/>
</attributes>
</classpathentry>
这样我就不会从该部分代码中收到警告。
目前我只是不知道该怎么做。我必须编辑哪些文件或其他设置?我可以在 Eclipse 的哪个位置执行此操作?
但这或多或少是关于如何修改 Maven 以包含自定义条目的一般性问题,因为我们有更多的地方想要添加自定义内容。
最佳答案
Login and vote for this Feature-Request:
已有补丁,完善一下
关于java - 如何向 Maven 插件添加特定配置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19407624/