You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by fg...@apache.org on 2006/04/02 10:16:16 UTC
svn commit: r390798 - in /maven/plugins/trunk/maven-eclipse-plugin/src:
main/java/org/apache/maven/plugin/eclipse/
test/java/org/apache/maven/plugin/eclipse/ test/projects/project-12/
Author: fgiust
Date: Sun Apr 2 00:16:14 2006
New Revision: 390798
URL: http://svn.apache.org/viewcvs?rev=390798&view=rev
Log:
MECLIPSE-83 ear projects should not be java projects
Added:
maven/plugins/trunk/maven-eclipse-plugin/src/test/projects/project-12/
maven/plugins/trunk/maven-eclipse-plugin/src/test/projects/project-12/component
maven/plugins/trunk/maven-eclipse-plugin/src/test/projects/project-12/pom.xml (with props)
maven/plugins/trunk/maven-eclipse-plugin/src/test/projects/project-12/project
Modified:
maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/EclipsePlugin.java
maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/AbstractEclipsePluginTestCase.java
maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/EclipsePluginTest.java
Modified: maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/EclipsePlugin.java
URL: http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/EclipsePlugin.java?rev=390798&r1=390797&r2=390798&view=diff
==============================================================================
--- maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/EclipsePlugin.java (original)
+++ maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/EclipsePlugin.java Sun Apr 2 00:16:14 2006
@@ -186,6 +186,11 @@
private boolean wtp10;
/**
+ * Not a plugin parameter. Is this a java project?
+ */
+ private boolean isJavaProject;
+
+ /**
* Getter for <code>buildcommands</code>.
* @return Returns the buildcommands.
*/
@@ -383,6 +388,8 @@
// end validate
+ isJavaProject = !"ear".equals( packaging ) && !"pom".equals( packaging );
+
// defaults
if ( projectnatures == null )
{
@@ -438,10 +445,13 @@
new EclipseSettingsWriter( getLog(), eclipseProjectDir, project, deps ).write();
- new EclipseClasspathWriter( getLog(), eclipseProjectDir, project, deps ).write( projectBaseDir, sourceDirs,
- classpathContainers,
- localRepository,
- buildOutputDirectory );
+ if ( isJavaProject )
+ {
+ new EclipseClasspathWriter( getLog(), eclipseProjectDir, project, deps ).write( projectBaseDir, sourceDirs,
+ classpathContainers,
+ localRepository,
+ buildOutputDirectory );
+ }
getLog().info( Messages.getString( "EclipsePlugin.wrote", new Object[] { //$NON-NLS-1$
project.getArtifactId(), eclipseProjectDir.getAbsolutePath() } ) );
@@ -465,12 +475,19 @@
projectnatures.add( NATURE_WST_FACET_CORE_NATURE ); // WTP 1.0 nature
}
- projectnatures.add( NATURE_JDT_CORE_JAVA );
+ if ( isJavaProject )
+ {
+ projectnatures.add( NATURE_JDT_CORE_JAVA );
+ }
if ( wtpR7 || wtp10 )
{
projectnatures.add( NATURE_WST_MODULE_CORE_NATURE ); // WTP 0.7/1.0 nature
- projectnatures.add( NATURE_JEM_WORKBENCH_JAVA_EMF ); // WTP 0.7/1.0 nature
+
+ if ( isJavaProject )
+ {
+ projectnatures.add( NATURE_JEM_WORKBENCH_JAVA_EMF ); // WTP 0.7/1.0 nature
+ }
}
}
@@ -490,7 +507,10 @@
buildcommands.add( BUILDER_WST_COMPONENT_STRUCTURAL ); // WTP 0.7 builder
}
- buildcommands.add( BUILDER_JDT_CORE_JAVA );
+ if ( isJavaProject )
+ {
+ buildcommands.add( BUILDER_JDT_CORE_JAVA );
+ }
if ( wtpR7 || wtp10 )
{
Modified: maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/AbstractEclipsePluginTestCase.java
URL: http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/AbstractEclipsePluginTestCase.java?rev=390798&r1=390797&r2=390798&view=diff
==============================================================================
--- maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/AbstractEclipsePluginTestCase.java (original)
+++ maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/AbstractEclipsePluginTestCase.java Sun Apr 2 00:16:14 2006
@@ -33,6 +33,7 @@
import org.apache.maven.plugin.ide.IdeUtils;
import org.apache.maven.project.MavenProject;
import org.codehaus.plexus.PlexusTestCase;
+import org.codehaus.plexus.util.IOUtil;
import org.codehaus.plexus.util.StringUtils;
/**
@@ -44,10 +45,19 @@
extends PlexusTestCase
{
+ /**
+ * The embedder.
+ */
protected MavenEmbedder maven;
+ /**
+ * Test repository directory.
+ */
protected File localRepositoryDir = getTestFile( "src/test/m2repo" );
+ /**
+ * @see org.codehaus.plexus.PlexusTestCase#setUp()
+ */
protected void setUp()
throws Exception
{
@@ -61,6 +71,9 @@
super.setUp();
}
+ /**
+ * @see org.codehaus.plexus.PlexusTestCase#tearDown()
+ */
protected void tearDown()
throws Exception
{
@@ -71,12 +84,23 @@
/**
* Execute the eclipse:eclipse goal on a test project and verify generated files.
* @param projectName project directory
- * @param outputDir output dir (if null it's the same as the project)
* @throws Exception any exception generated during test
*/
protected void testProject( String projectName )
throws Exception
{
+ testProject( projectName, new Properties() );
+ }
+
+ /**
+ * Execute the eclipse:eclipse goal on a test project and verify generated files.
+ * @param projectName project directory
+ * @param properties additional properties
+ * @throws Exception any exception generated during test
+ */
+ protected void testProject( String projectName, Properties properties )
+ throws Exception
+ {
File basedir = getTestFile( "src/test/projects/" + projectName );
@@ -102,13 +126,17 @@
this.maven.execute( project, Arrays.asList( new String[] {
"org.apache.maven.plugins:maven-eclipse-plugin:clean",
"org.apache.maven.plugins:maven-eclipse-plugin:eclipse" } ), eventMonitor, new ConsoleDownloadMonitor(),
- new Properties(), basedir );
+ properties, basedir );
assertFileEquals( localRepositoryDir.getCanonicalPath(), new File( basedir, "project" ),
new File( projectOutputDir, ".project" ) );
- assertFileEquals( localRepositoryDir.getCanonicalPath(), new File( basedir, "classpath" ),
- new File( projectOutputDir, ".classpath" ) );
+ File classpathExpectedFile = new File( basedir, "classpath" );
+ if ( classpathExpectedFile.exists() )
+ {
+ assertFileEquals( localRepositoryDir.getCanonicalPath(), classpathExpectedFile, new File( projectOutputDir,
+ ".classpath" ) );
+ }
File wtpModulesExpectedFile = new File( basedir, "wtpmodules" );
if ( wtpModulesExpectedFile.exists() )
@@ -122,6 +150,14 @@
assertFileEquals( localRepositoryDir.getCanonicalPath(), new File( basedir, "settings" ),
new File( projectOutputDir, ".settings/org.eclipse.jdt.core.prefs" ) );
}
+
+ File componentExpectedFile = new File( basedir, "component" );
+ if ( componentExpectedFile.exists() )
+ {
+ assertFileEquals( localRepositoryDir.getCanonicalPath(), componentExpectedFile,
+ new File( projectOutputDir, ".settings/.component" ) );
+ }
+
}
protected void assertFileEquals( String mavenRepo, File expectedFile, File actualFile )
@@ -210,6 +246,8 @@
{
lines.add( line );
}
+
+ IOUtil.close( reader );
return lines;
}
Modified: maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/EclipsePluginTest.java
URL: http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/EclipsePluginTest.java?rev=390798&r1=390797&r2=390798&view=diff
==============================================================================
--- maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/EclipsePluginTest.java (original)
+++ maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/EclipsePluginTest.java Sun Apr 2 00:16:14 2006
@@ -16,6 +16,8 @@
package org.apache.maven.plugin.eclipse;
+import java.util.Properties;
+
/**
* @author <a href="mailto:trygvis@inamo.no">Trygve Laugstøl</a>
* @author <a href="mailto:fgiust@apache.org">Fabrizio Giustina</a>
@@ -91,6 +93,16 @@
throws Exception
{
testProject( "project-11" );
+ }
+
+ /**
+ * Test with ear project
+ * @throws Exception any exception thrown during test
+ */
+ public void testProject12()
+ throws Exception
+ {
+ testProject( "project-12" );
}
}
Added: maven/plugins/trunk/maven-eclipse-plugin/src/test/projects/project-12/component
URL: http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-eclipse-plugin/src/test/projects/project-12/component?rev=390798&view=auto
==============================================================================
--- maven/plugins/trunk/maven-eclipse-plugin/src/test/projects/project-12/component (added)
+++ maven/plugins/trunk/maven-eclipse-plugin/src/test/projects/project-12/component Sun Apr 2 00:16:14 2006
@@ -0,0 +1,5 @@
+<project-modules id="moduleCoreId">
+ <wb-module deploy-name="maven-eclipse-plugin-test-project-12">
+ <wb-resource deploy-path="/" source-path="/"/>
+ </wb-module>
+</project-modules>
\ No newline at end of file
Added: maven/plugins/trunk/maven-eclipse-plugin/src/test/projects/project-12/pom.xml
URL: http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-eclipse-plugin/src/test/projects/project-12/pom.xml?rev=390798&view=auto
==============================================================================
--- maven/plugins/trunk/maven-eclipse-plugin/src/test/projects/project-12/pom.xml (added)
+++ maven/plugins/trunk/maven-eclipse-plugin/src/test/projects/project-12/pom.xml Sun Apr 2 00:16:14 2006
@@ -0,0 +1,20 @@
+<?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">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>eclipse</groupId>
+ <artifactId>maven-eclipse-plugin-test-project-12</artifactId>
+ <version>12</version>
+ <packaging>ear</packaging>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-eclipse-plugin</artifactId>
+ <configuration>
+ <wtpversion>1.0</wtpversion>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Propchange: maven/plugins/trunk/maven-eclipse-plugin/src/test/projects/project-12/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/plugins/trunk/maven-eclipse-plugin/src/test/projects/project-12/pom.xml
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: maven/plugins/trunk/maven-eclipse-plugin/src/test/projects/project-12/project
URL: http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-eclipse-plugin/src/test/projects/project-12/project?rev=390798&view=auto
==============================================================================
--- maven/plugins/trunk/maven-eclipse-plugin/src/test/projects/project-12/project (added)
+++ maven/plugins/trunk/maven-eclipse-plugin/src/test/projects/project-12/project Sun Apr 2 00:16:14 2006
@@ -0,0 +1,15 @@
+<projectDescription>
+ <name>maven-eclipse-plugin-test-project-12</name>
+ <comment/>
+ <projects/>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.wst.validation.validationbuilder</name>
+ <arguments/>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.wst.common.project.facet.core.nature</nature>
+ <nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
+ </natures>
+</projectDescription>
\ No newline at end of file