Platform runtime and dependencies - tycho

Target Platform understanding required and dependencies in eclipse plugin development.
I am pulling my hair out for the past 3 days.
If I specify the following:-
<repositories>
<repository>
<id>eclipse-helios</id>
<layout>p2</layout>
<url>http://download.eclipse.org/releases/helios</url>
</repository>
</repositories>
1)To me I am making sure my plugin is compatible to run from helios on wards, am I wrong in my thinking?
2)Should that not have resolved my the platform dependencies?
[ERROR] Cannot resolve project dependencies:
[ERROR] Software being installed: plugin1 1.0.0.qualifier
[ERROR] Missing requirement: plugin1 1.0.0.qualifier requires
'osgi.bundle; org.eclipse.core.runtime 0.0.0' but it could not be found
[ERROR]
[ERROR] See
http://wiki.eclipse.org/Tycho/Dependency_Resolution_Troubleshooting for
help
my manifest file contains:-
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Plugin1
Bundle-SymbolicName: plugin1;singleton:=true
Bundle-Version: 1.0.0.qualifier
Bundle-Vendor: xxx
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.ui
Automatic-Module-Name: plugin1
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
3)
When I run my plugin it works under helious.
Please help me using tycho and maven to achieve this. I just don't understand 'eclipse speak' in its help text.
Someone help me please please
Regards,
Jemrug

Guys I tried in another eclipse workspace and it is all good. So it was a workspace issue.
My only question is how do I do this in standalone mvn as I keep getting the :
mvn clean install
Cannot resolve project dependencies:
[ERROR] Software being installed: plugin1 1.0.0.qualifier
[ERROR] Missing requirement: plugin1 1.0.0.qualifier requires 'osgi.bundle;
org.eclipse.core.runtime 0.0.0'
So why is all well inside eclipse but not command line I get the above.

Related

IvyDE unresolved dependency

I am using artifactory, Eclipse and IvyDE to pull in jar files. I have the following dependency in my ivy.xml
<dependency org="org.apache.activemq" name="activemq-camel" rev="5.9.0.redhat-610379"/>
but I am getting the following IvyDE error
unresolved dependency: org.apache.activemq#activemq-camel;5.9.0.redhat-610379: not found
I can go to artifactory and find the jar file. It gives me the ivy.xml entry needed to pull it but I am getting this error. I was thinking maybe the rev is invalid?
Thanks!

invalid CEN header for wicket 6.15.0 Jar

I am trying to compile a Apache Wicket Project with wicket version 6.15.0.
I am using Apache Wicket 6.15.0 jar, maven dependency in my pom.xml.
<dependency>
<groupId>org.apache.wicket</groupId>
<artifactId>wicket-core</artifactId>
<version>6.15.0</version>
</dependency>
For this I am getting error as:
[ERROR] error: error reading C:\Users\maddy\.m2\repository\org\apache\wicket\wicket-util\6.15.0\wicket-util-6.15.0.jar; invalid CEN header (bad signature)
Please guide solution on this.
try to delete this jar from your maven repository and let maven redownload it again.
C:\Users\maddy.m2\repository\org\apache\wicket\wicket-util\6.15.0\wicket-util-6.15.0.jar

How to specify an internal company Maven repo for a Jenkins job to use?

