当前位置: 首页 > 知识库问答 >
问题:

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

邓鸿彩
2023-03-14

我创建了一个 eclipse 插件,我需要将 eclipse 插件项目转换为 maven,以便在第谷的帮助下将其转换为 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>

我已经在谷歌上搜索过了,但无法缩小原因。我已经经历了Tycho无法解决捆绑的依赖关系,尽管存在于目标文件中,但我无法获得解决方案。我是这个tycho的新手。请建议一些解决方案我如何将这些依赖项添加到tycho中?

内容.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>

工件. 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个答案

公西翼
2023-03-14

要解决有关缺少依赖项的问题,请执行以下操作:

[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

似乎您的功能/插件“xxx”需要下载org.eclipse.ui插件才能安装。

您应该像这样从配置pom中检查您的设置:

 <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中)帮助-

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/外壳中。有关更多信息,请查看 eclipse 文档。

东郭宏深
2023-03-14

您已经为开普勒存储库位置指定了一个属性,但还没有告诉第谷使用它。请尝试将以下内容添加到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”文件夹,然后在该文件夹下有一个“插件”和“功能”文件夹以及各种其他文件和文件夹。

使用以下命令创建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
 类似资料:
  • 我正在尝试设置一个组织范围的maven存储库。我已将archiva安装为服务,并在本地设置中添加了镜像。使用maven的xml禁用maven central。 我已经将我的project ect1的jar上传到Archiva内部存储库。我在我的project ect2的POM. xml中使用project ect1的jar的group id、artifactid和版本号。我看到项目1的jar已经被

  • 我有一个名为并行的 Clojure 项目,这取决于另一个名为“消息传递”的 Clojure 项目,我使用 命令生成消息传递 0.1.0-SNAPSHOT.jar文件,然后我按照页面上的说明 https://github.com/kumarshantanu/lein-localrepo 尝试将本地 jar 依赖项添加到并行项目中。 首先,我在并行项目的根目录下创建了一个名为lib的目录。然后,我使用

  • 我罐子里的东西: 下面是我使用JAR的方法:

  • 问题内容: 我想在“常规” Maven 3构建(例如JAR或WAR打包)中使用来自远程Eclipse p2存储库的依赖项- 所有这些都无需将p2存储库转换为本地Maven存储库(这是osgi-to-maven2和m4e似乎可以)。 理想情况下,我只使用http://maven.eclipse.org/nexus/,但这还不包含很多捆绑软件。 使用Maven的systemPath不算在内! 问题答案

  • 我所处的环境是,可以将同名jar文件的多个版本发布到本地Nexus安装。这些jar文件始终命名为XYZ-SNAPSHOT。罐子我们的持续集成系统需要始终获取最新版本,因此我们的自动构建当前包含以下内容,以消除持续集成机器上的完整本地回购: mvn依赖项:清除本地存储库 这将强制在每个构建上下载所有依赖项,这将花费很长时间。是否有某种方法可以将“includes”标志与通配符一起使用。我可以这样假设

  • 问题内容: 我有一个依赖 然后我执行。添加了所有本机文件和远程Maven库,但是没有此jar。 更新 当我尝试通过运行应用程序时。它返回一个错误,指出上述依赖项中没有任何类(NoClassDefFoundError:de.matthiasmann.twl.ForExample)。我想将这个jar中的类添加到myjar.jar中(与maven使用远程依赖项相同)。我如何配置Maven来做到这一点?

  • 问题内容: 所以我尝试将本地.jar文件依赖项添加到build.gradle文件中: 你会看到我将.jar文件添加到了这里的文件夹中: 但是问题是,当我在命令行上运行命令:gradle build时,出现以下错误: 问题答案: 据文档,对本地jar依赖项使用相对路径,如下所示:

  • 我试图将我的所有依赖项与lib文件夹中的主jar并排在一起 我已经将maven依赖项插件配置添加到pom中,指定输出目录 运行时构建成功 主jar是编译和构建的,但我没有看到复制的依赖项,我做错了什么? maven版本