将本地p2存储库与必要的jar文件一起使用时,项目依赖性错误

时间:2014-10-30 07:36:59

标签: eclipse-plugin tycho

我已经创建了一个eclipse插件,我需要将eclipse插件项目转换为maven,以便在Tycho的帮助下将其转换为maven。当我尝试执行eclipse应用程序时它工作正常。但是当我试着把它清理干净。

[INFO] Scanning for projects...
[INFO] Cannot complete the request.  Generating details.
[INFO] Cannot complete the request.  Generating details.
[INFO] {osgi.ws=gtk, osgi.os=linux, osgi.arch=x86, org.eclipse.update.install.features=true}
[ERROR] Cannot resolve project dependencies:
[ERROR]   Software being installed: xxx 1.0.0.qualifier
[ERROR]   Missing requirement: xxx 1.0.0.qualifier requires 'bundle       
org.eclipse.ui 0.0.0' but it could not be found
[ERROR] 
[ERROR] Internal error: java.lang.RuntimeException: No solution found because the problem is      
unsatisfiable.: [Unable to satisfy dependency from xxx 1.0.0.qualifier to 
bundle org.eclipse.ui 0.0.0.; Unable to satisfy dependency from xxx
1.0.0.qualifier to bundle org.eclipse.core.runtime 0.0.0.; Unable to satisfy dependency from 
xxx 1.0.0.qualifier to bundle org.eclipse.jdt.core 3.9.2.; Unable to satisfy 
dependency from xxx 1.0.0.qualifier to bundle org.eclipse.core.resources 
3.8.101.;     Unable to satisfy dependency from xxx 1.0.0.qualifier to bundle 
org.eclipse.jdt.ui 3.9.2.; Unable to satisfy dependency from xxx
1.0.0.qualifier to bundle org.eclipse.ui.console 3.5.200.; Unable to satisfy dependency from 
xxx 1.0.0.qualifier to bundle org.eclipse.ui.editors 3.8.100.; Unable to 
satisfy dependency from xxx 1.0.0.qualifier to bundle 
com.test.dependency.bundles 1.0.0.; Unable to satisfy dependency from xxx   
1.0.0.qualifier to package org.eclipse.jface.text 0.0.0.; Unable to satisfy dependency from test-
automation-plugin 1.0.0.qualifier to package org.eclipse.jface.text.presentation 0.0.0.; Unable 
to satisfy dependency from txxx 1.0.0.qualifier to package org.eclipse.jface.text.rules 0.0.0.; 
Unable to satisfy dependency from xxx 1.0.0.qualifier to package org.eclipse.jface.text.source 
0.0.0.; No solution found because the problem is unsatisfiable.] -> [Help 1]
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:168)
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(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
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: java.lang.RuntimeException: No solution found because the problem is unsatisfiable.:  
[Unable to satisfy dependency from xxx 1.0.0.qualifier to bundle org.eclipse.ui 0.0.0.; Unable to 
satisfy dependency from xxx 1.0.0.qualifier to bundle org.eclipse.core.runtime 0.0.0.; Unable to 
satisfy dependency from xxx 1.0.0.qualifier to bundle org.eclipse.jdt.core 3.9.2.; Unable to 
satisfy dependency from xxx 1.0.0.qualifier to bundle org.eclipse.core.resources 3.8.101.; 

我的pom.xml文件:

 <?xml version="1.0" encoding="UTF-8"?>
    <project>
     <modelVersion>4.0.0</modelVersion>
     <groupId>xxx</groupId>
     <artifactId>parent</artifactId>
     <version>1.0.0-SNAPSHOT</version>
     <packaging>pom</packaging>
     <modules>
     <module>../xxx</module>
      </modules>

     <properties>
      <tycho.version>0.19.0</tycho.version>
      <tycho-extras.version>0.19.0</tycho-extras.version>
      <kepler-repo.url>http://download.eclipse.org/releases/kepler</kepler-repo.url>    
     </properties> 

     <repository>
         <id>third-party-eclipse-plugins</id>
         <layout>p2</layout>
         <url>${project.baseUri}dependency/p2-repo</url>    
     </repository> 
   <pluginRepositories>
    <pluginRepository>
        <id>tycho</id>
        <url>${tycho-repo.url}</url>
        <releases>
            <enabled>false</enabled>
        </releases>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
    </pluginRepository>
</pluginRepositories>



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

     <pomDependencies>consider</pomDependencies>
      <environments>
        <environment>
          <os>linux</os>
          <ws>gtk</ws>
          <arch>x86</arch>
        </environment>
        <environment>
          <os>linux</os>
          <ws>gtk</ws>
          <arch>x86_64</arch>
        </environment>
        <environment>
          <os>win32</os>
          <ws>win32</ws>
          <arch>x86</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>

  <plugin>
            <groupId>org.eclipse.tycho</groupId>
            <artifactId>tycho-source-plugin</artifactId>
            <executions>
                <execution>
                    <id>plugin-source</id>
                    <goals>
                        <goal>plugin-source</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
</plugins>

<pluginManagement>
        <plugins>

            <plugin>
                <groupId>org.eclipse.tycho</groupId>
                <artifactId>target-platform-configuration</artifactId>
                <version>${tycho.version}</version>
            </plugin>

            <plugin>
                <groupId>org.eclipse.tycho</groupId>
                <artifactId>tycho-compiler-plugin</artifactId>
                <version>${tycho.version}</version>



                <configuration>
                    <compilerArguments>
                        <inlineJSR />
                        <enableJavadoc />
                        <encoding>ISO-8859-1</encoding>
                    </compilerArguments>
                </configuration>

            </plugin>

            <plugin>
                <groupId>org.eclipse.tycho</groupId>
               <artifactId>tycho-packaging-plugin</artifactId>
                <version>${tycho.version}</version>


      <configuration>
        <strictBinIncludes>false</strictBinIncludes>
        <format>'v'yyyyMMdd-HHmm</format>
        <timestampProvider>jgit</timestampProvider>
        <jgit.ignore>
          pom.xml
        </jgit.ignore>
        <jgit.dirtyWorkingTree>${jgit.dirtyWorkingTree}</jgit.dirtyWorkingTree>
        <sourceReferences>
          <generate>true</generate>
        </sourceReferences>
        <archive>
          <addMavenDescriptor>false</addMavenDescriptor>
        </archive>
        <additionalFileSets>
          <fileSet>
            <directory>${project.build.directory}</directory>
            <includes>
              <include>.api_description</include>
            </includes>
          </fileSet>
        </additionalFileSets>
      </configuration>
      </plugin>



            <plugin>
                <groupId>org.eclipse.tycho</groupId>
                <artifactId>tycho-surefire-plugin</artifactId>
                <version>${tycho.version}</version>
            </plugin>

            <plugin>
                <groupId>org.eclipse.tycho</groupId>
                <artifactId>tycho-source-plugin</artifactId>
                <version>${tycho.version}</version>
                <configuration>
                    <strictSrcIncludes>false</strictSrcIncludes>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.eclipse.tycho</groupId>
                <artifactId>tycho-p2-director-plugin</artifactId>
                <version>${tycho.version}</version>
            </plugin>


            <!-- dependency  compromise of local plugin repository   -->



            <plugin>
                <groupId>org.eclipse.tycho</groupId>
                <artifactId>tycho-p2-repository-plugin</artifactId>
                <version>${tycho.version}</version>
                <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>
                <groupId>org.eclipse.tycho.extras</groupId>
                <artifactId>tycho-source-feature-plugin</artifactId>
                <version>${tycho-extras.version}</version>
            </plugin>



            <plugin>
                <groupId>org.eclipse.tycho.extras</groupId>
                <artifactId>tycho-custom-bundle-plugin</artifactId>
                <version>${tycho-extras.version}</version>
            </plugin>

            <plugin>
                <groupId>org.eclipse.tycho</groupId>
                <artifactId>tycho-p2-plugin</artifactId>
                <version>${tycho.version}</version>
                <configuration>
                    <baselineMode>warn</baselineMode>
                    <baselineReplace>none</baselineReplace>
                    <baselineRepositories>
                        <repository>
                            <url>http://download.eclipse.org/eclipse/updates/4.2</url>
                        </repository>
                    </baselineRepositories>
                </configuration>
            </plugin>




            <!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
            <plugin>
                <groupId>org.eclipse.m2e</groupId>
                <artifactId>lifecycle-mapping</artifactId>
                <version>1.0.0</version>
                <configuration>
                    <lifecycleMappingMetadata>
                        <pluginExecutions>


                              <pluginExecution>
                                  <pluginExecutionFilter>
                                  <groupId>org.eclipse.tycho</groupId>
                                    <artifactId>tycho-compiler-plugin</artifactId>
                                     <versionRange>0.19.0</versionRange>
                                        <goals>
                                            <goal>compile</goal>
                                         </goals>
                                      </pluginExecutionFilter>
                                           <action>
                                            <ignore/>
                                            </action>
                                 </pluginExecution>


                            <pluginExecution>
                                <pluginExecutionFilter>
                                    <groupId>
                                        org.eclipse.tycho
                                    </groupId>
                                    <artifactId>
                                        tycho-packaging-plugin
                                    </artifactId>
                                    <versionRange>
                                        [0.19.0,)
                                    </versionRange>
                                    <goals>
                                        <goal>build-qualifier</goal>
                                        <goal>validate-version</goal>
                                        <goal>validate-id</goal>

                                    </goals>
                                </pluginExecutionFilter>
                                <action>
                                    <ignore></ignore>
                                </action>
                            </pluginExecution>
                        </pluginExecutions>
                    </lifecycleMappingMetadata>
                </configuration>
            </plugin>
        </plugins>
    </pluginManagement>

</build>

我用Google搜索并且无法缩小它的原因。我已经通过Tycho cannot resolve dependency to bundle although present in the target file但我无法得到解决方案。我不熟悉这个tycho.please建议一些解决方案如何能够将这些依赖项添加到tycho?

我本地存储库中的

content.xml文件:

  <?xml version='1.0' encoding='UTF-8'?>
 <?metadataRepository version='1.1.0'?>
 <repository name='file:/C:/p2-repo/ - metadata'     
 type='org.eclipse.equinox.internal.p2.metadata.repository.LocalMetadataRepository' version='1'>
 <properties size='2'>
  <property name='p2.timestamp' value='1414673338570'/>
  <property name='p2.compressed' value='true'/>
  </properties>
 </repository>

artifacts.xml:

 <?xml version='1.0' encoding='UTF-8'?>
 <?artifactRepository version='1.1.0'?>
 <repository name='file:/C:/p2-repo/ - artifacts'     
  type='org.eclipse.equinox.p2.artifact.repository.simpleRepository' version='1'>
  <properties size='2'>
   <property name='p2.timestamp' value='1414673338667'/>
   <property name='p2.compressed' value='true'/>
  </properties>
  <mappings size='3'>
  <rule filter='(&amp; (classifier=osgi.bundle))'     
   output='${repoUrl}/plugins/${id}_${version}.jar'/>
   <rule filter='(&amp; (classifier=binary))' output='${repoUrl}/binary/${id}_${version}'/>
   <rule filter='(&amp; (classifier=org.eclipse.update.feature))'    
   output='${repoUrl}/features/${id}_${version}.jar'/>
  </mappings>
  <artifacts size='0'/>
 </repository>

2 个答案:

答案 0 :(得分:1)

您已为Kepler存储库位置指定了属性,但您尚未告知Tycho使用它。尝试将以下内容添加到您的pom.xml:

<repositories>
    <repository>
        <id>eclipse-kepler</id>
        <layout>p2</layout>
        <url>${kepler-repo.url}</url>
    </repository>
</repositories>

要创建自己的Eclipse p2存储库,首先下载所需的eclipse版本(http://www.eclipse.org/downloads/)并将其解压缩到本地文件夹(对于此示例,请说“/ myfolder”)。在“myfolder”里面你应该有一个“eclipse”文件夹,然后在“plugins”和“features”文件夹下加上各种其他文件和文件夹。

使用以下命令创建P2存储库:

/myfolder/eclipse.exe -consolelog -nosplash -application org.eclipse.equinox.p2.publisher.FeaturesAndBundlesPublisher -metadataRepository file:/myfolder/p2-repo/ -artifactRepository file:/myfolder/p2-repo/ -source /myfolder/eclipse -publishArtifacts

答案 1 :(得分:0)

解决有关缺少依赖项的问题:

[ERROR]   Software being installed: xxx 1.0.0.qualifier
[ERROR]   Missing requirement: xxx 1.0.0.qualifier requires 'bundle       
          org.eclipse.ui 0.0.0' but it could not be found

似乎是您的功能/插件&#34; xxx&#34;需要在安装之前下载org.eclipse.ui插件。

您应该从配置中检查您的设置,如下所示:

 <properties>
  <tycho.version>0.25.0</tycho.version>
  <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  <repository.url>http://download.eclipse.org/releases/neon</repository.url>
 </properties>

 <repositories>
  <repository>
   <id>NeonRepository</id>
   <url>${repository.url}</url>
   <layout>p2</layout>
  </repository>

如果您已设置自托管的p2存储库,请确保正确构建页面。 如果您选择(在eclipse中)帮助 - &gt;您可以检查这个安装新软件。 Eclipse应该显示提供的部分。 如果未显示任何内容,即使您已取消选中每个复选框,也应检查p2-repository。 它应包含&#34;功能&#34; &#34;插件&#34;容器以及 artifacts.jar content.jar 。 如果您只有两个文件夹,则应该运行

eclipse -application org.eclipse.equinox.p2.publisher.UpdateSitePublisher
 -metadataRepository file:/<some location>/repository
 -artifactRepository file:/<some location>/repository
 -source /<location with a site.xml>
 -configs gtk.linux.x86
 -compress
 -publishArtifacts

在CLI / Shell中。 有关详细信息,请查看the eclipse documentation