Testing my code against two Eclipse releases with Tycho - eclipse

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.

Related

KIE Scanner - 6.1.0.Final - not Loading LATEST kJAR

I am working on Drolls 6.1.0.Final. And my LATEST assets are not getting loaded. We have created a kJar 1.0 with 5 rules in KIE-Workbench 6.1.0.Final. We start our application server with KContainer having ReleaseId(gtoup, Artifact , LATEST). Rules are firing. Now add another rule in workbench increment the kJar version 1.1 and perform build and deploy. After waiting for 5mins fire the rules in application, LATEST Version IS NOT downloaded in m2 local repo and old rules are getting fired. I even tries with setting maven's update policy as interval:1, but in vain.
KIE Scanner is only getting triggered if I manually change the latest version and last updated in metadata.xml in local m2 repo. In this case KIE Scanner loads the new rules.
Kindly let us know what needs to be done.
Similar Issue
https://issues.jboss.org/browse/DROOLS-477
I know its old post but may be useful for others.
LATEST will not update rule at runtime instead it will load kjar from your local. So try to increase version number or use SNAPSHOT like 1-SNAPSHOT. When you use version as SNAPSHOT everytime it will check latest kjar.
Also check below settings.xml.
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
http://maven.apache.org/xsd/settings-1.0.0.xsd">
<servers>
<server>
<id>uf-playground</id>
<username>root</username>
<password>root</password>
<configuration>
<wagonProvider>httpclient</wagonProvider>
<httpConfiguration>
<all>
<usePreemptive>true</usePreemptive>
</all>
</httpConfiguration>
</configuration>
</server>
</servers>
<profiles>
<profile>
<id>profile-1</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<repositories>
<repository>
<id>uf-playground</id>
<name>Drools workbench</name>
<url>http://localhost:8080/kie-drool-6.4/maven2/</url>
**<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>**
</repository>
</repositories>
</profile>
</profiles>
</settings>

Perforce+Sonar setup for New line code coverage

I am trying to find out code coverage on new lines only. I use jacoco report for IT coverage and run mvn sonar:sonar. Sonar does not display the new line code coverage.
I am not sure what configuration I am missing.It seems to work for svn repo. I run mvn sonar on the base version and again with the latest version.
I am using Perforce,SonarQube 4.4, SCM Activity Plugin 1.8.
Here is my POM.xml,
<scm>
<connection>scm:perforce:username#perforceserver:portnumber://depot</connection>
<developerConnection>scm:perforce:username#perforceserver:portnumber://depot</developerConnection>
<url>scm:perforce:username#perforceserver:portnumber://depot</url>
</scm>
<properties>
<skipTests>false</skipTests>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<sonar.dynamicAnalysis>reuseReports</sonar.dynamicAnalysis>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>
<sonar.jacoco.itReportPath>C:/SonarData/ExecFiles/CSMmergeddata.exec</sonar.jacoco.itReportPath>
<sonar.scm.reloadBlame>true</sonar.scm.reloadBlame>
<sonar.language>java</sonar.language>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>${acme-corporate-pom.sonarVersion}</version>
</plugin>
...
To have code coverage on new line information, SonarQube relies on information from the SCM engine. As you can see on the SCM Activity plugin matrix, Subversion is perfectly supported but not Perforce - which is only known to be tested by some users but not formally validated by SonarQube team as "supported".
So either:
your configuration of the SCM Activity plugin is not correct
See the "Additional configuration for Perforce" section of the documentation of this plugin
or you hit a bug in the implementation of the Maven SCM library (we know there are some bugs)
See all the open bugs on this lib

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>

Using Maven's .m2/settings.xml throws warning in Eclipse m2e

I'm using Maven's settings.xml to override a property value for a log4j.properties file for development purposes. However, after I made this change, I now receive warnings in Eclipse m2e even though this is a normal use case:
Access "/Users/junger/.m2" directory outside of project base
directory.
(org.apache.maven.plugins:maven-resources-plugin:2.5:resources:default-resources:process-resources)
How do I remove this warning? Or, is there a bug tracking this? I couldn't find one.
In my pom.xml, I have -
<properties>
<log4j.properties.directory>src/main/java</log4j.properties.directory>
</properties>
In my settings.xml, I have -
<profiles>
<profile>
<id>dev</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<log4j.properties.directory>/Users/junger/.m2/</log4j.properties.directory>
</properties>
</profile>
</profiles>
Looking at the code (the newScanner() method) of m2e, this seems to be an explicit warning when your project references files outside of its base directory.
For me, this warning is kind of justified. When you are referencing resources outside of your project's basedir, your builds might not be reproducible anymore. Your projects should rather be self contained without depending on external files.

How do I build latest Tycho

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