【问题标题】:Lib folder gets packaged with eclipse plugin jar while building through tycho通过 tycho 构建时,Lib 文件夹与 eclipse 插件 jar 一起打包
【发布时间】:2018-05-04 13:04:27
【问题描述】:

我正在尝试使用来自 maven 的 tycho-compiler-plugin 构建 eclipse 插件。 我已经从 p2 repo 解决了许多捆绑的依赖项。我有一些 jar 依赖项存在于 manifest.mf 的 bundle-classpath 中 -

  Bundle-ClassPath: .,
    lib/test1.jar,
    lib/test2.jar

这些 jars 存在于 lib 文件夹中,该文件夹位于根级别,即 pom 所在的位置。

POM 文件看起来像 -

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.test</groupId>
    <artifactId>com.test.plugin</artifactId>  
    <version>0.0.0</version>
    <packaging>eclipse-plugin</packaging>

    <repositories>
      <repository>
         <id>Mars</id>
         <layout>p2</layout>
         <url>file:///E:/repo/eclipseRepo/</url>
      </repository>
   </repositories>
   <build>
      <directory>../../../../target</directory>
      <sourceDirectory>src</sourceDirectory>
      <plugins>
         <plugin>
            <groupId>org.eclipse.tycho</groupId>
            <artifactId>tycho-maven-plugin</artifactId>
            <version>0.25.0</version>
            <extensions>true</extensions>
         </plugin>
         <plugin>
            <groupId>org.eclipse.tycho</groupId>
            <artifactId>tycho-compiler-plugin</artifactId>
            <version>0.25.0</version>
        </plugin>
        <plugin>
           <groupId>org.eclipse.tycho</groupId>
           <artifactId>tycho-packaging-plugin</artifactId>
           <version>0.25.0</version>
           <configuration>
              <buildDirectory>../../../../plugin</buildDirectory>
           </configuration>
        </plugin>
     </plugins>
  </build>
</project>

现在 ti 可以正确构建 eclipse 插件,但在打包时还包含 lib 文件夹。附加的罐子截图 - 我想从 jar 中排除这个 lib 文件夹。我已经尝试在 tycho-packaging-jar 插件中进行配置以排除它。但不工作。如何排除?

【问题讨论】:

    标签: maven eclipse-plugin tycho p2


    【解决方案1】:

    在当前项目的基本目录之外使用&lt;directory&gt;&lt;buildDirectory&gt; 看起来很不标准。事实上,我从来不需要显式配置其中任何一个——或者&lt;sourceDirectory&gt;,就此而言。这就是 build.properties 文件的用途,这是在 Eclipse PDE 和 Tycho 中配置这些东西的默认方式。

    从屏幕截图看来,没有build.properties 文件存在。我建议您通过its properties 而不是通过 POM 元素配置各个位置。类似于 this example 的东西,bin.includesbin.excludes 处理你的 JAR 包含。

    【讨论】:

    • 谢谢。编辑 build.properties 解决了这个问题。
    猜你喜欢
    • 2014-10-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-01-21
    • 2012-01-26
    • 1970-01-01
    • 2017-10-04
    • 1970-01-01
    相关资源
    最近更新 更多