在我的 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 以包含自定义条目的一般问题,因为我们有更多的地方想要添加自定义的东西。