You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by re...@apache.org on 2006/04/24 14:15:33 UTC
svn commit: r396527 - in /cocoon/trunk/tools/cocoon-maven-eclipse-plugin: ./
src/main/java/org/apache/maven/plugin/eclipse/
src/main/java/org/apache/maven/plugin/eclipse/writers/
src/main/java/org/apache/maven/plugin/ide/
Author: reinhard
Date: Mon Apr 24 05:15:29 2006
New Revision: 396527
URL: http://svn.apache.org/viewcvs?rev=396527&view=rev
Log:
add support for PDE projects
Modified:
cocoon/trunk/tools/cocoon-maven-eclipse-plugin/pom.xml
cocoon/trunk/tools/cocoon-maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/EclipsePlugin.java
cocoon/trunk/tools/cocoon-maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseClasspathWriter.java
cocoon/trunk/tools/cocoon-maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/ide/IdeDependency.java
Modified: cocoon/trunk/tools/cocoon-maven-eclipse-plugin/pom.xml
URL: http://svn.apache.org/viewcvs/cocoon/trunk/tools/cocoon-maven-eclipse-plugin/pom.xml?rev=396527&r1=396526&r2=396527&view=diff
==============================================================================
--- cocoon/trunk/tools/cocoon-maven-eclipse-plugin/pom.xml (original)
+++ cocoon/trunk/tools/cocoon-maven-eclipse-plugin/pom.xml Mon Apr 24 05:15:29 2006
@@ -1,22 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?><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">
+
<parent>
- <artifactId>maven-plugins</artifactId>
- <groupId>org.apache.maven.plugins</groupId>
- <version>1</version>
+ <groupId>org.apache.cocoon</groupId>
+ <artifactId>cocoon-tools-modules</artifactId>
+ <version>1-SNAPSHOT</version>
</parent>
+
<modelVersion>4.0.0</modelVersion>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-eclipse-plugin</artifactId>
+
+ <artifactId>cocoon-maven-eclipse-plugin</artifactId>
<packaging>maven-plugin</packaging>
+
<name>Maven Eclipse Plugin</name>
<version>2.3-SNAPSHOT</version>
- <issueManagement>
- <system>JIRA</system>
- <url>http://jira.codehaus.org/browse/MECLIPSE</url>
- </issueManagement>
+
<build>
<plugins>
<plugin>
+ <artifactId>maven-plugin-plugin</artifactId>
+ <configuration>
+ <goalPrefix>c-eclipse</goalPrefix>
+ <extensions>true</extensions>
+ </configuration>
+ </plugin>
+ <plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<excludes>
@@ -27,6 +34,7 @@
</plugin>
</plugins>
</build>
+
<dependencies>
<dependency>
<groupId>org.apache.maven</groupId>
Modified: cocoon/trunk/tools/cocoon-maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/EclipsePlugin.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/tools/cocoon-maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/EclipsePlugin.java?rev=396527&r1=396526&r2=396527&view=diff
==============================================================================
--- cocoon/trunk/tools/cocoon-maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/EclipsePlugin.java (original)
+++ cocoon/trunk/tools/cocoon-maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/EclipsePlugin.java Mon Apr 24 05:15:29 2006
@@ -69,12 +69,18 @@
private static final String BUILDER_JDT_CORE_JAVA = "org.eclipse.jdt.core.javabuilder"; //$NON-NLS-1$
private static final String BUILDER_WST_COMPONENT_STRUCTURAL = "org.eclipse.wst.common.modulecore.ComponentStructuralBuilder"; //$NON-NLS-1$
+
+ private static final String BUILDER_PDE_MANIFEST = "org.eclipse.pde.ManifestBuilder"; //$NON-NLS-1$
+
+ private static final String BUILDER_PDE_SCHEMA = "org.eclipse.pde.SchemaBuilder"; //$NON-NLS-1$
private static final String NATURE_WST_MODULE_CORE_NATURE = "org.eclipse.wst.common.modulecore.ModuleCoreNature"; //$NON-NLS-1$
private static final String NATURE_JDT_CORE_JAVA = "org.eclipse.jdt.core.javanature"; //$NON-NLS-1$
private static final String NATURE_JEM_WORKBENCH_JAVA_EMF = "org.eclipse.jem.workbench.JavaEMFNature"; //$NON-NLS-1$
+
+ private static final String NATURE_PDE_PLUGIN = "org.eclipse.pde.PluginNature"; //$NON-NLS-1$
private static final String COMMON_PATH_JDT_LAUNCHING_JRE_CONTAINER = "org.eclipse.jdt.launching.JRE_CONTAINER"; //$NON-NLS-1$
@@ -217,6 +223,13 @@
* Not a plugin parameter. Is this a java project?
*/
private boolean isJavaProject;
+
+ /**
+ * Is it an PDE project?
+ *
+ * @parameter expression="${eclipse.pde}" default-value="false"
+ */
+ private boolean pde;
/**
* Getter for <code>buildcommands</code>.
@@ -526,7 +539,8 @@
new EclipseClasspathWriter( getLog(), eclipseProjectDir, project, deps ).write( projectBaseDir, sourceDirs,
classpathContainers,
localRepository,
- buildOutputDirectory );
+ buildOutputDirectory,
+ pde );
}
getLog().info( Messages.getString( "EclipsePlugin.wrote", new Object[] { //$NON-NLS-1$
@@ -565,6 +579,11 @@
projectnatures.add( NATURE_JEM_WORKBENCH_JAVA_EMF ); // WTP 0.7/1.0 nature
}
}
+
+ if( pde )
+ {
+ projectnatures.add( NATURE_PDE_PLUGIN );
+ }
}
@@ -596,6 +615,12 @@
if ( wtpR7 )
{
buildcommands.add( BUILDER_WST_COMPONENT_STRUCTURAL_DEPENDENCY_RESOLVER ); // WTP 0.7 builder
+ }
+
+ if ( pde )
+ {
+ buildcommands.add( BUILDER_PDE_MANIFEST );
+ buildcommands.add( BUILDER_PDE_SCHEMA );
}
}
Modified: cocoon/trunk/tools/cocoon-maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseClasspathWriter.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/tools/cocoon-maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseClasspathWriter.java?rev=396527&r1=396526&r2=396527&view=diff
==============================================================================
--- cocoon/trunk/tools/cocoon-maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseClasspathWriter.java (original)
+++ cocoon/trunk/tools/cocoon-maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseClasspathWriter.java Mon Apr 24 05:15:29 2006
@@ -30,6 +30,7 @@
import org.apache.maven.plugin.ide.IdeUtils;
import org.apache.maven.plugin.logging.Log;
import org.apache.maven.project.MavenProject;
+import org.codehaus.plexus.util.FileUtils;
import org.codehaus.plexus.util.IOUtil;
import org.codehaus.plexus.util.StringUtils;
import org.codehaus.plexus.util.xml.PrettyPrintXMLWriter;
@@ -97,7 +98,7 @@
}
public void write( File projectBaseDir, EclipseSourceDir[] sourceDirs, List classpathContainers,
- ArtifactRepository localRepository, File buildOutputDirectory )
+ ArtifactRepository localRepository, File buildOutputDirectory, boolean rcp )
throws MojoExecutionException
{
@@ -170,7 +171,7 @@
if ( dep.isAddedToClasspath() )
{
- addDependency( writer, dep, localRepository );
+ addDependency( writer, dep, localRepository, rcp );
}
}
@@ -180,7 +181,7 @@
}
- private void addDependency( XMLWriter writer, IdeDependency dep, ArtifactRepository localRepository )
+ private void addDependency( XMLWriter writer, IdeDependency dep, ArtifactRepository localRepository, boolean rcp )
throws MojoExecutionException
{
@@ -219,12 +220,41 @@
else
{
File localRepositoryFile = new File( localRepository.getBasedir() );
-
- String fullPath = artifactPath.getPath();
-
- path = "M2_REPO/" //$NON-NLS-1$
- + IdeUtils.toRelativeAndFixSeparator( localRepositoryFile, new File( fullPath ), false );
-
+
+ if ( dep.isOSGiBundle() && rcp )
+ {
+ // do nothing as required bundles need to be added to the Eclipse target platform
+ return;
+ }
+ else if ( !dep.isOSGiBundle() && rcp ) // && !dep.isTestDependency() && !dep.isProvided() )
+ {
+ String libs = "target/osgi/lib";
+ try {
+ File libsDir = new File(libs);
+ if(!libsDir.exists()) {
+ libsDir.mkdirs();
+ }
+ FileUtils.copyFileToDirectory(dep.getFile(), libsDir);
+
+ }
+ catch (IOException e)
+ {
+ throw new MojoExecutionException("Can't copy artifact '" + dep.getArtifactId() + "'");
+ }
+ path = libs + "/" + dep.getFile().getName();
+ kind = "lib";
+ }
+ else
+ {
+
+
+ String fullPath = artifactPath.getPath();
+
+ path = "M2_REPO/" //$NON-NLS-1$
+ + IdeUtils.toRelativeAndFixSeparator( localRepositoryFile, new File( fullPath ), false );
+
+ kind = "var"; //$NON-NLS-1$
+ }
if ( dep.getSourceAttachment() != null )
{
sourcepath = "M2_REPO/" //$NON-NLS-1$
@@ -239,7 +269,6 @@
"\\", "/" ); //$NON-NLS-1$ //$NON-NLS-2$
}
- kind = "var"; //$NON-NLS-1$
}
}
Modified: cocoon/trunk/tools/cocoon-maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/ide/IdeDependency.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/tools/cocoon-maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/ide/IdeDependency.java?rev=396527&r1=396526&r2=396527&view=diff
==============================================================================
--- cocoon/trunk/tools/cocoon-maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/ide/IdeDependency.java (original)
+++ cocoon/trunk/tools/cocoon-maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/ide/IdeDependency.java Mon Apr 24 05:15:29 2006
@@ -117,6 +117,15 @@
this.file = file;
this.type = type;
}
+
+ /**
+ * Is the artifact an OSGi bundle?
+ * @return Returns true if the dependency is an OSGi bundle.
+ */
+ public boolean isOSGiBundle()
+ {
+ return false;
+ }
/**
* Getter for <code>javadocAttachment</code>.
@@ -350,5 +359,6 @@
{
return getId();
}
+
}