Tycho 中使用target platform做为编译设置

在使用Tycho编译Eclips plugin项目时,需要制定Eclipse IDE的相关依赖配置,通常使用的都是配置一个repository在pom.xml中,如下:

 <properties>
  <eclipse-repo.url>http://download.eclipse.org/releases/latest</eclipse-repo.url>
 </properties>
 
 <repositories>
  <repository>
   <id>eclipse-release</id>
   <url>${eclipse-repo.url}</url>
   <layout>p2</layout>
  </repository>
 </repositories>

下面为大家介绍另一种使用target platform作为编译配置的设置方法。

1. 创建target platform文件

参考https://blog.csdn.net/devin_xin/article/details/104898574
这里需要注意的是:target 文件的名字一定要和其所在的项目的artifact id相同且以.target结尾。

2.为target文件所在的项目创建pom.xml文件

<project>
    <modelVersion>4.0.0</modelVersion>
    
    <groupId>com.devinxin.example.tycho</groupId>
    <artifactId>target-platform</artifactId>
    <version>1.0.0-SNAPSHOT</version>
    <packaging>eclipse-target-definition</packaging>
</project>

3.更显aggregator pom和configuration相关内容

<project>
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.devinxin.example.tycho</groupId>
    <artifactId>com.devinxin.example.parent</artifactId>
    <version>1.0.0-SNAPSHOT</version>
    <packaging>pom</packaging>
    <modules>
        ...
        <module>target-platform</module>
    </modules>
  ...
  <!-- 注释掉以前的方式
  <properties>
  <eclipse-repo.url>http://download.eclipse.org/releases/latest</eclipse-repo.url>
 </properties>
 
 <repositories>
  <repository>
   <id>eclipse-release</id>
   <url>${eclipse-repo.url}</url>
   <layout>p2</layout>
  </repository>
 </repositories>
</project>
-->

<build>
  <plugins>
   <plugin>
    <groupId>org.eclipse.tycho</groupId>
    <artifactId>tycho-maven-plugin</artifactId>
    <version>${tycho.version}</version>
    <extensions>true</extensions>
   </plugin>

   <plugin>
    <groupId>org.eclipse.tycho</groupId>
    <artifactId>target-platform-configuration</artifactId>
    <version>${tycho.version}</version>
    <configuration>
     <!--enable to use target platform -->
     <target> 
        <artifact>
            <groupId>com.devinxin.example.tycho</groupId>
            <artifactId>target-platform</artifactId>
            <version>1.0.0-SNAPSHOT</version>
        </artifact>
    </target>

     <environments>
      <environment>
       <os>linux</os>
       <ws>gtk</ws>
       <arch>x86_64</arch>
      </environment>
      <environment>
       <os>win32</os>
       <ws>win32</ws>
       <arch>x86_64</arch>
      </environment>
      <environment>
       <os>macosx</os>
       <ws>cocoa</ws>
       <arch>x86_64</arch>
      </environment>
     </environments>
    </configuration>
   </plugin>
  </plugins>
 </build>
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值