2013-08-01 2 views
4

제 3 자 플러그인 및 기능이 필요한 Eclipse 플러그인 및 기능을 작성 중입니다. 이러한 의존성을 내 프로젝트에 포함시키기 위해 필자는 p2 레이아웃 리포지토리를 만들었습니다.로컬 p2 저장소를 가리키는 tycho를 사용하여 로컬 이클립스 플러그인을 빌드하십시오.

참고 : 내 p2 아티팩트는 Maven 프로젝트가 아닙니다 ... 그러나 Maven 스타일의 건물을 사용하고 있습니다. 여기서 상기 성공적 빌드 P2 저장소

<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> 

용의 pom.xml이고, P2 및 저장소를 생성 (및 검증한다). 나는 이제 프로젝트

- Project 
    .. 
    .. 
    - target 
     - p2agent 
     - org.eclipse.equinox.p2.core 
     - org.eclipse.equinox.p2.engine 
     - repository 
     - features 
     - plugins 
      artifacts.xml 
      content.xml 
     <projectname>-<version>.zip <!-- This contains same things as repository directory here --> 

target/ 디렉토리 구조를 다음 얻을, 나는 내 플러그인과 기능을 구축하기위한 티코를 사용하고 내가 위에서 만든 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> 

, 나는 부모의 pom.xml에 목표 mvn clean install 실행. 아쉽게도 mvn-compile은 플러그인의 클래스가 플러그인의 일부 클래스를 확장 할 때 컴파일 문제를 발생시킵니다. (클래스는 런타임에도 필요합니다.) 여기에 오류가 :

org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.eclipse.tycho:tycho-compiler-plugin:0.18.0:compile (default-compile 
) on project <Project Name>: Compilation failure 
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:213) 
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) 
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) 
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84) 
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59) 
    at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183) 
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161) 
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320) 
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156) 
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537) 
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196) 
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:141) 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 
    at java.lang.reflect.Method.invoke(Method.java:597) 
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290) 
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230) 
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409) 
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352) 
Caused by: copied.org.apache.maven.plugin.CompilationFailureException: Compilation failure 
    at copied.org.apache.maven.plugin.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:442) 
    at org.eclipse.tycho.compiler.AbstractOsgiCompilerMojo.execute(AbstractOsgiCompilerMojo.java:239) 
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101) 
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209) 
    ... 19 more 

내 질문 : 컴파일러 오류에서

, 나는 티코 어떻게 든 컴파일러 오류가있는 내 수업에 사용할 수 이러한 타사의 유물을하지 않습니다 믿습니다. 내 플러그인 클래스가 Tycho 클래스 경로에 있는지 확인하는 방법이 있습니까?

UPDATE는

내가 this location

java -jar /home/.../eclipse-3.8.2/plugins/org.eclipse.equinox.launcher_1.3.0.v20120522-1813.jar -debug -consolelog -application org.eclipse.equinox.p2.director -repository file:///home/../target/repository -list 

모든 타사 번들에서 티코 반응기에서 사용할 수있게하려면 타사 번들의 검사 여부는 성공적으로 보여 주었다.

+0

'file : ///.../ target/repository' URL이 작동하지 않습니다. 해결 방법은 Laurents 답 또는 [이 다른 질문] (http://stackoverflow.com/questions/4344961/tool-for-managing-hosting-own-p2-repositories)이 될 수 있습니다. 어떻게 컴파일 단계에 도달해야할지 모르겠다. 종속성 분석이 이미 실패했다고 가정합니다. – oberlies

+0

나는 그 프로젝트를 끝냈고 코드를 더 이상 읽을 수 없으므로 해결책을 찾으려고한다. – Vikram

답변

0

그냥 교체 :

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

기준 :

<url>file:<projectname>/deploy/target/repository</url> 

또한, 당신이 할 수있는이 문제에 실행하는 사람을위한

+0

귀하의 의견에 감사드립니다. 나는 일하는 프로젝트에서 벗어 났고 당신의 제안을 시도 할 수 없다. – Vikram

1

(부모의 pom.xml 파일은 루트 폴더 인 경우) 사용해보십시오.

${project.basedir} 

그래서, 당신은 다음 디렉토리가 있다고 가정 :

부모 치어에서
- projects: 
    - main-project 
    - local-repository 

(즉 : 주요 프로젝트/치어를.xml)은 다음과 같은 방법으로 상대 경로를 사용하여 로컬 저장소를 참조합니다.

<url>file:${project.basedir}/target/repository</url> 
+1

파일 : $ {project.basedir}은 Windows 시스템에서 유효하지 않은 URL을 생성합니다. 대신 $ {project.baseUri}을 사용하십시오. – oberlies

+0

또는 p2 repo가 ​​프로젝트의 하위 디렉토리에없는 경우' 파일 ($ {user.home}/somewhere/target/repository')을 사용해보십시오. –

3

세바스찬 Zarnekow의 대답은 나에게 힌트를주었습니다.

Error while building an xtext project with ant: Generation of the Grammar classes fails

오류 메시지에서 유추 할 수 있듯이

은 받는다는 주입에서 언어 모델을 만드는 데 실패합니다. 그 이유는 위 링크에서 설명합니다 :

Xtext uses the platform:/resource URI scheme of EMF.

해결 방법은 모델 디렉토리가 있어야하는 위치에 대한 새로운 선언을 EMFGenerator에 제공해야합니다. **. mwe2 파일에서 트릭을 할해야

fragment = ecore.EMFGeneratorFragment auto-inject { 
    javaModelDirectory = "/${projectName}/src-gen" 
} 

에 다음 코드

fragment = ecore.EMFGeneratorFragment auto-inject {} 

를 교체합니다.

+0

이것은 단지 나의 밤을 구했다! Tycho/Maven/Xtext 건물이 혼란 스럽습니다. 트릭을 주셔서 감사합니다. –