Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » Tycho » better eclipse-plugin examples with dependencies?(Eclipse plug-in with maven and external jars?)
icon5.gif  better eclipse-plugin examples with dependencies? [message #725104] Wed, 14 September 2011 00:10 Go to next message
Dick Fardos is currently offline Dick FardosFriend
Messages: 4
Registered: September 2011
Junior Member
Hello,
I'm working on a few Eclipse plug-ins at work that require me to use some external OSGi jars that aren't part of the eclipse, namely com.google.gson among others.

I'm having the hardest time trying to figure out the correct way to add the dependency of com.google.gson to my plugin project to make both eclipse and maven build.

I'm using tycho 0.12.0.

I have the Require-Bundle: com.google.gson entry in the plugins manifest, but tycho seems to hate that, which is quite puzzling. I also have com.google.gson listed in the plugin's pom.xml, but that doesn't seem to satisfy tycho at all.

I need to build in both eclipse (for local development and testing) and Maven (for nightly builds that happen on our build server).

Here is my parent pom.xml
<?xml version="1.0" encoding="UTF-8"?>

  <modelVersion>4.0.0</modelVersion>

  <groupId>com.hemna.oo</groupId>
  <artifactId>foo</artifactId>
  <version>1.0.0-SNAPSHOT</version>
  <packaging>pom</packaging>

  <modules>
    <module>foo-plugin</module>
  </modules>

  <properties>
    <tycho-version>0.12.0</tycho-version>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>


  <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>
	<version>${tycho-version}</version>
	<configuration>
		<resolver>p2</resolver>
		<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>
    </plugins>
  </build>



   <repositories>
       <repository>
           <id>p2.eclipse.indigo</id>
           <layout>p2</layout>
           <url>URL to indigo...forum wouldn't let me leave the real url here....</url>
       </repository>
   </repositories>



</project>




And here is the plugin that needs gson

<?xml version="1.0" encoding="UTF-8"?>

  <modelVersion>4.0.0</modelVersion>
  <parent>
    <artifactId>foo-plugin</artifactId>
    <groupId>com.hemna.oo</groupId>
    <version>1.0.0-SNAPSHOT</version>
  </parent>
  <groupId>com.hemna.oo.foo</groupId>
  <artifactId>com.hemna.oo.foo.shared</artifactId>
  <version>1.0.0-SNAPSHOT</version>
  <packaging>eclipse-plugin</packaging>
  <dependencies>
  	<dependency>
  		<groupId>com.google.code.gson</groupId>
  		<artifactId>gson</artifactId>
  		<version>1.7.1</version>
  	</dependency>
  </dependencies>
</project>




[INFO] Cannot complete the request.  Generating details.
[INFO] {org.osgi.framework.executionenvironment=OSGi/Minimum-1.0,OSGi/Minimum-1.1, osgi.ws=gtk, osgi.arch=x86, osgi.os=linux, org.eclipse.update.install.features=true, org.osgi.framework.system.packages=}
[INFO] [Software being installed: com.hemna.oo.foo.debug.core 1.0.0.qualifier, Missing requirement: com.hemna.oo.foo.shared 1.0.0.qualifier requires 'bundle com.google.gson [1.7.0,2.0.0)' but it could not be found, Cannot satisfy dependency: com.hemna.oo.foo.debug.core 1.0.0.qualifier depends on: bundle com.hemna.oo.foo.shared [1.0.0,4.0.0)]
[ERROR] Internal error: java.lang.RuntimeException: org.eclipse.equinox.p2.core.ProvisionException: No solution found because the problem is unsatisfiable. -> [Help 1]
org.apache.maven.InternalErrorException: Internal error: java.lang.RuntimeException: org.eclipse.equinox.p2.core.ProvisionException: No solution found because the problem is unsatisfiable.
	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(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:601)
	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: org.eclipse.equinox.p2.core.ProvisionException: No solution found because the problem is unsatisfiable.
	at org.eclipse.tycho.p2.impl.resolver.ProjectorResolutionStrategy.resolve(ProjectorResolutionStrategy.java:102)
	at org.eclipse.tycho.p2.impl.resolver.P2ResolverImpl.resolveProject(P2ResolverImpl.java:324)
	at org.eclipse.tycho.p2.impl.resolver.P2ResolverImpl.resolveProject(P2ResolverImpl.java:293)
	at org.eclipse.tycho.p2.facade.P2TargetPlatformResolver.doResolvePlatform(P2TargetPlatformResolver.java:389)
	at org.eclipse.tycho.p2.facade.P2TargetPlatformResolver.resolvePlatform(P2TargetPlatformResolver.java:150)
	at org.eclipse.tycho.core.resolver.DefaultTychoDependencyResolver.resolveProject(DefaultTychoDependencyResolver.java:90)
	at org.eclipse.tycho.core.maven.TychoMavenLifecycleParticipant.afterProjectsRead(TychoMavenLifecycleParticipant.java:91)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:273)
	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
	... 11 more