I'm trying to setup a Maven2 job in Jenkins. I've got such lines in my pom.xml:
<distributionManagement>
<repository>
<id>releases</id>
<name>Releases</name>
<url>http://nexus.example.com:8081/nexus/content/repositories/releases</url>
</repository>
...
</distributionManagement>
I get this error when trying to build the job:
...
Downloading: http://repo1.maven.org/maven2/.../.../.../....jar
[INFO] Unable to find resource 'resource id goes here' in repository central (http://repo1.maven.org/maven2)
...
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failed to resolve artifact.
Missing:
...Here goes the list of missing dependencies.
I know for sure that the required artifacts do exist in nexus.example.com repository, because I can do an mvn compile on my workstation and they will be downloaded OK.
But Jenkins for some reason does not even try to download the artifacts from local repo, ignoring the specification in the pom.xml.
Any ideas what can I try?
You can resolve this error in two ways.
One, move the <repositories> section out of <distributionManagement>. <distributionManagement> section is to indicate where you want to deploy your artifacts.
Specify the <repositories> section in the settings.xml of the username jenkins is running under. This is recommended, since this will apply for all the projects that you would be building.

How to install third party source and javadoc JARs?

Is there way to install third party source and javadoc JARs by using maven?
Guide to installing 3rd party JARs
If you want to use the feature mentioned there about version 2.5 of the maven-install-plugin (if the JAR was built by Apache Maven, it'll contain a pom.xml in a subfolder of the META-INF directory, which will be read by default by maven-install-plugin:2.5), then you can run:
mvn org.apache.maven.plugins:maven-install-plugin:2.5.2:install-fi‌​le -Dfile=<path-to-jar-file>
To generate the jars for the javadoc and the sources use e.g.:
Maven Deploy Plugin
Maven Javadoc plugin
Maven Source plugin
If you want to install a secondary artifact (such as the sources jar) for an already installed jar, then follow the step described here: Installing Secondary Artifacts
For info specifically about how to install 3rd party javadoc JARs see: How to deploy Javadoc jar file.
There are atleast three approaches in which 3rd party JARs can be added to Maven projects.
Install manually using mvn install command
Adding the location of jar file in pom dependency with the the following tag system
Creating a 'dummy' maven repository pointing to jar location.
I will focus on third approach which I find more cleaner and does not require any mvn command and works out of box from any IDE.
Step 1: Add the location of local 'dummy' repository in pom.xml
<repositories>
<repository>
<id>repo</id>
<name>repo</name>
<url>file:${project.basedir}/src/main/resources/lib</url>
</repository>
</repositories>
Here the 'dummy' repository location is the 'lib' folder of my project directory
Step 2 : Add the jar dependency into your pom.xml
<dependency>
<groupId>com.cloudera.impala</groupId>
<artifactId>impala-frontend</artifactId>
<version>0.1-SNAPSHOT</version>
</dependency>
choose any groupId but make sure that artifactId and version is of the format <artifactId>-<version>.jar ( Name of 3rd party jar)
Step 3 : Create the folder structure as per the groupId,artifactId and version mentioned in the Step 2 in your local 'dummy' repository. So in this case the folder struction would be /src/main/resources/lib/com/cloudera/impala/impala-frontend/0.1-SNAPSHOT/
Place your jar in the version folder and build your project.
You will get the following output which treats your 'dummy' repository to be the provider of your 3rd party jar.
[INFO] Downloading from repo: file:C:\Users\skumar\eclipse-workspace\chdQueryBuilder/src/main/resources/lib/com/cloudera/impala/impala-frontend/0.1-SNAPSHOT/maven-metadata.xml
[INFO] Downloading from repo: file:C:\Users\skumar\eclipse-workspace\chdQueryBuilder/src/main/resources/lib/com/cloudera/impala/impala-frontend/0.1-SNAPSHOT/impala-frontend-0.1-SNAPSHOT.pom
[WARNING] The POM for com.cloudera.impala:impala-frontend:jar:0.1-SNAPSHOT is missing, no dependency information available
[INFO] Downloading from repo: file:C:\Users\skumar\eclipse-workspace\chdQueryBuilder/src/main/resources/lib/com/cloudera/impala/impala-frontend/0.1-SNAPSHOT/impala-frontend-0.1-SNAPSHOT.jar
[WARNING] Could not validate integrity of download from file:C:\Users\skumar\eclipse-workspace\chdQueryBuilder/src/main/resources/lib/com/cloudera/impala/impala-frontend/0.1-SNAPSHOT/impala-frontend-0.1-SNAPSHOT.jar: Checksum validation failed, no checksums available
[WARNING] Checksum validation failed, no checksums available from repo for file:C:\Users\skumar\eclipse-workspace\chdQueryBuilder/src/main/resources/lib/com/cloudera/impala/impala-frontend/0.1-SNAPSHOT/impala-frontend-0.1-SNAPSHOT.jar
[INFO] Downloaded from repo: file:C:\Users\skumar\eclipse-workspace\chdQueryBuilder/src/main/resources/lib/com/cloudera/impala/impala-frontend/0.1-SNAPSHOT/impala-frontend-0.1-SNAPSHOT.jar (7.0 MB at 79 MB/s)
[INFO]

Creating an archive of all jars and source jars for a multi-module project

I'm building a Maven project which has half a dozen modules.
I'm fine with importing it myself using either Maven or Ivy, but other teams would like to use those jars as well, but their practice is to commit the jars and source jars to version control.
I'd like to generate a zip/tar assembly of all modules and their sources which they can use however they like.
I've read Maven Assembly Plugin: Including Module Binaries but I'm shy of using it because:
The linked FAQ entry returns a 404;
I need to manually specify all modules.
Is there an alternative?
Update: I've tried using the built-in assembly descriptors
mvn assembly:assembly -DprojectModulesOnly=true
mvn assembly:assembly
and both failed with
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failed to create assembly: Error creating assembly archive bin: You must set at least one file.
right after all the module builds have run.
I think you're on the right lines, the moduleSets options of the assembly plugin handles what you're after.
If you're looking for some useful documentation, the Module Selection section of the Maven book covers it quite thoroughly, including how to configure includes and excludes, handle binaries and sources, and exclude external dependencies.
I had this problem, for me, the solution was NOT put / at the beginning of your <fileset><directory>
If you do that will work on Windows, not on Unix/Linux!
<fileSet>
<directory>src/main/</directory>
<outputDirectory></outputDirectory>
<includes>
<include>VERSION</include>
</includes>
</fileSet>
works whereas
<fileSet>
<directory>/src/main/</directory>
<outputDirectory></outputDirectory>
<includes>
<include>VERSION</include>
</includes>
</fileSet>
causes
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-assembly-plugin:2.3:single (execution-pluggin-assembly) on project test3: Failed to create assembly: Error creating assembly archive assembly: You must set at least one file. -> [Help 1]
Have a look at the How to use assembly:assembly using predefined descriptor ids. I think the bin and src pre-defined descriptor files are what you need.
Sounds like you need a build-server of some kind. I was at JavaZone 2009 this week and looked at Hudson CI http://hudson-ci.org/
The server will create the artifacts you or other teams can use/download.