因此,我认为您的问题的答案是:“不,实际上没有一种方法可以避免将可执行文件的路径传递给插件。”
我能建议的最接近的是这样的:
在您的pom.xml中:
<build> <plugins> <plugin> <groupId>org.apache.thrift.tools</groupId> <artifactId>maven-thrift-plugin</artifactId> <version>0.1.11</version> <configuration> <thriftExecutable>${myProps.thriftExec}</thriftExecutable> <thriftSourceRoot>../thrift-files</thriftSourceRoot> <generator>java</generator> </configuration> <executions> <execution> <id>thrift-sources</id> <phase>generate-sources</phase> <goals> <goal>compile</goal> </goals> </execution> </executions> </plugin> </plugins></build>然后,在构建用户的中
~/.m2/settings.xml:
<profiles> <profile> <id>thrift-build</id> <properties> <myProps.thriftExec>D:/work/thrift-folder/thrift-0.11.0.exe</myProps.thriftExec> </properties> </profile></profiles>
现在,您可以签入pom.xml,它中没有任何特定于计算机的路径。为了执行构建,
myProps.thriftExec需要定义属性,因此每个开发人员/构建者都需要在自己的机器上安装thrift并为自己定义该属性。这样一来,Mac或Linux主机就不会因为试图找到Windows卷等而卡住。
请参阅Maven文档,以获取有关配置文件及其使用方便的更多详细信息。