Caused by: org.eclipse.equinox.p2.core.ProvisionException: No solution found because the problem is unsatisfiable.
	... 20 more





I have tried looking at the tycho examples, but they are useless. They don't have any examples of a working eclipse plugin that uses an external OSGi jar like gson.

What I want to be able to do is have maven pull the dependency down from the <dependency> entry in the pom, and then use that when referencing the manifest.mf entries to resolve them.
This seems like a very basic missing capability with Tycho?

What is the proper way to get Eclipse and maven/Tycho building properly, so I don't have to manually pull down external jars, then tell eclipse to use that jar at build time and then do something else for maven build time.

I have the gson jar in my local ~/.m2 cache already
me@dev:~/devel/:(maindev)$ ls -al ~/.m2/repository/com/google/code/gson/gson/1.7.1/
total 604
drwxr-xr-x 3 me me   4096 2011-09-13 13:42 .
drwxr-xr-x 3 me me   4096 2011-09-02 08:17 ..
-rw-r--r-- 1 me me 173590 2011-09-02 08:17 gson-1.7.1.jar
-rw-r--r-- 1 me me     40 2011-09-02 08:17 gson-1.7.1.jar.sha1
Re: better eclipse-plugin examples with dependencies? [message #725567 is a reply to message #725104] Thu, 15 September 2011 08:27 Go to previous messageGo to next message
Jan Sievers is currently offline Jan SieversFriend
Messages: 23
Registered: July 2009
Junior Member
https://docs.sonatype.org/display/TYCHO/Dependency+on+pom-first+artifacts

Re: better eclipse-plugin examples with dependencies? [message #726202 is a reply to message #725567] Fri, 16 September 2011 19:10 Go to previous messageGo to next message
Luiz E. is currently offline Luiz E.Friend
Messages: 97
Registered: September 2010
Member
i'm facing the same problem here, but in my case, with eclipselink
what did you found out until now?
i really want to give a try to tycho one more time, but the more i want to do good practices, the more i mess up everything Sad

ps: sorry about my english
Re: better eclipse-plugin examples with dependencies? [message #727324 is a reply to message #725567] Wed, 21 September 2011 00:00 Go to previous messageGo to next message
Dick Fardos is currently offline Dick FardosFriend
Messages: 4
Registered: September 2011
Junior Member
that url is useless. It doesn't contain build eclipse plugins. Nor does it talk about pulling in external osgi jars from maven dependencies that are then packaged into the eclipse plugin project. Sad
Re: better eclipse-plugin examples with dependencies? [message #727325 is a reply to message #727324] Wed, 21 September 2011 00:01 Go to previous message
Dick Fardos is currently offline Dick FardosFriend
Messages: 4
Registered: September 2011
Junior Member
Luiz E. I'm about to give up on tycho. It seems rather useless to me.
Previous Topic:Possible to use bundles as dependencies for maven jar projects?
Next Topic:Create feature including sources
Goto Forum:
  


Current Time: Thu Dec 18 21:43:12 GMT 2014

Powered by FUDForum. Page generated in 0.03475 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software