Eclipse plugin 使用指向本地p2存储库的tycho构建本地eclipse插件

Eclipse plugin 使用指向本地p2存储库的tycho构建本地eclipse插件,eclipse-plugin,tycho,Eclipse Plugin,Tycho,我正在创建一些需要第三方插件和特性的Eclipse插件和特性。为了将这些依赖项包含到我的项目中,我创建了一个p2布局存储库 注意:我的p2工件不是Maven项目。。。然而,我使用的是Maven风格的建筑。以下是p2存储库的pom.xml <properties> <tycho-version>0.18.0</tycho-version> </properties> <repositories> <

我正在创建一些需要第三方插件和特性的Eclipse插件和特性。为了将这些依赖项包含到我的项目中,我创建了一个p2布局存储库

注意:我的p2工件不是Maven项目。。。然而,我使用的是Maven风格的建筑。以下是p2存储库的pom.xml

<properties>
    <tycho-version>0.18.0</tycho-version>
  </properties>

  <repositories>
        <repository>
                <id>eclipse-platform-m6</id>
                <layout>p2</layout>
                <url>http://download.eclipse.org/eclipse/updates/3.8</url>
        </repository>
  </repositories>

  <build>
    <plugins>
        <plugin>
            <groupId>org.eclipse.tycho.extras</groupId>
            <artifactId>tycho-p2-extras-plugin</artifactId>
            <version>${tycho-version}</version>
            <executions>
                <execution>
                    <phase>prepare-package</phase>
                    <goals>
                        <goal>publish-features-and-bundles</goal>
                    </goals>
                    <configuration>
                        <compress>false</compress>
                        <artifactRepositoryLocation>/mypath/target/repository</artifactRepositoryLocation>
                        <metadataRepositoryLocation>/mypath/target/repository</metadataRepositoryLocation>
                        <sourceLocation>/mypath/src</sourceLocation>
                    </configuration>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <groupId>org.eclipse.tycho</groupId>
            <artifactId>tycho-p2-repository-plugin</artifactId>
            <version>${tycho-version}</version>
            <configuration>
            </configuration>
            <executions>
                <execution>
                    <phase>package</phase>
                    <goals>
                        <goal>verify-repository</goal>
                        <goal>archive-repository</goal>
                    </goals>
                    <configuration>
                        <compress>false</compress>
                        <includeAllDependencies>true</includeAllDependencies>
                    </configuration>
                </execution>
            </executions>
        </plugin>
        <plugin>  
          <groupId>org.eclipse.tycho</groupId>
          <artifactId>tycho-p2-publisher-plugin</artifactId>
          <version>${tycho-version}</version>
          <configuration>
            <publishArtifacts>true</publishArtifacts>
          </configuration>
        </plugin>
        <plugin><!-- enable the Tycho build extension -->
            <groupId>org.eclipse.tycho</groupId>
            <artifactId>tycho-maven-plugin</artifactId>
            <version>${tycho-version}</version>
            <extensions>true</extensions>
        </plugin>   
    </plugins>
  </build>
现在,我使用Tycho构建插件和功能,并参考上面创建的p2存储库。我的插件和特性有以下项目结构

- bundle.parent
  - bundle.mainplugin
  - bundle.mainplugin.test.fragment 
  - bundle.mainplugin.feature
这是我的bundle.parent pom.xml

<repositories>
        <repository>
                <id>eclipse-platform-m6</id>
                <layout>p2</layout>
                <url>http://download.eclipse.org/eclipse/updates/3.8</url>
        </repository>
        <repository>
                <id>third-party-eclipse-plugins</id>
                <layout>p2</layout>
                <url>file:///.../target/repository</url>
         </repository>
  </repositories>
  <modules>
    <module>../bundle.mainplugin</module>
    <module>../bundle.mainplugin.test.fragment</module>
    <module>../bundle.mainplugin.feature</module>
  </modules>
  <build>
  <plugins>
    <plugin>
      <groupId>org.eclipse.tycho</groupId>
      <artifactId>tycho-maven-plugin</artifactId>
      <version>${tycho-version}</version>
      <extensions>true</extensions>
    </plugin>
  </plugins>
</build>
我的问题:

从编译器错误来看,我相信Tycho在某种程度上没有使这些第三方工件可用于存在编译器错误的类。有没有办法确定我的插件类是否存在于Tycho类路径中

更新

检查了第三方捆绑包的可用性,我希望从

所有第三方捆绑包均已成功显示。

只需更换:

<url>file:///.../target/repository</url>
file:///.../target/repository
作者:

文件:/deploy/target/repository

(如果您的父文件夹pom.xml是您的根文件夹)

对于遇到此问题的任何人,您也可以尝试使用:

${project.basedir}
因此,假设您有以下目录:

- projects:
    - main-project
    - local-repository
在父pom(即:main project/pom.xml)中,使用相对路径以以下方式引用本地存储库:

<url>file:${project.basedir}/target/repository</url>
文件:${project.basedir}/target/repository

塞巴斯蒂安·扎尔内科夫的回答给了我一个提示

从错误消息可以推断,maven无法通过注入创建语言模型。上面的链接解释了原因:

Xtext使用EMF的平台:/ResourceURI方案

解决方案是您需要为EMFGenerator提供一个新的声明,说明模型目录应该在哪里。在**.mwe2文件中,替换以下代码

fragment = ecore.EMFGeneratorFragment auto-inject {}


应该能做到这一点。

file:///.../target/repository
URL不起作用。一个解决方案可以是劳伦斯的回答或。我不知道你是怎么进入编译步骤的。我假设依赖项解析已经失败了。我已退出该项目,无法再访问代码来测试解决方案。谢谢您的评论。我已离开我工作的项目,无法尝试您的建议。文件:${project.basedir}在Windows系统上生成无效的URL。请改用${project.baseUri}。或者在Linux中尝试
文件:${user.home}/somewhere/target/repository
,以防您的p2 repo不在项目的子目录中。这刚刚节省了我的时间!!Tycho/Maven/Xtext构建非常混乱,谢谢你的技巧。
${project.basedir}
- projects:
    - main-project
    - local-repository
<url>file:${project.basedir}/target/repository</url>
fragment = ecore.EMFGeneratorFragment auto-inject {}
fragment = ecore.EMFGeneratorFragment auto-inject {
    javaModelDirectory = "/${projectName}/src-gen"
}