Author: dantran Date: Sun Jul 15 13:20:23 2007 New Revision: 556442 URL: http://svn.apache.org/viewvc?view=rev&rev=556442 Log: MECLIPSE-129&296. Add eclipse:configure-workspace goal
Added: maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/AbstractWorkspaceMojo.java maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/ConfigureWorkspaceMojo.java maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/workspace/ maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/workspace/EclipseCodeFormatterProfile.java maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/workspace/EclipseWorkspaceWriter.java maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/workspace/WorkspaceConfiguration.java maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/workspace/WorkspaceWriter.java maven/plugins/trunk/maven-eclipse-plugin/src/site/apt/examples/load-code-styles.apt maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/EclipseWorkspaceTest.java maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/writers/workspace/ maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/writers/workspace/EclipseCodeFormatterTest.java maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/workspace-01/ maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/workspace-01/expected/ maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/workspace-01/expected/.metadata/ maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/workspace-01/expected/.metadata/.plugins/ maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/workspace-01/expected/.metadata/.plugins/org.eclipse.core.runtime/ maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/workspace-01/expected/.metadata/.plugins/org.eclipse.core.runtime/.settings/ maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/workspace-01/pom.xml maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/workspace-02/ maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/workspace-02/code-styles.xml maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/workspace-02/expected/ maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/workspace-02/expected/.metadata/ maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/workspace-02/expected/.metadata/.plugins/ maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/workspace-02/expected/.metadata/.plugins/org.eclipse.core.runtime/ maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/workspace-02/expected/.metadata/.plugins/org.eclipse.core.runtime/.settings/ maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/workspace-02/expected/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.ui.prefs maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/workspace-02/pom.xml Modified: maven/plugins/trunk/maven-eclipse-plugin/pom.xml maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/AddMavenRepoMojo.java maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/wtp/EclipseWtpComponentWriter.java maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/ide/IdeUtils.java maven/plugins/trunk/maven-eclipse-plugin/src/site/apt/index.apt 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/AddMavenRepoMojoTest.java maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-28/module-1/pom.xml Modified: maven/plugins/trunk/maven-eclipse-plugin/pom.xml URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/pom.xml?view=diff&rev=556442&r1=556441&r2=556442 ============================================================================== --- maven/plugins/trunk/maven-eclipse-plugin/pom.xml (original) +++ maven/plugins/trunk/maven-eclipse-plugin/pom.xml Sun Jul 15 13:20:23 2007 @@ -30,7 +30,8 @@ <artifactId>maven-eclipse-plugin</artifactId> <packaging>maven-plugin</packaging> <name>Maven Eclipse Plugin</name> - <version>2.5-SNAPSHOT</version> + <version>2.5-555344</version> + <description>Eclipse 2.5 SNAPSHOT at rev 555344 with fixes for the unapprove MECLIPSE-127 and MECLIPSE-296</description> <prerequisites> <maven>2.0.1</maven> </prerequisites> @@ -170,4 +171,23 @@ <version>0.0.145</version> </dependency> </dependencies> + + <distributionManagement> + <site> + <id>iplocks.site</id> + <name>IPLocks Maven Site</name> + <url>file:///\\\\scm.iplocks.com/site</url> + </site> + <repository> + <id>iplocks.releases</id> + <name>IPLocks Release Distribution Repository</name> + <url>file:///\\\\scm.iplocks.com/maven-repositories/interim</url> + </repository> + <snapshotRepository> + <id>iplocks.snapshots</id> + <name>IPlocks Development Snapshot Repository</name> + <url>file:///\\\\scm.iplocks.com/maven-repositories/snapshot</url> + </snapshotRepository> + </distributionManagement> + </project> Added: maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/AbstractWorkspaceMojo.java URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/AbstractWorkspaceMojo.java?view=auto&rev=556442 ============================================================================== --- maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/AbstractWorkspaceMojo.java (added) +++ maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/AbstractWorkspaceMojo.java Sun Jul 15 13:20:23 2007 @@ -0,0 +1,66 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.maven.plugin.eclipse; + +import org.apache.maven.artifact.repository.ArtifactRepository; +import org.apache.maven.plugin.AbstractMojo; + +/** + * + * @requiresProject true + */ +public abstract class AbstractWorkspaceMojo + extends AbstractMojo +{ + + /** + * Directory location of the <code>Eclipse</code> workspace. + * + * @parameter expression="${eclipse.workspace}" + * @required + */ + private String workspace; + + /** + * @parameter expression="${localRepository}" + * @required + * @readonly + */ + private ArtifactRepository localRepository; + + public ArtifactRepository getLocalRepository() + { + return localRepository; + } + + public void setLocalRepository( ArtifactRepository localRepository ) + { + this.localRepository = localRepository; + } + + public String getWorkspace() + { + return workspace; + } + + public void setWorkspace( String workspace ) + { + this.workspace = workspace; + } +} Modified: maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/AddMavenRepoMojo.java URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/AddMavenRepoMojo.java?view=diff&rev=556442&r1=556441&r2=556442 ============================================================================== --- maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/AddMavenRepoMojo.java (original) +++ maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/AddMavenRepoMojo.java Sun Jul 15 13:20:23 2007 @@ -19,131 +19,28 @@ package org.apache.maven.plugin.eclipse; import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.OutputStream; -import java.util.Properties; - -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.eclipse.writers.workspace.EclipseWorkspaceWriter; +import org.apache.maven.plugin.eclipse.writers.workspace.WorkspaceConfiguration; /** * Adds the classpath variable MAVEN_REPO to Eclipse. * * @goal add-maven-repo * @requiresProject false + * @deprecated Use configure-workspace goal instead. */ public class AddMavenRepoMojo - extends AbstractMojo + extends AbstractWorkspaceMojo { - - /** - * Path under Eclipse workspace where Eclipse Plugin metadata/config is - * stored. - */ - public static final String DIR_ECLIPSE_PLUGINS_METADATA = ".metadata/.plugins"; //$NON-NLS-1$ - - /** - * Path under [EMAIL PROTECTED] #DIR_ECLIPSE_PLUGINS_METADATA } folder where Eclipse - * Workspace Runtime settings are stored. - */ - public static final String DIR_ECLIPSE_CORE_RUNTIME_SETTINGS = DIR_ECLIPSE_PLUGINS_METADATA - + "/org.eclipse.core.runtime/.settings"; //$NON-NLS-1$ - - /** - * File that stores the Eclipse JDT Core preferences. - */ - public static final String FILE_ECLIPSE_JDT_CORE_PREFS = "org.eclipse.jdt.core.prefs"; //$NON-NLS-1$ - - /** - * Property constant under which Variable 'M2_REPO' is setup. - */ - public static final String CLASSPATH_VARIABLE_M2_REPO = "org.eclipse.jdt.core.classpathVariable.M2_REPO"; //$NON-NLS-1$ - - /** - * Location of the <code>Eclipse</code> workspace that holds your - * configuration and source. On Windows, this will be the - * <code>workspace</code> directory under your eclipse installation. For - * example, if you installed eclipse into <code>c:\eclipse</code>, the - * workspace is <code>c:\eclipse\workspace</code>. - * - * @parameter expression="${eclipse.workspace}" - * @required - */ - private String workspace; - - /** - * @parameter expression="${localRepository}" - * @required - * @readonly - */ - private ArtifactRepository localRepository; - public void execute() throws MojoExecutionException { + WorkspaceConfiguration config = new WorkspaceConfiguration(); + config.setWorkspaceDirectory( new File( this.getWorkspace() ) ); + config.setLocalRepository( this.getLocalRepository() ); - File workDir = new File( workspace, DIR_ECLIPSE_CORE_RUNTIME_SETTINGS ); - workDir.mkdirs(); - - Properties props = new Properties(); - - File f = new File( workDir, FILE_ECLIPSE_JDT_CORE_PREFS ); - - // preserve old settings - if ( f.exists() ) - { - try - { - props.load( new FileInputStream( f ) ); - } - catch ( FileNotFoundException e ) - { - throw new MojoExecutionException( Messages - .getString( "EclipsePlugin.cantreadfile", f.getAbsolutePath() ), e ); //$NON-NLS-1$ - } - catch ( IOException e ) - { - throw new MojoExecutionException( Messages - .getString( "EclipsePlugin.cantreadfile", f.getAbsolutePath() ), e ); //$NON-NLS-1$ - } - } - - props.put( CLASSPATH_VARIABLE_M2_REPO, localRepository.getBasedir() ); //$NON-NLS-1$ //$NON-NLS-2$ - - try - { - OutputStream os = new FileOutputStream( f ); - props.store( os, null ); - os.close(); - } - catch ( IOException ioe ) - { - throw new MojoExecutionException( Messages.getString( "EclipsePlugin.cantwritetofile", //$NON-NLS-1$ - f.getAbsolutePath() ) ); - } - } - - public ArtifactRepository getLocalRepository() - { - return localRepository; - } - - public void setLocalRepository( ArtifactRepository localRepository ) - { - this.localRepository = localRepository; - } - - public String getWorkspace() - { - return workspace; + new EclipseWorkspaceWriter().init( this.getLog(), config ).write(); } - public void setWorkspace( String workspace ) - { - this.workspace = workspace; - } } Added: maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/ConfigureWorkspaceMojo.java URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/ConfigureWorkspaceMojo.java?view=auto&rev=556442 ============================================================================== --- maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/ConfigureWorkspaceMojo.java (added) +++ maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/ConfigureWorkspaceMojo.java Sun Jul 15 13:20:23 2007 @@ -0,0 +1,79 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license + * agreements. See the NOTICE file distributed with this work for additional information regarding + * copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. You may obtain a + * copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ +package org.apache.maven.plugin.eclipse; + +import java.io.File; +import java.net.MalformedURLException; +import java.net.URL; + +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.eclipse.writers.workspace.EclipseWorkspaceWriter; +import org.apache.maven.plugin.eclipse.writers.workspace.WorkspaceConfiguration; + +/** + * Configures The following Eclipse Workspace features: + * <ul> + * <li>Adds the classpath variable MAVEN_REPO to Eclipse.</li> + * <li>Optionally load Eclipse code style file via a URL.</li> + * </ul> + * + * @goal configure-workspace + * @requiresProject false + */ +public class ConfigureWorkspaceMojo + extends AbstractWorkspaceMojo +{ + /** + * Point to a URL containing code styles content. + * + * @parameter expression="${eclipse.workspaceCodeStylesURL}" + * + */ + private String workspaceCodeStylesURL; + + /** + * Name of a profile in <code>workspaceCodeStylesURL</code> to activate. + * Default is the first profile name in the code style file in <code>workspaceCodeStylesURL</code> + * + * @parameter expression="${eclipse.workspaceActiveCodeStyleProfileName}" + */ + private String workspaceActiveCodeStyleProfileName; + + public void execute() + throws MojoExecutionException + { + WorkspaceConfiguration config = new WorkspaceConfiguration(); + config.setWorkspaceDirectory( new File( this.getWorkspace() ) ); + config.setLocalRepository( this.getLocalRepository() ); + + if ( this.workspaceCodeStylesURL != null ) + { + try + { + config.setCodeStylesURL( new URL( workspaceCodeStylesURL ) ); + } + catch ( MalformedURLException e ) + { + throw new MojoExecutionException( e.getMessage(), e ); + } + + config.setActiveStyleProfileName( workspaceActiveCodeStyleProfileName ); + + } + + new EclipseWorkspaceWriter().init( this.getLog(), config ).write(); + } + +} Added: maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/workspace/EclipseCodeFormatterProfile.java URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/workspace/EclipseCodeFormatterProfile.java?view=auto&rev=556442 ============================================================================== --- maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/workspace/EclipseCodeFormatterProfile.java (added) +++ maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/workspace/EclipseCodeFormatterProfile.java Sun Jul 15 13:20:23 2007 @@ -0,0 +1,126 @@ +package org.apache.maven.plugin.eclipse.writers.workspace; + +import java.io.BufferedReader; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.OutputStream; +import java.io.Reader; +import java.net.URL; + +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.eclipse.Messages; +import org.apache.maven.plugin.logging.Log; +import org.codehaus.plexus.util.IOUtil; +import org.codehaus.plexus.util.xml.Xpp3Dom; +import org.codehaus.plexus.util.xml.Xpp3DomBuilder; +import org.codehaus.plexus.util.xml.pull.XmlPullParserException; + +/** + * an Eclipse code style file + * + * @author dtran + * + */ + +public class EclipseCodeFormatterProfile +{ + private static final String ELT_PROFILES = "profiles"; + + private static final String ELT_PROFILE = "profile"; + + /** + * String presentation of the formatter with EOLs are escaped so that it can + * be embedded in a property value + */ + private String content; + + private String profileName; + + public EclipseCodeFormatterProfile init( URL url, String profileName ) + throws MojoExecutionException + { + + this.profileName = profileName; + + if ( this.profileName == null ) + { + loadDefaultProfileName( url ); + } + + this.convertFormatterToString( url ); + + + return this; + } + + private void loadDefaultProfileName( URL url ) + throws MojoExecutionException + { + Reader reader = null; + try + { + reader = new InputStreamReader( url.openStream() ); + Xpp3Dom dom = Xpp3DomBuilder.build( reader ); + + Xpp3Dom[] existingProfiles = dom.getChildren( ELT_PROFILE ); + if ( existingProfiles.length != 0 ) + { + Xpp3Dom firstProfile = existingProfiles[0]; + this.profileName = firstProfile.getAttribute( "name" ); + } + } + catch ( XmlPullParserException e ) + { + throw new MojoExecutionException ( Messages.getString( "EclipsePlugin.cantparseexisting", url.toString() ) ); //$NON-NLS-1$ + } + catch ( IOException e ) + { + throw new MojoExecutionException ( Messages.getString( "EclipsePlugin.cantparseexisting", url.toString() ) ); //$NON-NLS-1$ + } + finally + { + IOUtil.close( reader ); + } + } + + private void convertFormatterToString( URL url ) + throws MojoExecutionException + { + InputStream is = null; + + ByteArrayOutputStream os = new ByteArrayOutputStream(); + + try + { + is = url.openStream(); + + IOUtil.copy( is, os ); + } + catch ( IOException e ) + { + throw new MojoExecutionException( Messages.getString( "EclipsePlugin.cantreadfile", url.toString() ), e ); //$NON-NLS-1$ + } + finally + { + IOUtil.close( is ); + } + + content = os.toString(); + + + } + + public String getContent() + { + return this.content; + } + + public String getProfileName() + { + return this.profileName; + } + +} Added: maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/workspace/EclipseWorkspaceWriter.java URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/workspace/EclipseWorkspaceWriter.java?view=auto&rev=556442 ============================================================================== --- maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/workspace/EclipseWorkspaceWriter.java (added) +++ maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/workspace/EclipseWorkspaceWriter.java Sun Jul 15 13:20:23 2007 @@ -0,0 +1,156 @@ +package org.apache.maven.plugin.eclipse.writers.workspace; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStream; +import java.util.Properties; + +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.eclipse.Messages; +import org.apache.maven.plugin.logging.Log; +import org.codehaus.plexus.util.IOUtil; + +public class EclipseWorkspaceWriter + implements WorkspaceWriter +{ + + /** + * Path under Eclipse workspace where Eclipse Plugin metadata/config is + * stored. + */ + public static final String ECLIPSE_PLUGINS_METADATA_DIR = ".metadata/.plugins"; //$NON-NLS-1$ + + /** + * Path under [EMAIL PROTECTED] #ECLIPSE_PLUGINS_METADATA_DIR } folder where Eclipse + * Workspace Runtime settings are stored. + */ + public static final String ECLIPSE_CORE_RUNTIME_SETTINGS_DIR = ECLIPSE_PLUGINS_METADATA_DIR + + "/org.eclipse.core.runtime/.settings"; //$NON-NLS-1$ + + /** + * File that stores the Eclipse JDT Core preferences. + */ + public static final String ECLIPSE_JDT_CORE_PREFS_FILE = "org.eclipse.jdt.core.prefs"; //$NON-NLS-1$ + + /** + * Property constant under which Variable 'M2_REPO' is setup. + */ + public static final String CLASSPATH_VARIABLE_M2_REPO = "org.eclipse.jdt.core.classpathVariable.M2_REPO"; //$NON-NLS-1$ + + /** + * File that stores the Eclipse JDT UI preferences. + */ + public static final String ECLIPSE_JDT_UI_PREFS_FILE = "org.eclipse.jdt.ui.prefs"; //$NON-NLS-1$ + + private WorkspaceConfiguration config; + + private Log logger; + + private File workDir; + + public WorkspaceWriter init( Log logger, WorkspaceConfiguration config ) + { + this.logger = logger; + this.config = config; + + workDir = new File( config.getWorkspaceDirectory(), ECLIPSE_CORE_RUNTIME_SETTINGS_DIR ); + workDir.mkdirs(); + + return this; + } + + public void write() + throws MojoExecutionException + { + this.writeLocalRepositoryConfiguration(); + + if ( config.getCodeStylesURL() != null ) + { + this.writeCodeStyleConfiguration(); + } + } + + private void writeCodeStyleConfiguration() + throws MojoExecutionException + { + File f = new File( workDir, ECLIPSE_JDT_UI_PREFS_FILE ); + + Properties props = loadProperties( f ); + + EclipseCodeFormatterProfile codeFormatter = new EclipseCodeFormatterProfile() + .init( config.getCodeStylesURL(), config.getActiveStyleProfileName() ); + + if ( codeFormatter.getProfileName() != null ) + { + logger.info( "Set active code style profile name: " + codeFormatter.getProfileName() ); + props.setProperty( "formatter_profile", "_" + codeFormatter.getProfileName() ); + } + + props.setProperty( "org.eclipse.jdt.ui.formatterprofiles", codeFormatter.getContent() ); + + storeProperties( props, f ); + } + + private void writeLocalRepositoryConfiguration() + throws MojoExecutionException + { + File f = new File( workDir, ECLIPSE_JDT_CORE_PREFS_FILE ); + + Properties props = loadProperties( f ); + + props.put( CLASSPATH_VARIABLE_M2_REPO, config.getLocalRepository().getBasedir() ); //$NON-NLS-1$ //$NON-NLS-2$ + + storeProperties( props, f ); + } + + private static Properties loadProperties( File f ) + throws MojoExecutionException + { + Properties props = new Properties(); + + // preserve old settings + if ( f.exists() ) + { + try + { + props.load( new FileInputStream( f ) ); + } + catch ( FileNotFoundException e ) + { + throw new MojoExecutionException( Messages + .getString( "EclipsePlugin.cantreadfile", f.getAbsolutePath() ), e ); //$NON-NLS-1$ + } + catch ( IOException e ) + { + throw new MojoExecutionException( Messages + .getString( "EclipsePlugin.cantreadfile", f.getAbsolutePath() ), e ); //$NON-NLS-1$ + } + } + + return props; + } + + private static void storeProperties( Properties props, File f ) + throws MojoExecutionException + { + OutputStream os = null; + + try + { + os = new FileOutputStream( f ); + props.store( os, null ); + } + catch ( IOException ioe ) + { + throw new MojoExecutionException( Messages.getString( "EclipsePlugin.cantwritetofile", //$NON-NLS-1$ + f.getAbsolutePath() ) ); + } + finally + { + IOUtil.close( os ); + } + } +} Added: maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/workspace/WorkspaceConfiguration.java URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/workspace/WorkspaceConfiguration.java?view=auto&rev=556442 ============================================================================== --- maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/workspace/WorkspaceConfiguration.java (added) +++ maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/workspace/WorkspaceConfiguration.java Sun Jul 15 13:20:23 2007 @@ -0,0 +1,59 @@ +package org.apache.maven.plugin.eclipse.writers.workspace; + +import java.io.File; +import java.net.URL; + +import org.apache.maven.artifact.repository.ArtifactRepository; + + +public class WorkspaceConfiguration +{ + private File workspaceDirectory; + + private URL codeStylesURL; + + private String activeCodeStyleProfileName; + + private ArtifactRepository localRepository; + + public File getWorkspaceDirectory() + { + return this.workspaceDirectory; + } + + public void setWorkspaceDirectory( File dir ) + { + this.workspaceDirectory = dir; + } + + public URL getCodeStylesURL() + { + return this.codeStylesURL; + } + + public void setCodeStylesURL( URL url ) + { + this.codeStylesURL = url; + } + + public String getActiveStyleProfileName() + { + return this.activeCodeStyleProfileName; + } + + public void setActiveStyleProfileName( String name ) + { + this.activeCodeStyleProfileName = name; + } + + public ArtifactRepository getLocalRepository() + { + return localRepository; + } + + public void setLocalRepository( ArtifactRepository localRepository ) + { + this.localRepository = localRepository; + } + +} Added: maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/workspace/WorkspaceWriter.java URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/workspace/WorkspaceWriter.java?view=auto&rev=556442 ============================================================================== --- maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/workspace/WorkspaceWriter.java (added) +++ maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/workspace/WorkspaceWriter.java Sun Jul 15 13:20:23 2007 @@ -0,0 +1,41 @@ +package org.apache.maven.plugin.eclipse.writers.workspace; + +/* + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license + * agreements. See the NOTICE file distributed with this work for additional information regarding + * copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. You may obtain a + * copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.logging.Log; + +/** + * @author Dan T. Tran + * @version $Id:$ + */ + +public interface WorkspaceWriter +{ + /** + * Init this writer. + * @param log mojo logger. + * @param config writer configuration. + * @return the writer instance + */ + WorkspaceWriter init( Log log, WorkspaceConfiguration config ); + + /** + * Main method that should be implemented by the writer to do the work. + * @throws MojoExecutionException + */ + void write() throws MojoExecutionException; +} Modified: maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/wtp/EclipseWtpComponentWriter.java URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/wtp/EclipseWtpComponentWriter.java?view=diff&rev=556442&r1=556441&r2=556442 ============================================================================== --- maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/wtp/EclipseWtpComponentWriter.java (original) +++ maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/wtp/EclipseWtpComponentWriter.java Sun Jul 15 13:20:23 2007 @@ -131,16 +131,16 @@ { target = "/WEB-INF/classes"; //$NON-NLS-1$ - String warSourceDirectory = IdeUtils.getPluginSetting( config.getProject(), ARTIFACT_MAVEN_WAR_PLUGIN, + File warSourceDirectory = new File( IdeUtils.getPluginSetting( config.getProject(), ARTIFACT_MAVEN_WAR_PLUGIN, "warSourceDirectory", //$NON-NLS-1$ - config.getProject().getBasedir()+"/src/main/webapp" ); //$NON-NLS-1$ - + config.getProject().getBasedir()+"/src/main/webapp" ) ); //$NON-NLS-1$ + writeContextRoot( writer ); writer.startElement( ELT_WB_RESOURCE ); writer.addAttribute( ATTR_DEPLOY_PATH, "/" ); //$NON-NLS-1$ writer.addAttribute( ATTR_SOURCE_PATH, IdeUtils - .toRelativeAndFixSeparator( config.getEclipseProjectDirectory(), new File( warSourceDirectory ), false ) ); + .toRelativeAndFixSeparator( config.getEclipseProjectDirectory(), warSourceDirectory, false ) ); writer.endElement(); // @todo is this really needed? Modified: maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/ide/IdeUtils.java URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/ide/IdeUtils.java?view=diff&rev=556442&r1=556441&r2=556442 ============================================================================== --- maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/ide/IdeUtils.java (original) +++ maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/ide/IdeUtils.java Sun Jul 15 13:20:23 2007 @@ -299,6 +299,11 @@ public static String toRelativeAndFixSeparator( File basedir, File fileToAdd, boolean replaceSlashesWithDashes ) throws MojoExecutionException { + if ( ! fileToAdd.isAbsolute() ) + { + fileToAdd = new File( basedir, fileToAdd.getPath() ); + } + String basedirpath; String absolutePath; Added: maven/plugins/trunk/maven-eclipse-plugin/src/site/apt/examples/load-code-styles.apt URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/site/apt/examples/load-code-styles.apt?view=auto&rev=556442 ============================================================================== --- maven/plugins/trunk/maven-eclipse-plugin/src/site/apt/examples/load-code-styles.apt (added) +++ maven/plugins/trunk/maven-eclipse-plugin/src/site/apt/examples/load-code-styles.apt Sun Jul 15 13:20:23 2007 @@ -0,0 +1,48 @@ + ------ + Loading Code Styles File + ------ + Dan T. Tran + ------ + 13 June 2007 + ------ + + +Load Coding Styles into Workspace + + External coding style file can be loaded into your Eclipse workspace via a URL. + + The following example shows how set Maven code style format to a workspace + under your current directory. + ++----- + +mvn eclipse:eclipse -Declipse.workspace=. + -Declipse.workspaceCodeStyleURL=http://svn.apache.org/repos/asf/maven/plugins/trunk/maven-eclipse-plugin/src/optional/eclipse-config/maven-styles.xml + ++----- + + or in your pom.xml: + ++----- +<project> + [...] + <build> + [...] + <plugins> + [...] + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-eclipse-plugin</artifactId> + <configuration> + <workspace>${basedir}</workspace> + <workspaceCodeStylesURL>http://svn.apache.org/repos/asf/maven/plugins/trunk/maven-eclipse-plugin/src/optional/eclipse-config/maven-styles.xml</workspaceCodeStylesURL> + </configuration> + </plugin> + [...] + </plugins> + [...] + </build> + [...] +</project> ++----- + Modified: maven/plugins/trunk/maven-eclipse-plugin/src/site/apt/index.apt URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/site/apt/index.apt?view=diff&rev=556442&r1=556441&r2=556442 ============================================================================== --- maven/plugins/trunk/maven-eclipse-plugin/src/site/apt/index.apt (original) +++ maven/plugins/trunk/maven-eclipse-plugin/src/site/apt/index.apt Sun Jul 15 13:20:23 2007 @@ -18,7 +18,11 @@ * {{{add-maven-repo-mojo.html}eclipse:add-maven-repo}} is used to add the classpath variable MAVEN_REPO to Eclipse which points to your local - repository. + repository. This goal is deprecated, please use eclipse:configure-workspace instead + + * {{{configure-workspace-mojo.html}eclipse:configure-workspace}} is used to add the + classpath variable MAVEN_REPO to Eclipse which points to your local repository and + optional to configure other workspace features. * {{{clean-mojo.html}eclipse:clean}} is used to delete the files used by the Eclipse IDE. @@ -59,3 +63,6 @@ * {{{examples/provide-project-natures-and-build-commands.html}Provide Project Natures and Build Commands}} * {{{examples/additional-facets.html}Adding additional facets}} + + * {{{examples/load-code-styles.html}Load Code Style file}} + \ No newline at end of file Modified: maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/AbstractEclipsePluginTestCase.java URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/AbstractEclipsePluginTestCase.java?view=diff&rev=556442&r1=556441&r2=556442 ============================================================================== --- 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 Jul 15 13:20:23 2007 @@ -32,6 +32,7 @@ import junit.framework.AssertionFailedError; +import org.apache.maven.plugin.eclipse.writers.workspace.EclipseWorkspaceWriter; import org.apache.maven.plugin.ide.IdeUtils; import org.apache.maven.project.MavenProject; import org.apache.maven.shared.invoker.InvocationRequest; @@ -249,6 +250,81 @@ } + /** + * Execute the eclipse:configure-workspace goal on a test project and verify generated files. + * @param projectName project directory + * @throws Exception any exception generated during test + */ + protected void testWorkspace( String projectName ) + throws Exception + { + testWorkspace( projectName, new Properties(), "configure-workspace" ); + } + + /** + * Execute the eclipse:configure-workspace goal on a test project and verify generated files. + * @param projectName project directory + * @throws Exception any exception generated during test + */ + protected void testWorkspace( String projectName, String goal ) + throws Exception + { + testWorkspace( projectName, new Properties(), goal ); + } + /** + * Execute the eclipse:configure-workspace goal on a test project and verify generated files. + * @param projectName project directory + * @param properties additional properties + * @param cleanGoal TODO + * @param genGoal TODO + * @throws Exception any exception generated during test + */ + protected void testWorkspace( String projectName, Properties properties, String genGoal ) + throws Exception + { + File basedir = getOutputDirectory( projectName ); + + File pom = new File( basedir, "pom.xml" ); + + String pluginSpec = getPluginCLISpecification(); + + List goals = new ArrayList(); + + goals.add( pluginSpec + genGoal ); + + executeMaven( pom, properties, goals ); + + MavenProject project = readProject( pom ); + + String outputDirPath = IdeUtils.getPluginSetting( project, "maven-eclipse-plugin", "outputDir", null ); + File outputDir; + File projectOutputDir = basedir; + + if ( outputDirPath == null ) + { + outputDir = basedir; + } + else + { + outputDir = new File( basedir, outputDirPath ); + outputDir.mkdirs(); + projectOutputDir = new File( outputDir, project.getArtifactId() ); + } + + compareDirectoryContent( basedir, projectOutputDir, EclipseWorkspaceWriter.ECLIPSE_CORE_RUNTIME_SETTINGS_DIR + "/" ); + + } + + protected File getOutputDirectory( String projectName ) + { + return getTestFile( "target/test-classes/projects/" + projectName ); + } + + protected File getTestWorkspaceWorkDirectory( String projectName ) + { + return new File( this.getOutputDirectory( projectName ), ".metadata" ); + } + protected void executeMaven( File pom, Properties properties, List goals ) throws TestToolsException, ExecutionFailedException { Modified: maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/AddMavenRepoMojoTest.java URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/AddMavenRepoMojoTest.java?view=diff&rev=556442&r1=556441&r2=556442 ============================================================================== --- maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/AddMavenRepoMojoTest.java (original) +++ maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/AddMavenRepoMojoTest.java Sun Jul 15 13:20:23 2007 @@ -18,6 +18,7 @@ */ package org.apache.maven.plugin.eclipse; +import org.apache.maven.plugin.eclipse.writers.workspace.EclipseWorkspaceWriter; import org.apache.maven.plugin.testing.AbstractMojoTestCase; import org.codehaus.plexus.PlexusTestCase; @@ -43,16 +44,16 @@ mojo.execute(); - File workDir = new File( mojo.getWorkspace(), AddMavenRepoMojo.DIR_ECLIPSE_CORE_RUNTIME_SETTINGS ); + File workDir = new File( mojo.getWorkspace(), EclipseWorkspaceWriter.ECLIPSE_CORE_RUNTIME_SETTINGS_DIR ); - File eclipseJDTCorePrefsFile = new File( workDir, AddMavenRepoMojo.FILE_ECLIPSE_JDT_CORE_PREFS ); + File eclipseJDTCorePrefsFile = new File( workDir, EclipseWorkspaceWriter.ECLIPSE_JDT_CORE_PREFS_FILE ); assertTrue( "Test if workspace properties exists", eclipseJDTCorePrefsFile.exists() ); Properties props = new Properties(); props.load( new FileInputStream( eclipseJDTCorePrefsFile ) ); - String M2_REPO = props.getProperty( AddMavenRepoMojo.CLASSPATH_VARIABLE_M2_REPO ); + String M2_REPO = props.getProperty( EclipseWorkspaceWriter.CLASSPATH_VARIABLE_M2_REPO ); assertNotNull( "Test M2_REPO has a value", M2_REPO ); Added: maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/EclipseWorkspaceTest.java URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/EclipseWorkspaceTest.java?view=auto&rev=556442 ============================================================================== --- maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/EclipseWorkspaceTest.java (added) +++ maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/EclipseWorkspaceTest.java Sun Jul 15 13:20:23 2007 @@ -0,0 +1,99 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license + * agreements. See the NOTICE file distributed with this work for additional information regarding + * copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. You may obtain a + * copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ +package org.apache.maven.plugin.eclipse; + +import java.io.File; +import java.io.FileInputStream; +import java.util.Properties; + +import org.apache.maven.plugin.eclipse.writers.workspace.EclipseWorkspaceWriter; +import org.codehaus.plexus.PlexusTestCase; +import org.codehaus.plexus.util.FileUtils; + +/** + * @version $Id: $ + */ +public class EclipseWorkspaceTest + extends AbstractEclipsePluginTestCase +{ + + private static final String ECLIPSE_JDT_CORE_PREFS_PATH = EclipseWorkspaceWriter.ECLIPSE_CORE_RUNTIME_SETTINGS_DIR + + "/" + EclipseWorkspaceWriter.ECLIPSE_JDT_CORE_PREFS_FILE; + + private static final String ECLIPSE_JDT_UI_PREFS_PATH = EclipseWorkspaceWriter.ECLIPSE_CORE_RUNTIME_SETTINGS_DIR + + "/" + EclipseWorkspaceWriter.ECLIPSE_JDT_UI_PREFS_FILE; + + protected void setUp() + throws Exception + { + super.setUp(); + } + + public void testWorkspace01() + throws Exception + { + String projectName = "workspace-01"; + + FileUtils.deleteDirectory( this.getTestWorkspaceWorkDirectory( "add-maven-repo" ) ); + testWorkspace( projectName, "add-maven-repo" ); + + this.validateM2REPOVar( projectName ); + + File eclipseJDTUIPrefsFile = new File( this.getOutputDirectory( projectName ), ECLIPSE_JDT_UI_PREFS_PATH ); + + assertFalse( eclipseJDTUIPrefsFile.exists() ); + } + + public void testWorkspace02() + throws Exception + { + // In this test we purposely do not include expected/.metatdata/.plugins/org.eclipse.core.runtime.settings/org.eclipse.jdt.core.prefs + // The content of that file is heavily depended on the location of the test + + String projectName = "workspace-02"; + + FileUtils.deleteDirectory( this.getTestWorkspaceWorkDirectory( projectName ) ); + testWorkspace( projectName ); + + this.validateM2REPOVar( projectName ); + + File eclipseJDTUIPrefsFile = new File( this.getOutputDirectory( projectName ), ECLIPSE_JDT_UI_PREFS_PATH ); + + assertTrue( eclipseJDTUIPrefsFile.exists() ); + + + } + + private void validateM2REPOVar( String projectName ) + throws Exception + { + File eclipseJDTCorePrefsFile = new File( this.getOutputDirectory( projectName ), ECLIPSE_JDT_CORE_PREFS_PATH ); + + assertTrue( "Test if workspace properties exists", eclipseJDTCorePrefsFile.exists() ); + + Properties props = new Properties(); + props.load( new FileInputStream( eclipseJDTCorePrefsFile ) ); + + String M2_REPO = props.getProperty( EclipseWorkspaceWriter.CLASSPATH_VARIABLE_M2_REPO ); + + assertNotNull( "Test M2_REPO has a value", M2_REPO ); + + String localRepo = PlexusTestCase.getBasedir() + "/target/test-classes/m2repo"; + + assertEquals( "Test M2_REPO value", localRepo.replace( '\\', '/' ), M2_REPO.replace( '\\', '/' ) ); + + } + +} Added: maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/writers/workspace/EclipseCodeFormatterTest.java URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/writers/workspace/EclipseCodeFormatterTest.java?view=auto&rev=556442 ============================================================================== --- maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/writers/workspace/EclipseCodeFormatterTest.java (added) +++ maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/writers/workspace/EclipseCodeFormatterTest.java Sun Jul 15 13:20:23 2007 @@ -0,0 +1,39 @@ +package org.apache.maven.plugin.eclipse.writers.workspace; + +/* + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license + * agreements. See the NOTICE file distributed with this work for additional information regarding + * copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. You may obtain a + * copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +import java.io.File; + +import junit.framework.TestCase; + +public class EclipseCodeFormatterTest + extends TestCase +{ + private static File basedir = new File( System.getProperty( "basedir", "." ) ); + + public void testLoadFormatter() + throws Exception + { + File testStyleFile = new File( basedir, "src/test/resources/projects/workspace-02/code-styles.xml" ); + + EclipseCodeFormatterProfile formatter = new EclipseCodeFormatterProfile(); + formatter.init( testStyleFile.toURL(), null ); + + assertEquals( "format-1", formatter.getProfileName() ); + + //see integration test on workspace-02 for content validation + } +} Modified: maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-28/module-1/pom.xml URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-28/module-1/pom.xml?view=diff&rev=556442&r1=556441&r2=556442 ============================================================================== --- maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-28/module-1/pom.xml (original) +++ maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-28/module-1/pom.xml Sun Jul 15 13:20:23 2007 @@ -23,6 +23,14 @@ <wtpContextName>contextName</wtpContextName> </configuration> </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-war-plugin</artifactId> + <configuration> + <!-- make sure this plugin can handle explicitly set warSoruceDirectory in reactor mode --> + <warSourceDirectory>src/main/webapp</warSourceDirectory> + </configuration> + </plugin> </plugins> </build> </project> Added: maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/workspace-01/pom.xml URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/workspace-01/pom.xml?view=auto&rev=556442 ============================================================================== --- maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/workspace-01/pom.xml (added) +++ maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/workspace-01/pom.xml Sun Jul 15 13:20:23 2007 @@ -0,0 +1,22 @@ +<?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-worksapce-1</artifactId> + <version>99.0</version> + <name>Maven</name> + <packaging>pom</packaging> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-eclipse-plugin</artifactId> + <version>test</version> + <configuration> + <workspace>${basedir}</workspace> + </configuration> + </plugin> + </plugins> + </build> +</project> Added: maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/workspace-02/code-styles.xml URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/workspace-02/code-styles.xml?view=auto&rev=556442 ============================================================================== --- maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/workspace-02/code-styles.xml (added) +++ maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/workspace-02/code-styles.xml Sun Jul 15 13:20:23 2007 @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="UTF-8"?> +<profiles version="11"> +<profile kind="CodeFormatterProfile" name="format-1" version="11"> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter" value="insert"/> +</profile> +<profile kind="CodeFormatterProfile" name="format-2" version="11"> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if" value="insert"/> +<setting id="org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter" value="insert"/> +</profile> +</profiles> Added: maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/workspace-02/expected/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.ui.prefs URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/workspace-02/expected/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.ui.prefs?view=auto&rev=556442 ============================================================================== --- maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/workspace-02/expected/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.ui.prefs (added) +++ maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/workspace-02/expected/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.ui.prefs Sun Jul 15 13:20:23 2007 @@ -0,0 +1,3 @@ +#Mon Jul 09 15:32:24 PDT 2007 +org.eclipse.jdt.ui.formatterprofiles=<?xml version\="1.0" encoding\="UTF-8"?>\n<profiles version\="11">\n<profile kind\="CodeFormatterProfile" name\="format-1" version\="11">\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if" value\="insert"/>\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter" value\="insert"/>\n</profile>\n<profile kind\="CodeFormatterProfile" name\="format-2" version\="11">\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if" value\="insert"/>\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter" value\="insert"/>\n</profile>\n</profiles>\n +formatter_profile=_format-1 Added: maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/workspace-02/pom.xml URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/workspace-02/pom.xml?view=auto&rev=556442 ============================================================================== --- maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/workspace-02/pom.xml (added) +++ maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/workspace-02/pom.xml Sun Jul 15 13:20:23 2007 @@ -0,0 +1,23 @@ +<?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-worksapce-2</artifactId> + <version>99.0</version> + <name>Maven</name> + <packaging>pom</packaging> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-eclipse-plugin</artifactId> + <version>test</version> + <configuration> + <workspace>${basedir}</workspace> + <workspaceCodeStylesURL>file:///${basedir}/code-styles.xml</workspaceCodeStylesURL> + </configuration> + </plugin> + </plugins> + </build> +</project>