1

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>
Community
  • 1
  • 1
Obuli Sundar
  • 189
  • 1
  • 12
  • This question starts out as a very valid question - and Nick answers it correctly - but then out of nowhere you add the constraint that you want use some (buggy?) local p2 repository, which completely invalidates the answer. This is why changing the scope of questions is frowned upon on stackoverflow. You should have asked a new question with the additional constraint instead. – oberlies Oct 31 '14 at 15:39
  • I've changed the title so that others can see that this is about an error in a pretty uncommon setup and hence know what to expect here. – oberlies Oct 31 '14 at 15:43

2 Answers2

1

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
Nick Wilson
  • 4,959
  • 29
  • 42
  • Thanks for the response. I dont want to use kepler repository i have created my own p2 repository which contains all the necessary jar files in it. still it shows the same error. third-party-eclipse-plugins p2 ${project.baseUri}dependency/p2-repo i used like this dependency/p2-repo is my repository – Obuli Sundar Oct 30 '14 at 11:44
  • Does your local repo containt all of the eclipse plugins mentioned in the error message (org.eclipse.ui etc...)? – Nick Wilson Oct 30 '14 at 12:39
  • yea i put all the jar files inside a folder called p2-repo and converted it into p2-repository by using the following command java -jar C:eclipse/plugins/org.eclipse.equinox.launcher_*.jar -application org.eclipse.equinox.p2.publisher.FeaturesAndBundlesPublisher -metadataRepository file:/C:/p2-repo/ -artifactRepository file:/C:/p2-repo/ -source /C:/p2-repo/ -compress -publishArtifacts – Obuli Sundar Oct 30 '14 at 12:52
  • I have edited my question with the content.xml and artifacts.xml – Obuli Sundar Oct 30 '14 at 12:57
  • The artifact and content files should be much bigger. The command you mentioned takes a standard eclipse product folder structure, not just the jar files (i.e. plugins & features folder under the source folder). You can use a standard Eclipse install folder as the source. – Nick Wilson Oct 30 '14 at 14:05
  • I have only the standard jar files could you please tell me how to create a p2 repository for those jar file. I have to put 8 dependencies as jar files inside the p2 repository. – Obuli Sundar Oct 30 '14 at 14:24
  • Thank you very much :) now dependency is added.but again another error arised:( [ERROR] Internal error: java.lang.RuntimeException: Could not determine SWT implementation fragment bundle for environment {osgi.ws=gtk, osgi.os=linux, osgi.arch=x86, org.eclipse.update.install.features=true} -> [Help 1] org.apache.maven.InternalErrorException: Internal error: java.lang.RuntimeException: Could not determine SWT implementation fragment bundle for environment {osgi.ws=gtk, osgi.os=linux, osgi.arch=x86, org.eclipse.update.install.features=true} – Obuli Sundar Oct 31 '14 at 05:12
  • That error is because you have multiple target environments, but the local P2 repository you created only contains one version of SWT. You'll need to have the other versions available in a P2 repository. Is there any reason you can't use the central one? Or at least proxy it with Nexus? Would make things easier. – Nick Wilson Nov 03 '14 at 09:08
  • how can i have other versions of SWT in my p2 repository ,I cant use central repository,I have to use my own p2 repository for it. – Obuli Sundar Nov 04 '14 at 05:09
  • You'll need to use an `RCP Delta Pack` to create an additional local P2 repository. You can download the delta packs for your specific version of Eclipse from the Eclipse website. – Nick Wilson Nov 04 '14 at 08:55
  • can you please guide me through some sites for creating p2 repository with rcp delta pack – Obuli Sundar Nov 07 '14 at 05:02
  • You do it the same way you created the other local P2 repository. I'd still strongly recommend setting up Nexus as a proxy to the central repository. If your company needs convincing that it's a good idea, tell them not doing it has just cost them a weeks work :) – Nick Wilson Nov 07 '14 at 08:52
  • Thanks for your response..can you please guide me how to set up proxy repo of nexsus. I have to finish it soon.. please... – Obuli Sundar Nov 07 '14 at 09:07
  • You'll need [Nexus OSS](http://www.sonatype.org/nexus/go/), [P2 Repo plugin](https://repository.sonatype.org/service/local/repo_groups/forge/content/org/sonatype/nexus/plugins/nexus-p2-repository-plugin/2.10.0-02/nexus-p2-repository-plugin-2.10.0-02-bundle.zip) and [P2 Bridge Plugin](https://repository.sonatype.org/service/local/repo_groups/forge/content/org/sonatype/nexus/plugins/nexus-p2-bridge-plugin/2.10.0-02/nexus-p2-bridge-plugin-2.10.0-02-bundle.zip). Google "nexus oss p2 proxy". – Nick Wilson Nov 07 '14 at 09:25
0

To solve the Problem concerning the missing 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

seems that your Feature/Plugin "xxx" requires to download the org.eclipse.ui Plug-in before it can be installed.

You should check your settings from your configuration-pom like this:

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

if you have set up your self-hosted p2 repository, make sure that the page is correctly build. You can check this if you select(in eclipse) Help -> Install New Software. Eclipse should show the provided parts. If nothing is shown, even if you have deselected every checkbox, you should check your p2-repository. It should contain the "features" and "plugins" container as well as the artifacts.jar and content.jar. If you have only the two folders, you should run

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

in a CLI/Shell. For more Information check the eclipse documentation.

L12
  • 85
  • 1
  • 7