You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by kr...@apache.org on 2013/08/27 20:25:11 UTC
svn commit: r1517906 [12/24] - in /maven/plugins/trunk:
maven-acr-plugin/src/main/java/org/apache/maven/plugin/acr/
maven-ant-plugin/src/main/java/org/apache/maven/plugin/ant/
maven-ant-plugin/src/test/java/org/apache/maven/plugin/ant/stubs/
maven-antr...
Modified: maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/InstallPluginsMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/InstallPluginsMojo.java?rev=1517906&r1=1517905&r2=1517906&view=diff
==============================================================================
--- maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/InstallPluginsMojo.java (original)
+++ maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/InstallPluginsMojo.java Tue Aug 27 18:25:03 2013
@@ -47,9 +47,9 @@ import org.codehaus.plexus.util.FileUtil
/**
* Install plugins resolved from the Maven repository system into an Eclipse instance.
- *
- * @author jdcasey
+ *
* @goal install-plugins
+ * @author jdcasey
* @requiresDependencyResolution compile
*/
public class InstallPluginsMojo
@@ -64,14 +64,14 @@ public class InstallPluginsMojo
/**
* This is the installed base directory of the Eclipse instance you want to modify.
- *
+ *
* @parameter expression="${eclipseDir}"
*/
private File eclipseDir;
/**
* Determines whether this mojo leaves existing installed plugins as-is, or overwrites them.
- *
+ *
* @parameter expression="${overwrite}" default-value="false"
*/
private boolean overwrite;
@@ -79,7 +79,7 @@ public class InstallPluginsMojo
/**
* The list of resolved dependencies from the current project. Since we're not resolving the dependencies by hand
* here, the build will fail if some of these dependencies do not resolve.
- *
+ *
* @parameter default-value="${project.artifacts}"
* @required
* @readonly
@@ -89,14 +89,14 @@ public class InstallPluginsMojo
/**
* Comma-delimited list of dependency <type/> values which will be installed in the eclipse instance's plugins
* directory.
- *
+ *
* @parameter expression="${pluginDependencyTypes}" default-value="jar"
*/
private String pluginDependencyTypes;
/**
* The location of the Maven local repository, from which to install resolved dependency plugins.
- *
+ *
* @parameter default-value="${localRepository}"
* @required
* @readonly
@@ -106,7 +106,7 @@ public class InstallPluginsMojo
/**
* Used to retrieve the project metadata (POM) associated with each plugin dependency, to help determine whether
* that plugin should be installed as a jar, or expanded into a directory.
- *
+ *
* @component
*/
private MavenProjectBuilder projectBuilder;
@@ -115,14 +115,14 @@ public class InstallPluginsMojo
* Used to configure and retrieve an appropriate tool for extracting each resolved plugin dependency. It is
* conceivable that some resolved dependencies could be zip files, jar files, or other types, so the manager
* approach is a convenient way to provide extensibility here.
- *
+ *
* @component
*/
private ArchiverManager archiverManager;
/**
* Input handler, needed for comand line handling.
- *
+ *
* @component
*/
private InputHandler inputHandler;
@@ -191,33 +191,28 @@ public class InstallPluginsMojo
eclipseDir.mkdirs();
}
- for ( Object artifact1 : artifacts )
- {
+ for (Object artifact1 : artifacts) {
Artifact artifact = (Artifact) artifact1;
- if ( pluginDependencyTypes.contains( artifact.getType() ) )
- {
- getLog().debug( "Processing Eclipse plugin dependency: " + artifact.getId() );
+ if (pluginDependencyTypes.contains(artifact.getType())) {
+ getLog().debug("Processing Eclipse plugin dependency: " + artifact.getId());
MavenProject project;
- try
- {
+ try {
project =
- projectBuilder.buildFromRepository( artifact, Collections.EMPTY_LIST, localRepository, true );
- }
- catch ( ProjectBuildingException e )
- {
- throw new MojoExecutionException( "Failed to load project metadata (POM) for: " + artifact.getId(),
- e );
+ projectBuilder.buildFromRepository(artifact, Collections.EMPTY_LIST, localRepository, true);
+ } catch (ProjectBuildingException e) {
+ throw new MojoExecutionException("Failed to load project metadata (POM) for: " + artifact.getId(),
+ e);
}
- install( artifact, project );
- }
- else
- {
- getLog().debug( "Skipping dependency: " + artifact.getId()
- + ". Set pluginDependencyTypes with a comma-separated list of types to change this." );
+ install(artifact, project);
+ } else {
+ getLog().debug(
+ "Skipping dependency: "
+ + artifact.getId()
+ + ". Set pluginDependencyTypes with a comma-separated list of types to change this.");
}
}
}
@@ -237,14 +232,14 @@ public class InstallPluginsMojo
* Warn whenever a plugin will overwrite an existing file or directory, and emit an INFO message whenever a plugin
* installation is skipped because of an existing file and overwrite == false.
* </p>
- *
+ *
* @param artifact The plugin dependency as it has been resolved.
- * @param project The project metadata for the accompanying plugin-dependency artifact, used to determine whether to
- * install as a jar or as a directory
+ * @param project The project metadata for the accompanying plugin-dependency artifact, used to determine whether to
+ * install as a jar or as a directory
* @throws MojoExecutionException In the event the plugin should be extracted but cannot, or the file copy fails (in
- * the event it should not be extracted)
- * @throws MojoFailureException In the event that the plugins target directory (inside the Eclipse instance
- * directory) does not exist, or is not a directory.
+ * the event it should not be extracted)
+ * @throws MojoFailureException In the event that the plugins target directory (inside the Eclipse instance
+ * directory) does not exist, or is not a directory.
*/
private void install( Artifact artifact, MavenProject project )
throws MojoExecutionException, MojoFailureException
@@ -256,8 +251,8 @@ public class InstallPluginsMojo
if ( !pluginsDir.exists() || !pluginsDir.isDirectory() )
{
- throw new MojoFailureException(
- "Invalid Eclipse directory: " + eclipseDir + " (plugins directory is missing or not a directory)." );
+ throw new MojoFailureException( "Invalid Eclipse directory: " + eclipseDir
+ + " (plugins directory is missing or not a directory)." );
}
boolean installAsJar = true;
@@ -265,7 +260,7 @@ public class InstallPluginsMojo
Properties properties = project.getProperties();
if ( properties != null )
{
- installAsJar = !Boolean.valueOf( properties.getProperty( PROP_UNPACK_PLUGIN, "false" ) );
+ installAsJar = !Boolean.valueOf(properties.getProperty(PROP_UNPACK_PLUGIN, "false"));
}
Attributes attributes;
@@ -276,7 +271,8 @@ public class InstallPluginsMojo
Manifest manifest = jar.getManifest();
if ( manifest == null )
{
- getLog().debug( "Ignoring " + artifact.getArtifactId()
+ getLog().debug(
+ "Ignoring " + artifact.getArtifactId()
+ " as it is does not have a Manifest (and so is not an OSGi bundle)" );
return;
}
@@ -284,8 +280,8 @@ public class InstallPluginsMojo
}
catch ( IOException e )
{
- throw new MojoExecutionException(
- "Unable to read manifest of plugin " + artifact.getFile().getAbsolutePath(), e );
+ throw new MojoExecutionException( "Unable to read manifest of plugin "
+ + artifact.getFile().getAbsolutePath(), e );
}
String pluginName = formatEclipsePluginName( artifact );
@@ -300,7 +296,8 @@ public class InstallPluginsMojo
Object bundleSymbolicName = attributes.getValue( "Bundle-SymbolicName" );
if ( bundleSymbolicName == null && bundleName == null )
{
- getLog().debug( "Ignoring " + artifact.getArtifactId()
+ getLog().debug(
+ "Ignoring " + artifact.getArtifactId()
+ " as it is not an OSGi bundle (no Bundle-SymbolicName or Bundle-Name in manifest)" );
return;
}
@@ -320,8 +317,8 @@ public class InstallPluginsMojo
}
catch ( IOException e )
{
- throw new MojoExecutionException(
- "Failed to remove old plugin from: " + pluginFile + " or: " + pluginDir, e );
+ throw new MojoExecutionException( "Failed to remove old plugin from: " + pluginFile + " or: "
+ + pluginDir, e );
}
getLog().debug( "Removal of old plugin is complete; proceeding with plugin installation." );
@@ -348,12 +345,14 @@ public class InstallPluginsMojo
{
if ( installAsJar )
{
- getLog().info( "Skipping plugin installation for: " + artifact.getId() + "; file: " + pluginFile
+ getLog().info(
+ "Skipping plugin installation for: " + artifact.getId() + "; file: " + pluginFile
+ " already exists. Set overwrite = true to override this." );
}
else if ( !installAsJar )
{
- getLog().info( "Skipping plugin installation for: " + artifact.getId() + "; directory: " + pluginDir
+ getLog().info(
+ "Skipping plugin installation for: " + artifact.getId() + "; directory: " + pluginDir
+ " already exists. Set overwrite = true to override this." );
}
}
@@ -374,9 +373,8 @@ public class InstallPluginsMojo
}
catch ( IOException e )
{
- throw new MojoExecutionException(
- "Failed to copy Eclipse plugin: " + artifact.getId() + "\nfrom: " + artifact.getFile() + "\nto: "
- + pluginFile, e );
+ throw new MojoExecutionException( "Failed to copy Eclipse plugin: " + artifact.getId() + "\nfrom: "
+ + artifact.getFile() + "\nto: " + pluginFile, e );
}
}
else
@@ -412,8 +410,8 @@ public class InstallPluginsMojo
*/
private String formatEclipsePluginName( Artifact artifact )
{
- return maven2OsgiConverter.getBundleSymbolicName( artifact ) + "_" + maven2OsgiConverter.getVersion(
- artifact.getVersion() );
+ return maven2OsgiConverter.getBundleSymbolicName( artifact ) + "_"
+ + maven2OsgiConverter.getVersion( artifact.getVersion() );
}
}
Modified: maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/MyEclipsePlugin.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/MyEclipsePlugin.java?rev=1517906&r1=1517905&r2=1517906&view=diff
==============================================================================
--- maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/MyEclipsePlugin.java (original)
+++ maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/MyEclipsePlugin.java Tue Aug 27 18:25:03 2013
@@ -15,11 +15,11 @@ import org.apache.maven.plugin.ide.JeeUt
/**
* Generates MyEclipse configuration files
- *
+ *
* @author <a href="mailto:olivier.jacob@gmail.com">Olivier Jacob</a>
* @goal myeclipse
- * @execute phase="generate-resources"
* @since 2.5
+ * @execute phase="generate-resources"
*/
public class MyEclipsePlugin
extends EclipsePlugin
@@ -61,7 +61,7 @@ public class MyEclipsePlugin
/**
* Spring configuration placeholder
* <p/>
- * <p/>
+ *
* <pre>
* <spring>
* <version>1.0/2.0</version>
@@ -69,7 +69,7 @@ public class MyEclipsePlugin
* <basedir>src/main/resources</basedir>
* </spring>
* </pre>
- *
+ *
* @parameter
*/
private Map spring;
@@ -77,14 +77,14 @@ public class MyEclipsePlugin
/**
* Hibernate configuration placeholder
* <p/>
- * <p/>
+ *
* <pre>
* <hibernate>
* <config-file>src/main/resources/applicationContext-persistence.xml</config-file>
* <session-factory-id>mySessionFactory</session-factory-id>
* </hibernate>
* </pre>
- *
+ *
* @parameter
*/
private Map hibernate;
@@ -92,7 +92,7 @@ public class MyEclipsePlugin
/**
* Allow declaration of struts properties for MyEclipse
* <p/>
- * <p/>
+ *
* <pre>
* <struts>
* <version>1.2.9</version>
@@ -101,7 +101,7 @@ public class MyEclipsePlugin
* <base-package>1.2.9</base-package>
* </struts>
* </pre>
- *
+ *
* @parameter
*/
private Map struts;
@@ -124,11 +124,9 @@ public class MyEclipsePlugin
"/src/main/webapp" ); //$NON-NLS-1$
EclipseSourceDir[] sourceDirs = config.getSourceDirs();
- for ( EclipseSourceDir sourceDir : sourceDirs )
- {
- if ( !sourceDir.isTest() )
- {
- sourceDir.setOutput( warSourceDirectory + "/WEB-INF/classes" );
+ for (EclipseSourceDir sourceDir : sourceDirs) {
+ if (!sourceDir.isTest()) {
+ sourceDir.setOutput(warSourceDirectory + "/WEB-INF/classes");
}
}
}
@@ -154,7 +152,7 @@ public class MyEclipsePlugin
/**
* Override the default builders with the builders used by MyEclipse
- *
+ *
* @param packaging packaging-type (jar,war,ejb,ear)
*/
protected void fillDefaultBuilders( String packaging )
@@ -212,7 +210,7 @@ public class MyEclipsePlugin
/**
* Override the default natures with the natures used by MyEclipse
- *
+ *
* @param packaging packaging-type (jar,war,ejb,ear)
*/
protected void fillDefaultNatures( String packaging )
@@ -277,8 +275,8 @@ public class MyEclipsePlugin
}
else
{
- j2eeVersion = JeeUtils.getJeeDescriptorFromServletVersion(
- JeeUtils.resolveServletVersion( project ) ).getJeeVersion();
+ j2eeVersion =
+ JeeUtils.getJeeDescriptorFromServletVersion( JeeUtils.resolveServletVersion( project ) ).getJeeVersion();
}
if ( "1.3".equals( j2eeVersion ) )
Modified: maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/RadCleanMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/RadCleanMojo.java?rev=1517906&r1=1517905&r2=1517906&view=diff
==============================================================================
--- maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/RadCleanMojo.java (original)
+++ maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/RadCleanMojo.java Tue Aug 27 18:25:03 2013
@@ -28,7 +28,7 @@ import org.codehaus.plexus.util.FileUtil
/**
* Deletes the config files used by Rad-6. the files .j2ee and the file .websettings
- *
+ *
* @author <a href="mailto:nir@cfc.at">Richard van Nieuwenhoven</a>
* @goal rad-clean
*/
@@ -37,7 +37,7 @@ public class RadCleanMojo
{
/**
* The project whose project files to clean.
- *
+ *
* @parameter expression="${project}"
* @required
* @readonly
@@ -56,7 +56,7 @@ public class RadCleanMojo
/**
* getter for the instancevarriable project.
- *
+ *
* @return the maven project decriptor
*/
public MavenProject getProject()
@@ -66,7 +66,7 @@ public class RadCleanMojo
/**
* getter for the instancevarriable project.
- *
+ *
* @param project the maven project decriptor
*/
public void setProject( MavenProject project )
@@ -76,7 +76,7 @@ public class RadCleanMojo
/**
* Delete all jars in the EAR project root directory.
- *
+ *
* @throws MojoExecutionException only if a file exists and can't be deleted
*/
private void handleEarLibs()
@@ -89,7 +89,7 @@ public class RadCleanMojo
/**
* Delete all jars in the project that were required by rad6.
- *
+ *
* @throws MojoExecutionException only if a file exists and can't be deleted
*/
private void handleLibs()
@@ -108,7 +108,7 @@ public class RadCleanMojo
/**
* Delete all jars in the WAR project WEB-INF/lib directory.
- *
+ *
* @throws MojoExecutionException only if a file exists and can't be deleted
*/
private void handleWarLibs()
@@ -116,10 +116,10 @@ public class RadCleanMojo
{
File basedir = this.project.getBasedir();
- File warSourceDirectory = new File(
- IdeUtils.getPluginSetting( this.project, JeeUtils.ARTIFACT_MAVEN_WAR_PLUGIN, "warSourceDirectory",
- //$NON-NLS-1$
- "src/main/webapp" ) ); //$NON-NLS-1$
+ File warSourceDirectory =
+ new File( IdeUtils.getPluginSetting( this.project, JeeUtils.ARTIFACT_MAVEN_WAR_PLUGIN,
+ "warSourceDirectory", //$NON-NLS-1$
+ "src/main/webapp" ) ); //$NON-NLS-1$
String webContentDir = IdeUtils.toRelativeAndFixSeparator( basedir, warSourceDirectory, false );
@@ -135,7 +135,7 @@ public class RadCleanMojo
/**
* delete all Jar artifacts in the specified directory.
- *
+ *
* @param directory to delete the jars from
* @throws MojoExecutionException only if a file exists and can't be deleted
*/
@@ -147,7 +147,7 @@ public class RadCleanMojo
/**
* delete all War artifacts in the specified directory (cleaning up EAR's for example).
- *
+ *
* @param directory to delete the wars from
* @throws MojoExecutionException only if a file exists and can't be deleted
*/
@@ -159,12 +159,12 @@ public class RadCleanMojo
/**
* Deletes all artifacts of specified packaging type in the specified directory
- *
- * @param directory - to delete the jars from
+ *
+ * @param directory - to delete the jars from
* @param packagingType - packaging type (file extensions in fact - can be dangerous)
- * @throws MojoExecutionException if a file exists and can't be deleted
* @see Constants#PROJECT_PACKAGING_JAR
* @see Constants#PROJECT_PACKAGING_WAR
+ * @throws MojoExecutionException if a file exists and can't be deleted
*/
private void deleteArtifactsInDirectory( File directory, String packagingType )
throws MojoExecutionException
@@ -175,12 +175,11 @@ public class RadCleanMojo
|| Constants.PROJECT_PACKAGING_WAR.equalsIgnoreCase( packagingType ) )
{
String[] oldFiles =
- FileUtils.getFilesFromExtension( directory.getAbsolutePath(), new String[]{ packagingType } );
- for ( String oldFile : oldFiles )
- {
- File f = new File( oldFile );
+ FileUtils.getFilesFromExtension( directory.getAbsolutePath(), new String[] { packagingType } );
+ for (String oldFile : oldFiles) {
+ File f = new File(oldFile);
- delete( f );
+ delete(f);
}
}
}
Modified: maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/RadPlugin.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/RadPlugin.java?rev=1517906&r1=1517905&r2=1517906&view=diff
==============================================================================
--- maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/RadPlugin.java (original)
+++ maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/RadPlugin.java Tue Aug 27 18:25:03 2013
@@ -39,7 +39,7 @@ import org.apache.maven.project.MavenPro
/**
* Generates the rad-6 configuration files.
- *
+ *
* @author Richard van Nieuwenhoven (patch submission)
* @author jdcasey
* @goal rad
@@ -94,7 +94,7 @@ public class RadPlugin
/**
* The context root of the webapplication. This parameter is only used when the current project is a war project,
* else it will be ignored.
- *
+ *
* @parameter
*/
private String warContextRoot;
@@ -102,7 +102,7 @@ public class RadPlugin
/**
* Use this to specify a different generated resources folder than target/generated-resources/rad6. Set to "none" to
* skip this folder generation.
- *
+ *
* @parameter expression="${generatedResourceDirName}" default-value="target/generated-resources/rad6" since="2.4"
*/
private String generatedResourceDirName;
@@ -126,10 +126,10 @@ public class RadPlugin
/**
* write all rad6 configuration files. <br/>
* <b> NOTE: This could change the config! </b>
- *
+ *
+ * @see EclipsePlugin#writeConfiguration()
* @param deps resolved dependencies to handle
* @throws MojoExecutionException if the config files could not be written.
- * @see EclipsePlugin#writeConfiguration()
*/
protected void writeConfigurationExtras( EclipseWriterConfig config )
throws MojoExecutionException
@@ -152,7 +152,7 @@ public class RadPlugin
/**
* make room for a Manifest file. use a generated resource for JARS and for WARS use the manifest in the
* webapp/meta-inf directory.
- *
+ *
* @throws MojoExecutionException
*/
private void addManifestResource( EclipseWriterConfig config )
@@ -166,8 +166,9 @@ public class RadPlugin
}
if ( isJavaProject() && !Constants.PROJECT_PACKAGING_EAR.equals( packaging )
- && !Constants.PROJECT_PACKAGING_WAR.equals( packaging ) && !Constants.PROJECT_PACKAGING_EJB.equals(
- packaging ) && !NO_GENERATED_RESOURCE_DIRNAME.equals( this.generatedResourceDirName ) )
+ && !Constants.PROJECT_PACKAGING_WAR.equals( packaging )
+ && !Constants.PROJECT_PACKAGING_EJB.equals( packaging )
+ && !NO_GENERATED_RESOURCE_DIRNAME.equals( this.generatedResourceDirName ) )
{
String generatedResourceDir =
@@ -195,7 +196,7 @@ public class RadPlugin
/**
* Returns absolute path to the web content directory based on configuration of the war plugin or default one
* otherwise.
- *
+ *
* @param project
* @return absolute directory path as String
* @throws MojoExecutionException
@@ -204,9 +205,9 @@ public class RadPlugin
throws MojoExecutionException
{
// getting true location of web source dir from config
- File warSourceDirectory = new File(
- IdeUtils.getPluginSetting( config.getProject(), JeeUtils.ARTIFACT_MAVEN_WAR_PLUGIN, "warSourceDirectory",
- "src/main/webapp" ) );
+ File warSourceDirectory =
+ new File( IdeUtils.getPluginSetting( config.getProject(), JeeUtils.ARTIFACT_MAVEN_WAR_PLUGIN,
+ "warSourceDirectory", "src/main/webapp" ) );
// getting real and correct path to the web source dir
String webContentDir =
IdeUtils.toRelativeAndFixSeparator( config.getEclipseProjectDirectory(), warSourceDirectory, false );
@@ -219,7 +220,7 @@ public class RadPlugin
/**
* overwite the default builders with the builders required by RAD6.
- *
+ *
* @param packaging packaging-type (jar,war,ejb,ear)
*/
protected void fillDefaultBuilders( String packaging )
@@ -263,7 +264,7 @@ public class RadPlugin
/**
* overwite the default natures with the natures required by RAD6.
- *
+ *
* @param packaging packaging-type (jar,war,ejb,ear)
*/
protected void fillDefaultNatures( String packaging )
@@ -296,32 +297,29 @@ public class RadPlugin
/**
* Utility method that locates a project producing the given artifact.
- *
+ *
* @param artifact the artifact a project should produce.
* @return <code>true</code> if the artifact is produced by a reactor projectart.
*/
protected boolean isAvailableAsAReactorProject( Artifact artifact )
{
- if ( this.reactorProjects != null && ( Constants.PROJECT_PACKAGING_JAR.equals( artifact.getType() )
- || Constants.PROJECT_PACKAGING_EJB.equals( artifact.getType() ) || Constants.PROJECT_PACKAGING_WAR.equals(
- artifact.getType() ) ) )
+ if ( this.reactorProjects != null
+ && ( Constants.PROJECT_PACKAGING_JAR.equals( artifact.getType() )
+ || Constants.PROJECT_PACKAGING_EJB.equals( artifact.getType() ) || Constants.PROJECT_PACKAGING_WAR.equals( artifact.getType() ) ) )
{
- for ( Object reactorProject1 : this.reactorProjects )
- {
+ for (Object reactorProject1 : this.reactorProjects) {
MavenProject reactorProject = (MavenProject) reactorProject1;
- if ( reactorProject.getGroupId().equals( artifact.getGroupId() )
- && reactorProject.getArtifactId().equals( artifact.getArtifactId() ) )
- {
- if ( reactorProject.getVersion().equals( artifact.getVersion() ) )
- {
+ if (reactorProject.getGroupId().equals(artifact.getGroupId())
+ && reactorProject.getArtifactId().equals(artifact.getArtifactId())) {
+ if (reactorProject.getVersion().equals(artifact.getVersion())) {
return true;
- }
- else
- {
- getLog().info( "Artifact " + artifact.getId()
- + " already available as a reactor project, but with different version. Expected: "
- + artifact.getVersion() + ", found: " + reactorProject.getVersion() );
+ } else {
+ getLog().info(
+ "Artifact "
+ + artifact.getId()
+ + " already available as a reactor project, but with different version. Expected: "
+ + artifact.getVersion() + ", found: " + reactorProject.getVersion());
}
}
}
Modified: maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/RemoveCacheMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/RemoveCacheMojo.java?rev=1517906&r1=1517905&r2=1517906&view=diff
==============================================================================
--- maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/RemoveCacheMojo.java (original)
+++ maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/RemoveCacheMojo.java Tue Aug 27 18:25:03 2013
@@ -34,7 +34,7 @@ import org.apache.maven.plugin.ide.IdeUt
/**
* Removes the not-available marker files from the repository.
- *
+ *
* @author <a href="mailto:baerrach@apache.org">Barrie Treloar</a>
* @version $Id$
* @goal remove-cache
@@ -44,7 +44,7 @@ public class RemoveCacheMojo
{
/**
* Local maven repository.
- *
+ *
* @parameter expression="${localRepository}"
* @required
* @readonly
@@ -65,21 +65,17 @@ public class RemoveCacheMojo
/**
* Delete each file in the notAvailableMarkerFiles list.
- *
+ *
* @param notAvailableMarkerFiles the list of marker files to delete.
*/
private void deleteMarkerFiles( List/* <File> */notAvailableMarkerFiles )
{
- for ( Object notAvailableMarkerFile : notAvailableMarkerFiles )
- {
+ for (Object notAvailableMarkerFile : notAvailableMarkerFiles) {
File markerFile = (File) notAvailableMarkerFile;
- try
- {
- IdeUtils.delete( markerFile, getLog() );
- }
- catch ( MojoExecutionException e )
- {
- getLog().warn( e.getMessage(), e );
+ try {
+ IdeUtils.delete(markerFile, getLog());
+ } catch (MojoExecutionException e) {
+ getLog().warn(e.getMessage(), e);
}
}
}
@@ -87,7 +83,7 @@ public class RemoveCacheMojo
/**
* A list of all the not available marker <code>File</code>s in the localRepository. If there are no marker files
* then an empty list is returned.
- *
+ *
* @return all the not available marker files in the localRepository or an empty list.
*/
private List/* <File> */getNotAvailableMarkerFiles()
@@ -95,9 +91,10 @@ public class RemoveCacheMojo
File localRepositoryBaseDirectory = new File( localRepository.getBasedir() );
List markerFiles = new ArrayList();
- Iterator iterator = FileUtils.iterateFiles( localRepositoryBaseDirectory,
- new SuffixFileFilter( IdeUtils.NOT_AVAILABLE_MARKER_FILE_SUFFIX ),
- TrueFileFilter.INSTANCE );
+ Iterator iterator =
+ FileUtils.iterateFiles( localRepositoryBaseDirectory,
+ new SuffixFileFilter( IdeUtils.NOT_AVAILABLE_MARKER_FILE_SUFFIX ),
+ TrueFileFilter.INSTANCE );
while ( iterator.hasNext() )
{
File notAvailableMarkerFile = (File) iterator.next();
Modified: maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/WorkspaceConfiguration.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/WorkspaceConfiguration.java?rev=1517906&r1=1517905&r2=1517906&view=diff
==============================================================================
--- maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/WorkspaceConfiguration.java (original)
+++ maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/WorkspaceConfiguration.java Tue Aug 27 18:25:03 2013
@@ -130,23 +130,23 @@ public class WorkspaceConfiguration
{
if ( getDefaultDeployServerId() != null && getDefaultDeployServerId().startsWith( "was." ) )
{
- if ( getDefaultDeployServerId().contains( "v7" ) )
+ if (getDefaultDeployServerId().contains("v7"))
{
return "7.0";
}
- if ( getDefaultDeployServerId().contains( "v61" ) )
+ if (getDefaultDeployServerId().contains("v61"))
{
return "6.1";
}
- if ( getDefaultDeployServerId().contains( "v6" ) )
+ if (getDefaultDeployServerId().contains("v6"))
{
return "6.0";
}
- if ( getDefaultDeployServerId().contains( "v51" ) )
+ if (getDefaultDeployServerId().contains("v51"))
{
return "5.1";
}
- if ( getDefaultDeployServerId().contains( "v5" ) )
+ if (getDefaultDeployServerId().contains("v5"))
{
return "5.0";
}
Modified: maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/reader/ReadWorkspaceLocations.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/reader/ReadWorkspaceLocations.java?rev=1517906&r1=1517905&r2=1517906&view=diff
==============================================================================
--- maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/reader/ReadWorkspaceLocations.java (original)
+++ maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/reader/ReadWorkspaceLocations.java Tue Aug 27 18:25:03 2013
@@ -45,7 +45,7 @@ import org.eclipse.core.internal.localst
/**
* Scan the eclipse workspace and create a array with {@link IdeDependency} for all found artefacts.
- *
+ *
* @author Richard van Nieuwenhoven
* @version $Id$
*/
@@ -57,17 +57,17 @@ public class ReadWorkspaceLocations
public static final String METADATA_PLUGINS_ORG_ECLIPSE_CORE_RESOURCES_PROJECTS =
".metadata/.plugins/org.eclipse.core.resources/.projects";
- private static final String[] PARENT_VERSION = new String[]{ "parent", "version" };
+ private static final String[] PARENT_VERSION = new String[] { "parent", "version" };
- private static final String[] PARENT_GROUP_ID = new String[]{ "parent", "groupId" };
+ private static final String[] PARENT_GROUP_ID = new String[] { "parent", "groupId" };
- private static final String[] PACKAGING = new String[]{ "packaging" };
+ private static final String[] PACKAGING = new String[] { "packaging" };
- private static final String[] VERSION = new String[]{ "version" };
+ private static final String[] VERSION = new String[] { "version" };
- private static final String[] GROUP_ID = new String[]{ "groupId" };
+ private static final String[] GROUP_ID = new String[] { "groupId" };
- private static final String[] ARTEFACT_ID = new String[]{ "artifactId" };
+ private static final String[] ARTEFACT_ID = new String[] { "artifactId" };
private static final String METADATA_PLUGINS_ORG_ECLIPSE_CORE_RUNTIME_LAUNCHING_PREFS =
".metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.launching.prefs";
@@ -97,13 +97,12 @@ public class ReadWorkspaceLocations
/**
* Detect WTP Default Server. Do nothing if tehre are no defined servers in the settings.
- *
+ *
* @param workspaceConfiguration the workspace configuration
- * @param wtpDefaultServer Default server
- * @param log the log
+ * @param wtpDefaultServer Default server
+ * @param log the log
*/
- private void detectWTPDefaultServer( WorkspaceConfiguration workspaceConfiguration, String wtpDefaultServer,
- Log log )
+ private void detectWTPDefaultServer( WorkspaceConfiguration workspaceConfiguration, String wtpDefaultServer, Log log )
{
HashMap servers = readDefinedServers( workspaceConfiguration, log );
if ( servers == null || servers.isEmpty() )
@@ -134,7 +133,7 @@ public class ReadWorkspaceLocations
{
String id = (String) idIterator.next();
String name = (String) servers.get( id );
- if ( id.contains( wtpDefaultServer ) || name.contains( wtpDefaultServer ) )
+ if (id.contains(wtpDefaultServer) || name.contains(wtpDefaultServer))
{
workspaceConfiguration.setDefaultDeployServerId( id );
workspaceConfiguration.setDefaultDeployServerName( name );
@@ -147,18 +146,17 @@ public class ReadWorkspaceLocations
// now take the default server
log.info( "no substring wtp server match." );
workspaceConfiguration.setDefaultDeployServerId( (String) servers.get( "" ) );
- workspaceConfiguration.setDefaultDeployServerName(
- (String) servers.get( workspaceConfiguration.getDefaultDeployServerId() ) );
+ workspaceConfiguration.setDefaultDeployServerName( (String) servers.get( workspaceConfiguration.getDefaultDeployServerId() ) );
}
log.info( "Using as WTP server : " + workspaceConfiguration.getDefaultDeployServerName() );
}
/**
* Take the compiler executable and try to find a JRE that contains that compiler.
- *
+ *
* @param rawExecutable the executable with the complete path.
- * @param jreMap the map with defined JRE's.
- * @param logger the logger to log the error's
+ * @param jreMap the map with defined JRE's.
+ * @param logger the logger to log the error's
* @return the found container or null if non found.
*/
private String getContainerFromExecutable( String rawExecutable, Map jreMap, Log logger )
@@ -194,10 +192,10 @@ public class ReadWorkspaceLocations
/**
* Search the default JREContainer from eclipse for the current MavenProject
- *
+ *
* @param workspaceConfiguration the location of the workspace.
- * @param project the maven project the get the configuration
- * @param logger the logger for errors
+ * @param project the maven project the get the configuration
+ * @param logger the logger for errors
*/
private void detectDefaultJREContainer( WorkspaceConfiguration workspaceConfiguration, MavenProject project,
Log logger )
@@ -223,7 +221,7 @@ public class ReadWorkspaceLocations
if ( foundContainer != null )
{
logger.debug( "detected classpathContainer from sourceVersion(" + sourceVersion + "): "
- + foundContainer );
+ + foundContainer );
}
}
if ( foundContainer == null )
@@ -242,11 +240,11 @@ public class ReadWorkspaceLocations
/**
* Get the project location for a project in the eclipse metadata.
- *
+ *
* @param workspaceLocation the location of the workspace
- * @param project the project subdirectory in the metadata
+ * @param project the project subdirectory in the metadata
* @return the full path to the project.
- * @throws IOException failures to read location file
+ * @throws IOException failures to read location file
* @throws URISyntaxException failures to read location file
*/
/* package */File getProjectLocation( File workspaceLocation, File project )
@@ -288,8 +286,8 @@ public class ReadWorkspaceLocations
/**
* get a value from a dom element.
- *
- * @param element the element to get a value from
+ *
+ * @param element the element to get a value from
* @param elementNames the sub elements to get
* @param defaultValue teh default value if the value was null or empty
* @return the value of the dome element.
@@ -319,9 +317,9 @@ public class ReadWorkspaceLocations
/**
* Read the artefact information from the pom in the project location and the eclipse project name from the .project
* file.
- *
+ *
* @param projectLocation the location of the project
- * @param logger the logger to report errors and debug info.
+ * @param logger the logger to report errors and debug info.
* @return an {@link IdeDependency} or null.
* @throws FileNotFoundException
* @throws XmlPullParserException
@@ -335,7 +333,7 @@ public class ReadWorkspaceLocations
if ( projectFile.exists() )
{
Xpp3Dom project = Xpp3DomBuilder.build( new FileReader( projectFile ) );
- eclipseProjectName = getValue( project, new String[]{ "name" }, eclipseProjectName );
+ eclipseProjectName = getValue( project, new String[] { "name" }, eclipseProjectName );
}
File pomFile = new File( projectLocation, "pom.xml" );
if ( pomFile.exists() )
@@ -343,14 +341,16 @@ public class ReadWorkspaceLocations
Xpp3Dom pom = Xpp3DomBuilder.build( new FileReader( pomFile ) );
String artifact = getValue( pom, ReadWorkspaceLocations.ARTEFACT_ID, null );
- String group = getValue( pom, ReadWorkspaceLocations.GROUP_ID,
- getValue( pom, ReadWorkspaceLocations.PARENT_GROUP_ID, null ) );
- String version = getValue( pom, ReadWorkspaceLocations.VERSION,
- getValue( pom, ReadWorkspaceLocations.PARENT_VERSION, null ) );
+ String group =
+ getValue( pom, ReadWorkspaceLocations.GROUP_ID, getValue( pom, ReadWorkspaceLocations.PARENT_GROUP_ID,
+ null ) );
+ String version =
+ getValue( pom, ReadWorkspaceLocations.VERSION, getValue( pom, ReadWorkspaceLocations.PARENT_VERSION,
+ null ) );
String packaging = getValue( pom, ReadWorkspaceLocations.PACKAGING, "jar" );
logger.debug( "found workspace artefact " + group + ":" + artifact + ":" + version + " " + packaging + " ("
- + eclipseProjectName + ")" + " -> " + projectLocation.getAbsolutePath() );
+ + eclipseProjectName + ")" + " -> " + projectLocation.getAbsolutePath() );
return new IdeDependency( group, artifact, version, packaging, true, false, false, false, false, null,
packaging, false, null, 0, eclipseProjectName );
}
@@ -361,22 +361,23 @@ public class ReadWorkspaceLocations
}
}
- /* package */HashMap<String, String> readDefinedServers( WorkspaceConfiguration workspaceConfiguration, Log logger )
+ /* package */HashMap<String,String> readDefinedServers( WorkspaceConfiguration workspaceConfiguration, Log logger )
{
- HashMap<String, String> detectedRuntimes = new HashMap<String, String>();
+ HashMap<String,String> detectedRuntimes = new HashMap<String,String>();
if ( workspaceConfiguration.getWorkspaceDirectory() != null )
{
Xpp3Dom runtimesElement = null;
try
{
- File prefs = new File( workspaceConfiguration.getWorkspaceDirectory(),
- ReadWorkspaceLocations.METADATA_PLUGINS_ORG_ECLIPSE_CORE_RUNTIME_SERVER_PREFS );
+ File prefs =
+ new File( workspaceConfiguration.getWorkspaceDirectory(),
+ ReadWorkspaceLocations.METADATA_PLUGINS_ORG_ECLIPSE_CORE_RUNTIME_SERVER_PREFS );
if ( prefs.exists() )
{
Properties properties = new Properties();
properties.load( new FileInputStream( prefs ) );
- String runtimes = properties.getProperty(
- ReadWorkspaceLocations.METADATA_PLUGINS_ORG_ECLIPSE_CORE_RUNTIME_PREFS_RUNTIMES_KEY );
+ String runtimes =
+ properties.getProperty( ReadWorkspaceLocations.METADATA_PLUGINS_ORG_ECLIPSE_CORE_RUNTIME_PREFS_RUNTIMES_KEY );
if ( runtimes != null )
{
runtimesElement = Xpp3DomBuilder.build( new StringReader( runtimes ) );
@@ -411,26 +412,28 @@ public class ReadWorkspaceLocations
/**
* Read the JRE definition configured in the workspace. They will be put in a HashMap with as key there path and as
* value the JRE constant. a second key is included with the JRE version as a key.
- *
+ *
* @param workspaceLocation the workspace location
- * @param logger the logger to error messages
+ * @param logger the logger to error messages
* @return the map with found jre's
*/
- private HashMap<String, String> readAvailableJREs( File workspaceLocation, Log logger )
+ private HashMap<String,String> readAvailableJREs( File workspaceLocation, Log logger )
{
Xpp3Dom vms;
try
{
- File prefs = new File( workspaceLocation,
- ReadWorkspaceLocations.METADATA_PLUGINS_ORG_ECLIPSE_CORE_RUNTIME_LAUNCHING_PREFS );
+ File prefs =
+ new File( workspaceLocation,
+ ReadWorkspaceLocations.METADATA_PLUGINS_ORG_ECLIPSE_CORE_RUNTIME_LAUNCHING_PREFS );
if ( !prefs.exists() )
{
return null;
}
Properties properties = new Properties();
properties.load( new FileInputStream( prefs ) );
- vms = Xpp3DomBuilder.build( new StringReader( properties.getProperty(
- ReadWorkspaceLocations.METADATA_PLUGINS_ORG_ECLIPSE_CORE_RUNTIME_PREFS_VM_KEY ) ) );
+ vms =
+ Xpp3DomBuilder.build( new StringReader(
+ properties.getProperty( ReadWorkspaceLocations.METADATA_PLUGINS_ORG_ECLIPSE_CORE_RUNTIME_PREFS_VM_KEY ) ) );
}
catch ( Exception e )
{
@@ -438,7 +441,7 @@ public class ReadWorkspaceLocations
return null;
}
- HashMap<String, String> jreMap = new HashMap<String, String>();
+ HashMap<String,String> jreMap = new HashMap<String,String>();
jreMap.put( "1.2", CLASSPATHENTRY_STANDARD + "J2SE-1.2" );
jreMap.put( "1.3", CLASSPATHENTRY_STANDARD + "J2SE-1.3" );
jreMap.put( "1.4", CLASSPATHENTRY_STANDARD + "J2SE-1.4" );
@@ -448,54 +451,42 @@ public class ReadWorkspaceLocations
jreMap.put( "6", jreMap.get( "1.6" ) );
String defaultJRE = vms.getAttribute( "defaultVM" ).trim();
Xpp3Dom[] vmTypes = vms.getChildren( "vmType" );
- for ( Xpp3Dom vmType : vmTypes )
- {
- String typeId = vmType.getAttribute( "id" );
- Xpp3Dom[] vm = vmType.getChildren( "vm" );
- for ( Xpp3Dom aVm : vm )
- {
- try
- {
- String path = aVm.getAttribute( "path" );
- String name = aVm.getAttribute( "name" );
- String vmId = aVm.getAttribute( "id" ).trim();
+ for (Xpp3Dom vmType : vmTypes) {
+ String typeId = vmType.getAttribute("id");
+ Xpp3Dom[] vm = vmType.getChildren("vm");
+ for (Xpp3Dom aVm : vm) {
+ try {
+ String path = aVm.getAttribute("path");
+ String name = aVm.getAttribute("name");
+ String vmId = aVm.getAttribute("id").trim();
String classpathEntry =
- MessageFormat.format( ReadWorkspaceLocations.CLASSPATHENTRY_FORMAT, typeId, name );
- String jrePath = new File( path ).getCanonicalPath();
- File rtJarFile = new File( new File( jrePath ), "jre/lib/rt.jar" );
- if ( !rtJarFile.exists() )
- {
- logger.warn( Messages.getString( "EclipsePlugin.invalidvminworkspace", jrePath ) );
+ MessageFormat.format(ReadWorkspaceLocations.CLASSPATHENTRY_FORMAT,
+ typeId, name);
+ String jrePath = new File(path).getCanonicalPath();
+ File rtJarFile = new File(new File(jrePath), "jre/lib/rt.jar");
+ if (!rtJarFile.exists()) {
+ logger.warn(Messages.getString("EclipsePlugin.invalidvminworkspace", jrePath));
continue;
}
- JarFile rtJar = new JarFile( rtJarFile );
- String version = rtJar.getManifest().getMainAttributes().getValue( "Specification-Version" );
- if ( defaultJRE.endsWith( "," + vmId ) )
- {
- jreMap.put( jrePath, ReadWorkspaceLocations.CLASSPATHENTRY_DEFAULT );
- jreMap.put( version, ReadWorkspaceLocations.CLASSPATHENTRY_DEFAULT );
- logger.debug( "Default Classpath Container version: " + version + " location: " + jrePath );
- }
- else if ( !jreMap.containsKey( jrePath ) )
- {
- if ( !jreMap.containsKey( version ) )
- {
- jreMap.put( version, classpathEntry );
+ JarFile rtJar = new JarFile(rtJarFile);
+ String version = rtJar.getManifest().getMainAttributes().getValue("Specification-Version");
+ if (defaultJRE.endsWith("," + vmId)) {
+ jreMap.put(jrePath, ReadWorkspaceLocations.CLASSPATHENTRY_DEFAULT);
+ jreMap.put(version, ReadWorkspaceLocations.CLASSPATHENTRY_DEFAULT);
+ logger.debug("Default Classpath Container version: " + version + " location: " + jrePath);
+ } else if (!jreMap.containsKey(jrePath)) {
+ if (!jreMap.containsKey(version)) {
+ jreMap.put(version, classpathEntry);
}
- jreMap.put( jrePath, classpathEntry );
- logger.debug(
- "Additional Classpath Container version: " + version + " " + classpathEntry + " location: "
- + jrePath );
- }
- else
- {
- logger.debug( "Ignored (duplicated) additional Classpath Container version: " + version + " "
- + classpathEntry + " location: " + jrePath );
+ jreMap.put(jrePath, classpathEntry);
+ logger.debug("Additional Classpath Container version: " + version + " " + classpathEntry
+ + " location: " + jrePath);
+ } else {
+ logger.debug("Ignored (duplicated) additional Classpath Container version: " + version + " "
+ + classpathEntry + " location: " + jrePath);
}
- }
- catch ( IOException e )
- {
- logger.warn( "Could not interpret entry: " + aVm.toString() );
+ } catch (IOException e) {
+ logger.warn("Could not interpret entry: " + aVm.toString());
}
}
}
@@ -504,17 +495,18 @@ public class ReadWorkspaceLocations
/**
* Scan the eclipse workspace and create a array with {@link IdeDependency} for all found artifacts.
- *
+ *
* @param workspaceConfiguration the location of the eclipse workspace.
- * @param logger the logger to report errors and debug info.
+ * @param logger the logger to report errors and debug info.
*/
private void readWorkspace( WorkspaceConfiguration workspaceConfiguration, Log logger )
{
ArrayList<IdeDependency> dependencies = new ArrayList<IdeDependency>();
if ( workspaceConfiguration.getWorkspaceDirectory() != null )
{
- File workspace = new File( workspaceConfiguration.getWorkspaceDirectory(),
- ReadWorkspaceLocations.METADATA_PLUGINS_ORG_ECLIPSE_CORE_RESOURCES_PROJECTS );
+ File workspace =
+ new File( workspaceConfiguration.getWorkspaceDirectory(),
+ ReadWorkspaceLocations.METADATA_PLUGINS_ORG_ECLIPSE_CORE_RESOURCES_PROJECTS );
File[] directories = workspace.listFiles();
for ( int index = 0; directories != null && index < directories.length; index++ )
@@ -528,7 +520,7 @@ public class ReadWorkspaceLocations
getProjectLocation( workspaceConfiguration.getWorkspaceDirectory(), project );
if ( projectLocation != null )
{
- logger.debug( "read workpsace project " + projectLocation );
+ logger.debug( "read workpsace project " + projectLocation );
IdeDependency ideDependency = readArtefact( projectLocation, logger );
if ( ideDependency != null )
{
@@ -543,7 +535,7 @@ public class ReadWorkspaceLocations
}
}
}
- logger.debug( dependencies.size() + " from workspace " + workspaceConfiguration.getWorkspaceDirectory() );
- workspaceConfiguration.setWorkspaceArtefacts( dependencies.toArray( new IdeDependency[dependencies.size()] ) );
+ logger.debug( dependencies.size() + " from workspace " + workspaceConfiguration.getWorkspaceDirectory() );
+ workspaceConfiguration.setWorkspaceArtefacts(dependencies.toArray( new IdeDependency[dependencies.size()] ));
}
}
Modified: maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/AbstractEclipseManifestWriter.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/AbstractEclipseManifestWriter.java?rev=1517906&r1=1517905&r2=1517906&view=diff
==============================================================================
--- maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/AbstractEclipseManifestWriter.java (original)
+++ maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/AbstractEclipseManifestWriter.java Tue Aug 27 18:25:03 2013
@@ -39,7 +39,7 @@ import org.codehaus.plexus.util.IOUtil;
/**
* Common behaviours for creating or adapting the manifest files for eclipse environments.
- *
+ *
* @author <a href="mailto:nir@cfc.at">Richard van Nieuwenhoven </a>
*/
public abstract class AbstractEclipseManifestWriter
@@ -57,7 +57,7 @@ public abstract class AbstractEclipseMan
/**
* Aphabeticaly sort the classpath. Do this by splitting it up, sort the entries and gleue them together again.
- *
+ *
* @param newValue classpath to sort
* @return the sorted classpath
*/
@@ -70,17 +70,16 @@ public abstract class AbstractEclipseMan
String[] entries = newValue.split( " " );
Arrays.sort( entries );
StringBuilder buffer = new StringBuilder( newValue.length() );
- for ( String entry : entries )
- {
- buffer.append( entry );
- buffer.append( ' ' );
+ for (String entry : entries) {
+ buffer.append(entry);
+ buffer.append(' ');
}
return buffer.toString();
}
/**
* Read and parse the existing manifest file.
- *
+ *
* @param manifestFile file
* @return the read manifest
* @throws IOException if the file could not be read
@@ -110,14 +109,14 @@ public abstract class AbstractEclipseMan
* Add one dependency to the blank separated classpath StringBuilder. When the project is available in the reactor
* (current build) then the project is used else the jar representing the artifact. System dependencies will only be
* included if they are in this project.
- *
- * @param classpath existing classpath to append
+ *
+ * @param classpath existing classpath to append
* @param dependency dependency to append as jar or as project
*/
protected void addDependencyToClassPath( StringBuilder classpath, IdeDependency dependency )
{
- if ( !dependency.isTestDependency() && !dependency.isProvided() && !dependency.isSystemScopedOutsideProject(
- this.config.getProject() ) )
+ if ( !dependency.isTestDependency() && !dependency.isProvided()
+ && !dependency.isSystemScopedOutsideProject( this.config.getProject() ) )
{
// blank is the separator in manifest classpath's
@@ -142,8 +141,8 @@ public abstract class AbstractEclipseMan
* Check if the two manifests are equal. Manifest.equal can not be used because of the special case the Classpath
* entr, witch must be comaired sorted so that a different oder in the classpath does not result in "not equal".
* This not not realy correct but in this case it is more important to reduce the number of version-controll files.
- *
- * @param manifest the new manifest
+ *
+ * @param manifest the new manifest
* @param existingManifest to compaire the new one with
* @return are the manifests equal
*/
@@ -160,24 +159,20 @@ public abstract class AbstractEclipseMan
Attributes newMap = manifest.getMainAttributes();
keys.addAll( existingMap.keySet() );
keys.addAll( newMap.keySet() );
- for ( Object key1 : keys )
- {
+ for (Object key1 : keys) {
Attributes.Name key = (Attributes.Name) key1;
- String newValue = (String) newMap.get( key );
- String existingValue = (String) existingMap.get( key );
+ String newValue = (String) newMap.get(key);
+ String existingValue = (String) existingMap.get(key);
// special case classpath... they are equal when there entries
// are equal
- if ( Attributes.Name.CLASS_PATH.equals( key ) )
- {
- newValue = orderClasspath( newValue );
- existingValue = orderClasspath( existingValue );
+ if (Attributes.Name.CLASS_PATH.equals(key)) {
+ newValue = orderClasspath(newValue);
+ existingValue = orderClasspath(existingValue);
}
- if ( ( newValue == null || !newValue.equals( existingValue ) ) && ( existingValue == null
- || !existingValue.equals( newValue ) ) )
- {
- log.info(
- "@@@ FALSE - Manifest are not equal because key = " + key + " has existing value = " + existingValue
- + " and new value = " + newValue + " are different" );
+ if ((newValue == null || !newValue.equals(existingValue))
+ && (existingValue == null || !existingValue.equals(newValue))) {
+ log.info("@@@ FALSE - Manifest are not equal because key = " + key + " has existing value = "
+ + existingValue + " and new value = " + newValue + " are different");
return false;
}
}
@@ -187,7 +182,7 @@ public abstract class AbstractEclipseMan
/**
* Convert all dependencies in a blank seperated list of jars and projects representing the classpath.
- *
+ *
* @return the blank separeted classpath string
*/
protected String constructManifestClasspath()
@@ -195,9 +190,8 @@ public abstract class AbstractEclipseMan
StringBuilder StringBuilder = new StringBuilder();
IdeDependency[] deps = this.config.getDeps();
- for ( IdeDependency dep : deps )
- {
- addDependencyToClassPath( StringBuilder, dep );
+ for (IdeDependency dep : deps) {
+ addDependencyToClassPath(StringBuilder, dep);
}
return StringBuilder.toString();
@@ -205,7 +199,7 @@ public abstract class AbstractEclipseMan
/**
* Create a manifest contaigning the required classpath.
- *
+ *
* @return the newly created manifest
*/
protected Manifest createNewManifest()
@@ -219,8 +213,8 @@ public abstract class AbstractEclipseMan
/**
* Verify is the manifest sould be overwritten this sould take in account that the manifest should only be written
* if the contents of the classpath was changed not the order. The classpath sorting oder should be ignored.
- *
- * @param manifest the newly created classpath
+ *
+ * @param manifest the newly created classpath
* @param manifestFile the file where the manifest
* @return if the new manifest file must be written
* @throws MojoExecutionException
@@ -233,22 +227,21 @@ public abstract class AbstractEclipseMan
Manifest existingManifest = readExistingManifest( manifestFile );
if ( areManifestsEqual( manifest, existingManifest ) )
{
- this.log.info(
- Messages.getString( "EclipsePlugin.unchangedmanifest", manifestFile.getAbsolutePath() ) );
+ this.log.info( Messages.getString( "EclipsePlugin.unchangedmanifest", manifestFile.getAbsolutePath() ) );
return false;
}
}
catch ( Exception e )
{
- throw new MojoExecutionException(
- Messages.getString( "EclipseCleanMojo.nofilefound", manifestFile.getAbsolutePath() ), e );
+ throw new MojoExecutionException( Messages.getString( "EclipseCleanMojo.nofilefound",
+ manifestFile.getAbsolutePath() ), e );
}
return true;
}
/**
* Search the project for the existing META-INF directory where the manifest should be located.
- *
+ *
* @return the absolute path to the META-INF directory
* @throws MojoExecutionException
*/
@@ -258,15 +251,15 @@ public abstract class AbstractEclipseMan
/**
* If the existing manifest file located in <code>getMetaInfBaseDirectory()</code> already has a correct
* MANIFEST_VERSION and CLASS_PATH value then do nothing.
- * <p/>
+ * <p>
* Otherwise generate a <b>NEW</b> (i.e the old one is overwritten) which only contains values for MANIFEST_VERSION
* and CLASS_PATH, all other previous entries are not kept.
- *
- * @param sourceDirs all eclipse source directorys
- * @param localRepository the local reposetory
+ *
+ * @see AbstractWtpResourceWriter#write(EclipseSourceDir[], ArtifactRepository, File)
+ * @param sourceDirs all eclipse source directorys
+ * @param localRepository the local reposetory
* @param buildOutputDirectory build output directory (target)
* @throws MojoExecutionException when writing the config files was not possible
- * @see AbstractWtpResourceWriter#write(EclipseSourceDir[], ArtifactRepository, File)
*/
public void write()
throws MojoExecutionException
@@ -276,12 +269,14 @@ public abstract class AbstractEclipseMan
if ( metaInfBaseDirectory == null )
{
// TODO: if this really is an error, shouldn't we stop the build??
- throw new MojoExecutionException( Messages.getString( "EclipseCleanMojo.nofilefound", new Object[]{
- EclipseManifestWriter.META_INF_DIRECTORY } ) );
- }
- File manifestFile = new File(
- metaInfBaseDirectory + File.separatorChar + EclipseManifestWriter.META_INF_DIRECTORY + File.separatorChar
- + EclipseManifestWriter.MANIFEST_MF_FILENAME );
+ throw new MojoExecutionException(
+ Messages.getString(
+ "EclipseCleanMojo.nofilefound",
+ new Object[] { EclipseManifestWriter.META_INF_DIRECTORY } ) );
+ }
+ File manifestFile =
+ new File( metaInfBaseDirectory + File.separatorChar + EclipseManifestWriter.META_INF_DIRECTORY
+ + File.separatorChar + EclipseManifestWriter.MANIFEST_MF_FILENAME );
Manifest manifest = createNewManifest();
if ( shouldNewManifestFileBeWritten( manifest, manifestFile ) )
@@ -302,7 +297,7 @@ public abstract class AbstractEclipseMan
catch ( Exception e )
{
this.log.error( Messages.getString( "EclipsePlugin.cantwritetofile",
- new Object[]{ manifestFile.getAbsolutePath() } ) );
+ new Object[] { manifestFile.getAbsolutePath() } ) );
}
}
}
Modified: maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseAjdtWriter.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseAjdtWriter.java?rev=1517906&r1=1517905&r2=1517906&view=diff
==============================================================================
--- maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseAjdtWriter.java (original)
+++ maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseAjdtWriter.java Tue Aug 27 18:25:03 2013
@@ -39,22 +39,22 @@ public class EclipseAjdtWriter
{
/**
- *
+ *
*/
private static final String LIBRARY = "LIBRARY";
/**
- *
+ *
*/
private static final String BINARY = "BINARY";
/**
- *
+ *
*/
private static final String CONTENT_KIND = ".contentKind";
/**
- *
+ *
*/
private static final String ENTRY_KIND = ".entryKind";
@@ -83,16 +83,13 @@ public class EclipseAjdtWriter
IdeDependency[] deps = config.getDeps();
int ajdtDepCount = 0;
int ajdtWeaveDepCount = 0;
- for ( IdeDependency dep : deps )
- {
- if ( dep.isAjdtDependency() )
- {
- addDependency( ajdtSettings, dep, ASPECT_DEP_PROP, ++ajdtDepCount );
+ for (IdeDependency dep : deps) {
+ if (dep.isAjdtDependency()) {
+ addDependency(ajdtSettings, dep, ASPECT_DEP_PROP, ++ajdtDepCount);
}
- if ( dep.isAjdtWeaveDependency() )
- {
- addDependency( ajdtSettings, dep, WEAVE_DEP_PROP, ++ajdtWeaveDepCount );
+ if (dep.isAjdtWeaveDependency()) {
+ addDependency(ajdtSettings, dep, WEAVE_DEP_PROP, ++ajdtWeaveDepCount);
}
}
@@ -136,13 +133,11 @@ public class EclipseAjdtWriter
}
catch ( FileNotFoundException e )
{
- throw new MojoExecutionException( Messages.getString( "EclipseSettingsWriter.cannotcreatesettings" ),
- e ); //$NON-NLS-1$
+ throw new MojoExecutionException( Messages.getString( "EclipseSettingsWriter.cannotcreatesettings" ), e ); //$NON-NLS-1$
}
catch ( IOException e )
{
- throw new MojoExecutionException( Messages.getString( "EclipseSettingsWriter.errorwritingsettings" ),
- e ); //$NON-NLS-1$
+ throw new MojoExecutionException( Messages.getString( "EclipseSettingsWriter.errorwritingsettings" ), e ); //$NON-NLS-1$
}
}
}
@@ -179,7 +174,7 @@ public class EclipseAjdtWriter
if ( log.isDebugEnabled() )
{
log.debug( Messages.getString( "EclipsePlugin.artifactissystemscoped", //$NON-NLS-1$
- new Object[]{ dep.getArtifactId(), path } ) );
+ new Object[] { dep.getArtifactId(), path } ) );
}
}
else
Modified: maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseClasspathWriter.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseClasspathWriter.java?rev=1517906&r1=1517905&r2=1517906&view=diff
==============================================================================
--- maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseClasspathWriter.java (original)
+++ maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseClasspathWriter.java Tue Aug 27 18:25:03 2013
@@ -162,13 +162,13 @@ public class EclipseClasspathWriter
try
{
- w = new OutputStreamWriter(
- new FileOutputStream( new File( config.getEclipseProjectDirectory(), FILE_DOT_CLASSPATH ) ), "UTF-8" );
+ w =
+ new OutputStreamWriter( new FileOutputStream( new File( config.getEclipseProjectDirectory(),
+ FILE_DOT_CLASSPATH ) ), "UTF-8" );
}
catch ( IOException ex )
{
- throw new MojoExecutionException( Messages.getString( "EclipsePlugin.erroropeningfile" ),
- ex ); //$NON-NLS-1$
+ throw new MojoExecutionException( Messages.getString( "EclipsePlugin.erroropeningfile" ), ex ); //$NON-NLS-1$
}
XMLWriter writer = new PrettyPrintXMLWriter( w, "UTF-8", null );
@@ -197,8 +197,8 @@ public class EclipseClasspathWriter
if ( byOutputDirs == null )
{
// ArrayList<EclipseSourceDir>
- byOutputDir.put( dir.getOutput() == null ? defaultOutput : dir.getOutput(),
- byOutputDirs = new ArrayList() );
+ byOutputDir.put( dir.getOutput() == null ? defaultOutput : dir.getOutput(), byOutputDirs =
+ new ArrayList() );
}
byOutputDirs.add( dir );
}
@@ -222,13 +222,13 @@ public class EclipseClasspathWriter
&& dir.getOutput().startsWith( defaultOutput ) // ... but is nested
&& byOutputDir.get( defaultOutput ) != null // ???
&& !( (List) byOutputDir.get( defaultOutput ) ).isEmpty() // ???
- )
+ )
{
// do not specify as source since the output will be nested. Instead, mark
// it as a todo, and handle it with a custom build.xml file later.
log.debug( "Marking as special to prevent output folder nesting: " + dir.getPath() + " (output="
- + dir.getOutput() + ")" );
+ + dir.getOutput() + ")" );
isSpecial = true;
specialSources.add( dir );
@@ -268,9 +268,9 @@ public class EclipseClasspathWriter
try
{
- Writer buildXmlWriter = new OutputStreamWriter(
- new FileOutputStream( new File( config.getEclipseProjectDirectory(), "maven-eclipse.xml" ) ),
- "UTF-8" );
+ Writer buildXmlWriter =
+ new OutputStreamWriter( new FileOutputStream( new File( config.getEclipseProjectDirectory(),
+ "maven-eclipse.xml" ) ), "UTF-8" );
PrettyPrintXMLWriter buildXmlPrinter = new PrettyPrintXMLWriter( buildXmlWriter );
buildXmlPrinter.startElement( "project" );
@@ -285,24 +285,21 @@ public class EclipseClasspathWriter
buildXmlPrinter.addAttribute( NAME, "copy-resources" );
buildXmlPrinter.addAttribute( "depends", "init" );
- for ( Object specialSource : specialSources )
- {
+ for (Object specialSource : specialSources) {
// TODO: merge source dirs on output path+filtering to reduce
// <copy> tags for speed.
EclipseSourceDir dir = (EclipseSourceDir) specialSource;
- buildXmlPrinter.startElement( "copy" );
- buildXmlPrinter.addAttribute( "todir", dir.getOutput() );
- buildXmlPrinter.addAttribute( "filtering", "" + dir.isFiltering() );
-
- buildXmlPrinter.startElement( "fileset" );
- buildXmlPrinter.addAttribute( "dir", dir.getPath() );
- if ( dir.getIncludeAsString() != null )
- {
- buildXmlPrinter.addAttribute( "includes", dir.getIncludeAsString() );
+ buildXmlPrinter.startElement("copy");
+ buildXmlPrinter.addAttribute("todir", dir.getOutput());
+ buildXmlPrinter.addAttribute("filtering", "" + dir.isFiltering());
+
+ buildXmlPrinter.startElement("fileset");
+ buildXmlPrinter.addAttribute("dir", dir.getPath());
+ if (dir.getIncludeAsString() != null) {
+ buildXmlPrinter.addAttribute("includes", dir.getIncludeAsString());
}
- if ( dir.getExcludeAsString() != null )
- {
- buildXmlPrinter.addAttribute( "excludes", dir.getExcludeAsString() );
+ if (dir.getExcludeAsString() != null) {
+ buildXmlPrinter.addAttribute("excludes", dir.getExcludeAsString());
}
buildXmlPrinter.endElement();
@@ -317,8 +314,8 @@ public class EclipseClasspathWriter
}
catch ( IOException e )
{
- throw new MojoExecutionException(
- "Cannot create " + config.getEclipseProjectDirectory() + "/maven-eclipse.xml", e );
+ throw new MojoExecutionException( "Cannot create " + config.getEclipseProjectDirectory()
+ + "/maven-eclipse.xml", e );
}
log.info( "Creating external launcher file" );
@@ -329,9 +326,12 @@ public class EclipseClasspathWriter
// finally add it to the project writer.
config.getBuildCommands().add(
- new BuildCommand( "org.eclipse.ui.externaltools.ExternalToolBuilder", "LaunchConfigHandle",
- "<project>/" + EclipseLaunchConfigurationWriter.FILE_DOT_EXTERNAL_TOOL_BUILDERS
- + "Maven_Ant_Builder.launch" ) );
+ new BuildCommand(
+ "org.eclipse.ui.externaltools.ExternalToolBuilder",
+ "LaunchConfigHandle",
+ "<project>/"
+ + EclipseLaunchConfigurationWriter.FILE_DOT_EXTERNAL_TOOL_BUILDERS
+ + "Maven_Ant_Builder.launch" ) );
}
// ----------------------------------------------------------------------
@@ -344,52 +344,47 @@ public class EclipseClasspathWriter
writer.endElement();
Set addedDependencies = new HashSet();
-
+
// ----------------------------------------------------------------------
// Java API dependencies that may complete the classpath container must
// be declared BEFORE all other dependencies so that container access rules don't fail
// ----------------------------------------------------------------------
IdeDependency[] depsToWrite = config.getDeps();
- for ( IdeDependency dep : depsToWrite )
- {
- if ( dep.isJavaApi() )
- {
- String depId = getDependencyId( dep );
- if ( !addedDependencies.contains( depId ) )
- {
- addDependency( writer, dep );
- addedDependencies.add( depId );
+ for (IdeDependency dep : depsToWrite) {
+ if (dep.isJavaApi()) {
+ String depId = getDependencyId(dep);
+ if (!addedDependencies.contains(depId)) {
+ addDependency(writer, dep);
+ addedDependencies.add(depId);
}
}
}
+
- if ( !config.isClasspathContainersLast() )
+ if (!config.isClasspathContainersLast())
{
- writeClasspathContainers( writer );
+ writeClasspathContainers(writer);
}
// ----------------------------------------------------------------------
// The project's dependencies
// ----------------------------------------------------------------------
- for ( IdeDependency dep : depsToWrite )
- {
- if ( dep.isAddedToClasspath() )
- {
- String depId = getDependencyId( dep );
+ for (IdeDependency dep : depsToWrite) {
+ if (dep.isAddedToClasspath()) {
+ String depId = getDependencyId(dep);
/* avoid duplicates in the classpath for artifacts with different types (like ejbs or test-jars) */
- if ( !addedDependencies.contains( depId ) )
- {
- addDependency( writer, dep );
- addedDependencies.add( depId );
+ if (!addedDependencies.contains(depId)) {
+ addDependency(writer, dep);
+ addedDependencies.add(depId);
}
}
}
- if ( config.isClasspathContainersLast() )
+ if (config.isClasspathContainersLast())
{
- writeClasspathContainers( writer );
+ writeClasspathContainers(writer);
}
-
+
writer.endElement();
IOUtil.close( w );
@@ -399,17 +394,16 @@ public class EclipseClasspathWriter
/**
* @param writer
*/
- private void writeClasspathContainers( XMLWriter writer )
+ private void writeClasspathContainers(XMLWriter writer)
{
// ----------------------------------------------------------------------
// Container classpath entries
// ----------------------------------------------------------------------
- for ( Object o : config.getClasspathContainers() )
- {
- writer.startElement( ELT_CLASSPATHENTRY );
- writer.addAttribute( ATTR_KIND, "con" ); //$NON-NLS-1$
- writer.addAttribute( ATTR_PATH, (String) o );
+ for (Object o : config.getClasspathContainers()) {
+ writer.startElement(ELT_CLASSPATHENTRY);
+ writer.addAttribute(ATTR_KIND, "con"); //$NON-NLS-1$
+ writer.addAttribute(ATTR_PATH, (String) o);
writer.endElement(); // name
}
}
@@ -463,7 +457,7 @@ public class EclipseClasspathWriter
if ( log.isDebugEnabled() )
{
log.debug( Messages.getString( "EclipsePlugin.artifactissystemscoped", //$NON-NLS-1$
- new Object[]{ dep.getArtifactId(), path } ) );
+ new Object[] { dep.getArtifactId(), path } ) );
}
kind = ATTR_LIB;
@@ -510,9 +504,11 @@ public class EclipseClasspathWriter
{
if ( ATTR_VAR.equals( kind ) )
{
- sourcepath = M2_REPO + "/" //$NON-NLS-1$
- + IdeUtils.toRelativeAndFixSeparator( localRepositoryFile, dep.getSourceAttachment(),
- false );
+ sourcepath =
+ M2_REPO
+ + "/" //$NON-NLS-1$
+ + IdeUtils.toRelativeAndFixSeparator( localRepositoryFile, dep.getSourceAttachment(),
+ false );
}
else
{
@@ -535,7 +531,7 @@ public class EclipseClasspathWriter
// Replace aspectJ runtime library with ajdt ASPECTJRT_CONTAINER.
if ( ( config.getAjdtVersion() != 0 ) && isAspectJRuntime( dep ) )
{
- if ( !config.getClasspathContainers().contains( ASPECTJRT_CONTAINER ) )
+ if ( ! config.getClasspathContainers().contains( ASPECTJRT_CONTAINER ) )
{
config.getClasspathContainers().add( ASPECTJRT_CONTAINER );
}
@@ -562,8 +558,7 @@ public class EclipseClasspathWriter
}
writer.startElement( ATTRIBUTE ); //$NON-NLS-1$
- writer.addAttribute( VALUE, "jar:" + new File( javadocpath ).toURI()
- + "!/" ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ writer.addAttribute( VALUE, "jar:" + new File( javadocpath ).toURI() + "!/" ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
writer.addAttribute( NAME, "javadoc_location" ); //$NON-NLS-1$ //$NON-NLS-2$
writer.endElement();
Modified: maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseLaunchConfigurationWriter.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseLaunchConfigurationWriter.java?rev=1517906&r1=1517905&r2=1517906&view=diff
==============================================================================
--- maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseLaunchConfigurationWriter.java (original)
+++ maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseLaunchConfigurationWriter.java Tue Aug 27 18:25:03 2013
@@ -36,7 +36,7 @@ import org.codehaus.plexus.util.xml.XMLW
/**
* Base class for writing external launch configuration files.
- *
+ *
* @author <a href="mailto:kenneyw@neonics.com">Kenney Westerhof</a>
*/
public abstract class EclipseLaunchConfigurationWriter
@@ -50,7 +50,7 @@ public abstract class EclipseLaunchConfi
/**
* Filename including .launch
- *
+ *
* @param filename
*/
protected EclipseWriter init( Log log, EclipseWriterConfig config, String filename )
@@ -81,8 +81,7 @@ public abstract class EclipseLaunchConfi
}
catch ( IOException ex )
{
- throw new MojoExecutionException( Messages.getString( "EclipsePlugin.erroropeningfile" ),
- ex ); //$NON-NLS-1$
+ throw new MojoExecutionException( Messages.getString( "EclipsePlugin.erroropeningfile" ), ex ); //$NON-NLS-1$
}
XMLWriter writer = new PrettyPrintXMLWriter( w, "UTF-8", null );
@@ -118,12 +117,13 @@ public abstract class EclipseLaunchConfi
writeAttribute( writer, "org.eclipse.debug.core.capture_output", isCaptureOutput() );
- String workingSet = "<?xml version='1.0'?>"
- + "<launchConfigurationWorkingSet editPageId='org.eclipse.ui.resourceWorkingSetPage'"
- + " factoryID='org.eclipse.ui.internal.WorkingSetFactory'" + " label='workingSet'" + " name='workingSet'>";
+ String workingSet =
+ "<?xml version='1.0'?>"
+ + "<launchConfigurationWorkingSet editPageId='org.eclipse.ui.resourceWorkingSetPage'"
+ + " factoryID='org.eclipse.ui.internal.WorkingSetFactory'" + " label='workingSet'"
+ + " name='workingSet'>";
- for ( Object o : getMonitoredResources() )
- {
+ for (Object o : getMonitoredResources()) {
MonitoredResource monitoredResource = (MonitoredResource) o;
workingSet += monitoredResource.print();
@@ -142,8 +142,8 @@ public abstract class EclipseLaunchConfi
protected List getMonitoredResources()
{
- return Collections.singletonList(
- new MonitoredResource( config.getEclipseProjectName(), MonitoredResource.PROJECT ) );
+ return Collections.singletonList( new MonitoredResource( config.getEclipseProjectName(),
+ MonitoredResource.PROJECT ) );
}
protected abstract void addAttributes( XMLWriter writer );
@@ -170,7 +170,7 @@ public abstract class EclipseLaunchConfi
protected String[] getRunBuildKinds()
{
- return new String[]{ "full", "incremental", "auto", "clean" };
+ return new String[] { "full", "incremental", "auto", "clean" };
}
protected boolean isAppendEnvironmentVariables()
@@ -206,10 +206,9 @@ public abstract class EclipseLaunchConfi
writer.startElement( "listAttribute" );
writer.addAttribute( "key", key );
- for ( String value : values )
- {
- writer.startElement( "listEntry" );
- writer.addAttribute( "value", value );
+ for (String value : values) {
+ writer.startElement("listEntry");
+ writer.addAttribute("value", value);
writer.endElement();
}