How do I build latest Tycho - eclipse

I've tried to build Tycho now for a couple of hours and just can't get it to work. I've followed these instructions:
https://docs.sonatype.org/display/TYCHO/BuildingTycho
So, I've downloaded Eclipse 3.6RC2 and Delta-packs linked from this instruction (is it for 3.5 only?):
http:// (remove space) aniefer.blogspot.com/2009/06/using-deltapack-in-eclipse-35.html
I've added the DeltaPack to the TargetPlatform inside of the Eclipse-installation.
I've installed Maven: Apache Maven 3.0-beta-1 (r935667; 2010-04-19 19:00:39+0200)
I can run the first bootstrap of the build, but the second fails:
mvn clean install -e -V -Pbootstrap-2 -Dtycho.targetPlatform=$TYCHO_TARGET_PLATFORM
ERROR] Internal error: java.lang.RuntimeException:
Could not resolve plugin org.eclipse.core.net.linux.x86_null -> [Help 1]
I've tried different stuff, I built an older revision against 3.5 as in this blogpost:
http:// (remove space) divby0.blogspot.com/2010/03/im-in-love-with-tycho-08-and-maven-3.html
and that actually built a running maven, but that version then can't find the tycho plugin:
org.apache.maven.plugin.version.PluginVersionResolutionException: Error resolving version for plugin 'org.codehaus.tycho:maven-tycho-plugin' from the repositories [local (/Users/viktor/.m2/repository), central (http://repo1.maven.org/maven2)]: Plugin not found in any plugin repository
I thought that the point was that the plugin was going to build in when I had built a Tycho-dist…?
Sorry about the links, stackoverflows spam-protection doesn't let me post more than one url yet

The Tycho documentation is pretty bad, to set the record straight, Tycho is included in the Maven repositories by default now; declaring it in your POM will automatically download it and allow you to use it.
To cut to the chase, this is all you have to put in your Maven POM to use Tycho, and then next time Maven uses this POM for a project, it will get Tycho if you don't already have it and use it for the build. At the time of this writing, 0.12.0 is the latest stable release.
<build>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-maven-plugin</artifactId>
<version>0.12.0</version>
<extensions>true</extensions>
</plugin>
</plugins>
</build>
Now, say, you would like to use an "unstable" Tycho, like <version>0.13.0</version>. Then you would want to change the version number in the plugin to the appropriate value, and then add this (The latest Tycho repository) to your POM:
<pluginRepositories>
<pluginRepository>
<id>sonatype-release</id>
<url>http://repository.sonatype.org/content/groups/sonatype-public-grid
</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
That simple.

With the move to eclipse.org, we also invested in better documentation for contributors:
http://wiki.eclipse.org/Developing_Tycho
http://wiki.eclipse.org/Tycho/Contributor_Guide

Related

Eclipse plugin with Maven dependencies for third party libraries

I am converting Subclipse to build with Eclipse Tycho and Maven.
Subclipse depends on a few third party JAR files that are not Eclipse plugins so do not exist in any p2 repository. Currently, I just include these in a lib folder within the plugin.
Since these JAR files do exist in Maven, I was hoping that by converting the plugins to build with Maven I could use Maven dependencies. IOW, the plugin would have a pom.xml where I used Maven dependencies to grab and include the third party jar's that have to be included in the plugin. Basically, it would just automate having to refresh what I include in the lib folder of the plugin.
Is this possible? I tried doing what I said above by when I build, I saw no sign that Maven/Tycho was trying to fetch the dependencies. I imagine it is because when the packaging is eclipse-plugin it looks solely at the Eclipse configuration files for the dependency information.
Thanks
To add plain (without OSGi metadata) jar files into your folder at biuild time, you can specify an <execution> of the maven-dependency-plugin to fetch them. However it will require to update your MANIFEST.MF Bundle-Classpath directive whenever a version changes.
It's usually better to hunt for OSGi-able jars or to make an extra effort to package existing libs as OSGi bundles/p2 artifacts like Eclipse Orbit or JBoss Tools Locus do.
Did you try doing the following after adding the dependencies to the pom.xml file?
Project->Clean
Right click on project: Maven->Update dependencies
Right click on project: Maven->Update project configuration
Just adding the plugin to pom dependencies and including the entry <pomDependencies>consider</pomDependencies> in the configuration of target-platform-configuration makes it work.
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>target-platform-configuration</artifactId>
<version>${tycho.version}</version>
<configuration>
<!-- The configuration to make tycho consider the maven dependencies -->
<pomDependencies>consider</pomDependencies>
<!-- other configurations -->
</configuartion>
</plugin>
<!-- other plugins-->
</plugins>
<dependencies>
<!-- An example third-party bundle (plugin) present in maven repository-->
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.gogo.shell</artifactId>
<version>1.1.0</version>
</dependency>
</dependencies>
Reference link here.

Testing my code against two Eclipse releases with Tycho

I am in need to test my code against two target platforms (which can be wrong to start with, but I would like to keep the focus on the issue): Kepler and Luna.
To do this, I defined two repositories in my parent project:
<repositories>
<repository>
<id>kepler</id>
<layout>p2</layout>
<url>http://download.eclipse.org/releases/kepler</url>
</repository>
<repository>
<id>luna</id>
<layout>p2</layout>
<url>http://download.eclipse.org/releases/luna</url>
</repository>
</repositories>
Then I created two plugins, one for Kepler and one for Luna which declare two different dependencies (code is duplicated, but again this is a separate issue):
// Luna
Require-Bundle:
org.eclipse.e4.core.contexts;bundle-version="1.3.100"
// Kepler
Require-Bundle:
org.eclipse.e4.core.contexts;bundle-version="[1.3.0,1.3.100)"
Now, when I specify the adequate tycho.target-platform, through -D or settings.xml, and run the build with mvn clean install, one of these plugins always fails and the other one succeeds. Luna fails if I don't specify a Luna target, Kepler fails if I don't specify a Kepler target.
There must be a better way, I told myself, and I read about target-platform-configuration which I have configured with all the possible combinations of os/ws/arch.
But still it fails for one or the other. What am I doing wrong?
The problem is that you override your target platform configuration in the POM by using the deprecated -Dtycho.target-platform property. When that property is set, Tycho no longer uses the artifacts from the two p2 repositories that you have specified.
So, don't use this property (and also make sure that you don't set it your settings.xml) and your approach should work.
My answer came right after checking my ~/.m2/settings.xml:
<profile>
<id>tycho-kepler</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<tycho.targetPlatform>/usr/local/share/eclipse</tycho.targetPlatform>
</properties>
</profile>
<profile>
<id>tycho-luna</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<properties>
<tycho.targetPlatform>/usr/local/share/eclipse-luna</tycho.targetPlatform>
</properties>
</profile>
Apparently these lines, even without having specified -P or the profile in the build, are added to the execution, something that I didn't now. Removing them solved the problem immediately.

Resolve oltu openid connect dependency in maven

This is not a question but a simple maven dependency solution of oltu openid connect that I like to share. I found it might be helpful to other as there's not too many resource about it on the web.
I was having a problem with oltu openid connect dependency in maven (pom). Somehow I found its groupid, artifact, and its version. But whenever I insert the dependency in pom, eclipse notifies me with missing artifact. The problem seemed like this:
The problem was as above mentioned that the dependency was not available in maven central repository. As I searched through web, I found those dependencies are hosted in other repository which is http://repository.idega.com/maven2/. After that, the solution was just to include this repository in your pom like shown below:
Try using the Apache Snapshot Repository:
<repositories>
<repository>
<id>apache.snapshots</id>
<name>Apache Snapshot Repository</name>
<url>https://repository.apache.org/snapshots</url>
<releases>
<enabled>false</enabled>
</releases>
</repository>
</repositories>

Jenkins Plugin debug "Dependency ui-samples-plugin (1.509) doesn't exist"

I ran into this problem debugging a Jenkins plugin with Eclipse and I wanted to post the solution here so that when people googled it, they could get a good answer.
I added:
<pluginRepositories>
<pluginRepository>
<id>repo.jenkins-ci.org</id>
<url>http://repo.jenkins-ci.org/public/</url>
</pluginRepository>
</pluginRepositories>
<dependencies>
<dependency>
<groupId>org.jenkins-ci.main</groupId>
<artifactId>ui-samples-plugin</artifactId>
<version>1.509</version>
<scope>compile</scope>
</dependency>
</dependencies>
To my paren pom and I was able to build and debug. I just wanted to let people know, because I couldn't find anything after a couple hours of searching.
http://jenkins-ci.org/changelog
What's new in 1.535 (2013/10/14)
UI Samples plugin fully separated from core. To view samples during
plugin development or at any other time, just install from the update
center.
During plugin development, you may want to lock your Jenkins version to the an older version so you don't end up in latest and greatest hell, LTS is 1.509.
Do you have the proper parent definition?
Here is an example from the artifactory plugin pom that defines the Jenkins version to lock to (They lock against 1.428):
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>1.428</version>
</parent>

building spring batch sample application

I am trying to build the sample application for spring batch 2.1.6. (ie. spring-batch-2.1.6.RELEASE/samples/spring-batch-samples) using maven but am getting this error for a missing plugin:
[ERROR] Plugin
com.springsource.bundlor:com.springsource.bundlor.maven:1.0.0.RELEASE
or one of its dependencies could not be resolved: Failure to find
com.springsource.bundlor:com.springsource.bundlor.maven:jar:1.0.0.RELEASE
in http://repo1.maven.org/maven2 was cached in the local repository,
resolution will not be reattempted until the update interval of
central has elapsed or updates are forced ->
Is there another repository I can set up to get this plugin? I am a bit suprised to be getting this errror as this is the latest realease version of spring batch.
Here is the repository section from the pom as it came in the download:
<repositories>
<repository>
<id>com.springsource.repository.bundles.external</id>
<name>SpringSource Enterprise Bundle Repository - SpringSource Bundle External</name>
<url>http://repository.springsource.com/maven/bundles/external</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
The project's parent pom has a bootstrap profile which contains the necessary repository definitions. Build the project with the command mvn test -P bootstrap and it will download the dependencies.
P.S. This is explained in the readme's instructions that how to build Spring Batch. It would be good if they would also tell how to do it in the instructions for using the samples - maybe you could file a bug report?
i am using maven3 and was able to solve this problem by adding this to my pom:
<pluginRepositories>
<pluginRepository>
<id>plugin.repo.maven.central2</id>
<url>http://objectstyle.org/maven2/</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
The Spring batch Admin sample build is broken for sure. At least as of today.
The -Pbootstrap doesn't help and adding the repos in that profile in my local settings doens't help either.
When I attempted to build spring-batch-admin-sample, I found that I was missing dependencies of spring batch!
So I went to build that. There I found that I was missing org.neo4j:neo4j-cypher-dsl-1.9.M04 and also gemfire.7.0.1.jar. Adding repos doesn't help because of the maven2/3 incompatibility issues.
So a sure way to fix this is to go to each repo, download the missing dep and mvn install-file them.
So get the neo4j one here:
http://m2.neo4j.org/content/repositories/releases/org/neo4j/neo4j-cypher-dsl/1.9.M04/
Get the gemfire one from here:
https://repo.springsource.org/gemstone-release-cache/com/gemstone/gemfire/gemfire/7.0.1/
And then I ran into a foundrylogic.vpp dependency that I found here:
http://objectstyle.org/maven2/foundrylogic/vpp/vpp/2.2.1/
Don't forget to get the corresponding poms also to keep it clean and get all the transitives, if any.
Use the mvn install-file plugin described here to get all three deps to your local repo.
http://maven.apache.org/plugins/maven-install-plugin/usage.html
Now spring-batch should build clean.
Now if you go to build spring-batch-admin it will still fail because it depends on spring-batch-core-2.2.3.BUILD-SNAPSHOT whereas what we just built was version 3.0.0.BUILD-SNAPSHOT.
So go to spring-batch-admin-parent's pom and modify the pom like so:
<!-- <spring.batch.version>2.2.3.BUILD-SNAPSHOT</spring.batch.version> -->
<spring.batch.version>3.0.0.BUILD-SNAPSHOT</spring.batch.version>
And then step back to spring-batch-admin and mvn clean install should build the sample.
Hope this helps someone!
I installed maven 3.2.1 and it works.