Our project makes use of a local Maven proxy server to mirror the combined contents of the Maven Central repository, various snapshot repositories and the project's own built artifacts. In the Maven conf directory, we have therefore installed the following settings.xml file, which reflects this arrangement:
<settings>
<servers>
<server>
<id>project-repo</id>
<username>...</username>
<password>...</password>
</server>
</servers>
<profiles>
<profile>
<id>main-profile</id>
<properties>
<!-- settings.localRepository is set by the USER settings.xml -->
<!-- Maven working directory -->
<maven.work.dir>${settings.localRepository}/..</maven.work.dir>
<!-- Clover working directory: clover license is expected in ${clover.work.dir}/license -->
<clover.work.dir>${maven.work.dir}/clover-work</clover.work.dir>
<!-- Additional plugin provider path for Eclipse target platform -->
<plugin.target.dir>${maven.work.dir}/plugin_target_dir</plugin.target.dir>
<!-- project sites will be deployed to ${site.dir} with mvn site:deploy -->
<site.dir>${maven.work.dir}/maven_site</site.dir>
</properties>
<repositories>
<repository>
<id>central</id>
<name>Internal Mirror of Central Repositories</name>
<url>http://....:9999/repository/</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>central</id>
<name>Internal Mirror of Central Plugins Repository</name>
<url>http://....:9999/repository/</url>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>main-profile</activeProfile>
</activeProfiles>
</settings>
In the .m2 directory under the user's home directory, we install a minimal settings.xml, which simply indicates where to find the local Maven repo on your hard disk. However, I have customised my copy so that I can do builds when not connected to the company network but with access to the Internet. This shows you where you can obtain things like the PDE Maven plugin snapshot.
<settings>
<localRepository>C:\data\...\maven_repo</localRepository>
<profiles>
<profile>
<id>publicRepos</id>
<activation>
<property>
<name>searchPublicRepos</name>
<value>true</value>
</property>
</activation>
<repositories>
<repository>
<id>codehausSnapshots</id>
<name>Codehaus Snapshots</name>
<releases>
<enabled>false</enabled>
<updatePolicy>always</updatePolicy>
<checksumPolicy>warn</checksumPolicy>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
<checksumPolicy>fail</checksumPolicy>
</snapshots>
<url>http://snapshots.maven.codehaus.org/maven2</url>
<layout>default</layout>
</repository>
<repository>
<id>mavenCentral</id>
<name>Maven Central</name>
<releases>
<enabled>true</enabled>
<updatePolicy>daily</updatePolicy>
<checksumPolicy>warn</checksumPolicy>
</releases>
<snapshots>
<enabled>false</enabled>
<updatePolicy>never</updatePolicy>
<checksumPolicy>warn</checksumPolicy>
</snapshots>
<url>http://repo1.maven.org/maven2/</url>
<layout>default</layout>
</repository>
<repository>
<id>mavenSnapshots</id>
<name>Maven Snapshots</name>
<releases>
<enabled>false</enabled>
<updatePolicy>never</updatePolicy>
<checksumPolicy>warn</checksumPolicy>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>daily</updatePolicy>
<checksumPolicy>warn</checksumPolicy>
</snapshots>
<url>http://people.apache.org/repo/m2-snapshot-repository/</url>
<layout>default</layout>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>codehausSnapshots</id>
<name>Codehaus Snapshots</name>
<releases>
<enabled>false</enabled>
<updatePolicy>always</updatePolicy>
<checksumPolicy>warn</checksumPolicy>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
<checksumPolicy>fail</checksumPolicy>
</snapshots>
<url>http://snapshots.maven.codehaus.org/maven2</url>
<layout>default</layout>
</pluginRepository>
<pluginRepository>
<id>mavenCentral</id>
<name>Maven Central</name>
<releases>
<enabled>true</enabled>
<updatePolicy>daily</updatePolicy>
<checksumPolicy>warn</checksumPolicy>
</releases>
<snapshots>
<enabled>false</enabled>
<updatePolicy>never</updatePolicy>
<checksumPolicy>warn</checksumPolicy>
</snapshots>
<url>http://repo1.maven.org/maven2/</url>
<layout>default</layout>
</pluginRepository>
<pluginRepository>
<id>mavenSnapshots</id>
<name>Maven Snapshots</name>
<releases>
<enabled>false</enabled>
<updatePolicy>never</updatePolicy>
<checksumPolicy>warn</checksumPolicy>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>daily</updatePolicy>
<checksumPolicy>warn</checksumPolicy>
</snapshots>
<url>http://people.apache.org/repo/m2-snapshot-repository/</url>
<layout>default</layout>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
</settings>
As I mentioned in passing in my original post, you also have to make sure that you (a) correct the version number of two dependencies in the pde-maven-plugin's POM, and (b) upload all the Eclipse plugins that the pde-maven-plugin needs to your local repository or to your project repository, using the eclipse:to-maven goal.
I have actually set up a Maven project to do upload Eclipse plugins repeatably and reliably in case we need to clean up and rebuild the project repository (e.g. after an upgrade of Eclipse). Here's the POM:
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>....</groupId>
<artifactId>devclipse-to-maven</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>pom</packaging>
<name>Eclipse plugins to Maven Artifacts converter</name>
<url>....</url>
<description>....</description>
<!-- ******************************************************************
Inherit from project grandparent pom
****************************************************************** -->
<parent>
<groupId>....</groupId>
<artifactId>configuration</artifactId>
<version>1.8</version>
</parent>
<!-- ******************************************************************
Environment Information
****************************************************************** -->
<scm>
<connection>
scm:svn:http://..../devclipse_to_maven/
</connection>
<developerConnection>
scm:svn:http://..../devclipse_to_maven/
</developerConnection>
<tag>HEAD</tag>
<url>
http://..../devclipse_to_maven/
</url>
</scm>
<!-- ******************************************************************
Build configuration
****************************************************************** -->
<properties>
<eclipse.source.dir>${env.M2_HOME}/../eclipse</eclipse.source.dir>
<eclipse.ext.dir>${env.M2_HOME}/../ext/eclipse</eclipse.ext.dir>
<eclipse.usr.dir>${env.M2_HOME}/../usr/eclipse</eclipse.usr.dir>
<eclipse.target.dir>${project.build.directory}/eclipse</eclipse.target.dir>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.1</version>
<executions>
<execution>
<id>copy-plugins-and-features</id>
<phase>process-resources</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks description="Grab the features and plugins from
the Eclipse SDK that have been found empirically to
be required as part of the target platform. We will
upload them to the Maven repository in the next phase.">
<mkdir dir="${eclipse.target.dir}/plugins"/>
<copy todir="${eclipse.target.dir}/plugins">
<fileset dir="${eclipse.source.dir}/plugins">
<include name="com.ibm.icu_*.jar"/>
<include name="org.eclipse.ant.core_*.jar"/>
<include name="org.eclipse.compare_*.jar"/>
<include name="org.eclipse.core.commands_*.jar"/>
<include name="org.eclipse.core.contenttype_*.jar"/>
<include name="org.eclipse.core.databinding_*.jar"/>
<include name="org.eclipse.core.expressions_*.jar"/>
<include name="org.eclipse.core.filebuffers_*.jar"/>
<include name="org.eclipse.core.filesystem_*.jar"/>
<include name="org.eclipse.core.jobs_*.jar"/>
<include name="org.eclipse.core.net_*.jar"/>
<include name="org.eclipse.core.resources_*.jar"/>
<include name="org.eclipse.core.runtime.compatibility.auth_*.jar"/>
<include name="org.eclipse.core.runtime_*.jar"/>
<include name="org.eclipse.core.variables_*.jar"/>
<include name="org.eclipse.debug.core_*.jar"/>
<include name="org.eclipse.equinox.app_*.jar"/>
<include name="org.eclipse.equinox.common_*.jar"/>
<include name="org.eclipse.equinox.preferences_*.jar"/>
<include name="org.eclipse.equinox.registry_*.jar"/>
<include name="org.eclipse.help_*.jar"/>
<include name="org.eclipse.jdt.core_*.jar"/>
<include name="org.eclipse.jdt.debug_*/**/*"/>
<include name="org.eclipse.jdt.launching_*.jar"/>
<include name="org.eclipse.jface.databinding_*.jar"/>
<include name="org.eclipse.jface.text_*.jar"/>
<include name="org.eclipse.jface_*.jar"/>
<include name="org.eclipse.osgi_*.jar"/>
<include name="org.eclipse.rcp.source.win32.win32.x86_*/**/*"/>
<include name="org.eclipse.swt.win32.win32.x86_*.jar"/>
<include name="org.eclipse.swt_*.jar"/>
<include name="org.eclipse.team.core_*.jar"/>
<include name="org.eclipse.team.ui_*.jar"/>
<include name="org.eclipse.text_*.jar"/>
<include name="org.eclipse.ui_*.jar"/>
<include name="org.eclipse.ui.console_*.jar"/>
<include name="org.eclipse.ui.editors_*.jar"/>
<include name="org.eclipse.ui.forms_*.jar"/>
<include name="org.eclipse.ui.ide_*.jar"/>
<include name="org.eclipse.ui.navigator_*.jar"/>
<include name="org.eclipse.ui.navigator.resources_*.jar"/>
<include name="org.eclipse.ui.views_*.jar"/>
<include name="org.eclipse.ui.views.properties.tabbed_*.jar"/>
<include name="org.eclipse.ui.workbench_*.jar"/>
<include name="org.eclipse.ui.workbench.texteditor_*.jar"/>
<include name="org.eclipse.update.configurator_*.jar"/>
<include name="org.eclipse.update.core_*.jar"/>
<include name="org.eclipse.update.ui_*.jar"/>
</fileset>
</copy>
<mkdir dir="${eclipse.target.dir}/features"/>
<copy todir="${eclipse.target.dir}/features">
<fileset dir="${eclipse.source.dir}/features">
<include name="none_*"/>
</fileset>
</copy>
<copy todir="${eclipse.target.dir}/plugins"
failonerror="false">
<fileset dir="${eclipse.ext.dir}/plugins">
<include name="org.polarion.team.svn.client.javahl.win32_*/**/*"/>
<include name="org.polarion.team.svn*.jar"/>
<include name="org.sf.easyexplore_*.jar"/>
</fileset>
</copy>
<copy todir="${eclipse.target.dir}/features"
failonerror="false">
<fileset dir="${eclipse.ext.dir}/features">
<include name="none_*"/>
</fileset>
</copy>
<copy todir="${eclipse.target.dir}/plugins"
failonerror="false">
<fileset dir="${eclipse.usr.dir}/plugins">
<include name="none_*"/>
</fileset>
</copy>
<copy todir="${eclipse.usr.dir}/features"
failonerror="false">
<fileset dir="${eclipse.ext.dir}/features">
<include name="none_*"/>
</fileset>
</copy>
</tasks>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.4</version>
<executions>
<execution>
<id>installation</id>
<phase>install</phase>
<configuration>
<eclipseDir>${eclipse.target.dir}</eclipseDir>
</configuration>
<goals>
<goal>to-maven</goal>
</goals>
</execution>
<execution>
<id>deployment</id>
<phase>deploy</phase>
<configuration>
<eclipseDir>${eclipse.target.dir}</eclipseDir>
<deployTo>${distributionManagement.repository.id}::default::${distributionManagement.repository.url}</deployTo>
</configuration>
<goals>
<goal>to-maven</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<!-- ******************************************************************
Project Information
****************************************************************** -->
<organization>
<name>....</name>
<url>http://..../</url>
</organization>
<developers>
<developer>
<id>ihu</id>
<name>Immo Hüneke</name>
<email>ihu@zuhlke.com</email>
<url>http://aspsp.blogspot.com/</url>
<organization>Zühlke Engineering</organization>
<organizationUrl>http://www.zuhlke.com/</organizationUrl>
<roles>
<role>architect</role>
<role>developer</role>
</roles>
<timezone>0</timezone>
<properties>
<picUrl>http://www.spaconference.org/cgi-bin/wiki.pl/?mugimmohuneke.jpg</picUrl>
</properties>
</developer>
</developers>
<inceptionYear>2008</inceptionYear>
</project>
Hope this helps. If you still have problems, please e-mail me your Maven output - I may be able to guess where it is going wrong.
5 comments:
Actually you don't need a separate settings.xml
Adding
[pluginRepositories]
[pluginRepository]
[id]codehausSnapshots[/id]
...
to your pom.xml will allow it to download the necessary plugins.
Hi Immo,
the method described by you was for me too complex. I mean the special pom.xml to create and with 'eclipse:to-maven' run. I've always got an error.
So I've choosen a lot easer way. It is probably not so clever as your, but it works.
1. I've added eclipse artifacts from an eclipse installation to the local repo with
mvn eclipse:to-maven -DdeployTo=local::default::file://D:\m2repo -DeclipseDir=.
I've firstly added artifacts in an empty folder 'm2repo' and then I've copied subfolders in the local Mavens repository.
Here eclipseDir is D:\eclipse\win32.win32.x86\eclipse [respectively to adapt] (*) as you it described in the tutorial.
(If that doesn't work: replace (*) by D:\eclipse [respectively to adapt], and copy only needed artifacts in local. This works, 100 %.)
2. The [packaging]zip[/packaging] has been not accepted by Maven. I've replaced this by jar.
3. I've used 'maven-compiler-plugin' with the version 1.5:
[build]
[plugins]
[plugin]
[artifactId]maven-compiler-plugin[/artifactId]
[configuration]
[source]1.5[/source]
[target]1.5[/target]
[/configuration]
[/plugin]
...
Otherwise error due to an anotation. (I don't know why).
4. I don't know why, but at the creation a new plug-in project it is very advisable Provider to insert. In your tutorial it is the part A approx. between 7 and 8 step. If I create your example '...withMaven' Provider is automatically set. But for another Examples this is not the case. As Provider I set an arbitrary word. After I set a Provider I had the error that I can correct.
5. After 'mvn clean install' I was able to run application as in the step B 16, but if I launch an Eclipse application as in A 16, I get this error:
------------
!ENTRY org.eclipse.osgi 4 0 2008-07-13 03:50:33.093
!MESSAGE An error occurred while automatically activating bundle ru.tu_ok.cs.swt.st_gui (24).
!STACK 0
org.osgi.framework.BundleException: The activator ru.tu_ok.cs.swt.st_gui.Activator for bundle ru.tu_ok.cs.swt.st_gui is invalid
-------------
probably due to an underline. I don't get this error with your example.
Best Regards, sipungora
"After read topic’s related post now I feel my research is almost completed. Thanks to share this brilliant matter."
create a online store free
Post a Comment