栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

如何将Thrift生成器用作Maven依赖项(如何避免引用.exe文件)?

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

如何将Thrift生成器用作Maven依赖项(如何避免引用.exe文件)?

因此,我认为您的问题的答案是:“不,实际上没有一种方法可以避免将可执行文件的路径传递给插件。”

我能建议的最接近的是这样的:

在您的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文档,以获取有关配置文件及其使用方便的更多详细信息。



转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/496473.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号