Search code examples
eclipse-plugintycho

Project dependency error when using my local p2 repository with necessary jar files


I have created a eclipse plugin and I am in need of converting the eclipse plugin project into maven so that I converted it into maven with the help of Tycho.when i try to execute as eclipse application it works fine.But when i try to maven clean it fails.

[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.; 

my pom.xml file :

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

I have googled and not able to narrow down the cause of it.i have gone through Tycho cannot resolve dependency to bundle although present in the target file but i am not able to get teh solution. I am new to this tycho.please suggest some solutions how iam able to add these dependencies to tycho?

content.xml file in my local repository:

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

Solution

  • You've specified a property for the Kepler repository location, but you haven't told Tycho to use it. Try adding the following to your pom.xml:

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

    To create your own Eclipse p2 repository first download the required version of eclipse (http://www.eclipse.org/downloads/) and extract it to a local folder (lets say "/myfolder" for this example). Inside "myfolder" you should have an "eclipse" folder, then under that a "plugins" and "features" folder plus various other files and folders.

    Use the following command to create the P2 repository:

    /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