Modified: maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/rad/RadManifestWriter.java URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/rad/RadManifestWriter.java?rev=1705359&r1=1705358&r2=1705359&view=diff ============================================================================== --- maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/rad/RadManifestWriter.java (original) +++ maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/rad/RadManifestWriter.java Fri Sep 25 21:53:36 2015 @@ -1,3 +1,5 @@ +package org.apache.maven.plugin.eclipse.writers.rad; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -16,7 +18,6 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.maven.plugin.eclipse.writers.rad; import java.io.File; @@ -41,8 +42,8 @@ public class RadManifestWriter extends AbstractEclipseManifestWriter { - private static final String DEFAULT_WEBAPP_RESOURCE_DIR = - "src" + File.separatorChar + "main" + File.separatorChar + "webapp"; + private static final String DEFAULT_WEBAPP_RESOURCE_DIR = "src" + File.separatorChar + "main" + File.separatorChar + + "webapp"; /** * Search the project for the existing META-INF directory where the manifest should be located. @@ -81,14 +82,16 @@ public class RadManifestWriter if ( metaInfBaseDirectory == null ) { - for (Object o : project.getResources()) { - metaInfBaseDirectory = ((Resource) o).getDirectory(); + for ( Object o : project.getResources() ) + { + metaInfBaseDirectory = ( (Resource) o ).getDirectory(); - File metaInfDirectoryFile = new File(metaInfBaseDirectory + File.separatorChar + META_INF_DIRECTORY); + File metaInfDirectoryFile = new File( metaInfBaseDirectory + File.separatorChar + META_INF_DIRECTORY ); - log.debug("Checking for existence of META-INF directory: " + metaInfDirectoryFile); + log.debug( "Checking for existence of META-INF directory: " + metaInfDirectoryFile ); - if (metaInfDirectoryFile.exists() && !metaInfDirectoryFile.isDirectory()) { + if ( metaInfDirectoryFile.exists() && !metaInfDirectoryFile.isDirectory() ) + { metaInfBaseDirectory = null; } } @@ -116,8 +119,10 @@ public class RadManifestWriter { boolean foundMetaInfBaseDirectory = false; - for (EclipseSourceDir esd : sourceDirs) { - if (esd.getPath().equals(metaInfBaseDirectory)) { + for ( EclipseSourceDir esd : sourceDirs ) + { + if ( esd.getPath().equals( metaInfBaseDirectory ) ) + { foundMetaInfBaseDirectory = true; break; }
Modified: maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/rad/RadWebSettingsWriter.java URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/rad/RadWebSettingsWriter.java?rev=1705359&r1=1705358&r2=1705359&view=diff ============================================================================== --- maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/rad/RadWebSettingsWriter.java (original) +++ maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/rad/RadWebSettingsWriter.java Fri Sep 25 21:53:36 2015 @@ -1,3 +1,5 @@ +package org.apache.maven.plugin.eclipse.writers.rad; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -16,7 +18,6 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.maven.plugin.eclipse.writers.rad; import java.io.File; import java.io.FileOutputStream; @@ -111,7 +112,7 @@ public class RadWebSettingsWriter } catch ( IOException ex ) { - throw new MojoExecutionException( Messages.getString( "EclipsePlugin.erroropeningfile" ), ex ); //$NON-NLS-1$ + throw new MojoExecutionException( Messages.getString( "EclipsePlugin.erroropeningfile" ), ex ); } XMLWriter writer = new PrettyPrintXMLWriter( w, "UTF-8", null ); @@ -137,7 +138,7 @@ public class RadWebSettingsWriter File warSourceDirectory = new File( IdeUtils.getPluginSetting( config.getProject(), JeeUtils.ARTIFACT_MAVEN_WAR_PLUGIN, "warSourceDirectory", //$NON-NLS-1$ - config.getProject().getBasedir() + "/src/main/webapp" ) ); //$NON-NLS-1$ + config.getProject().getBasedir() + "/src/main/webapp" ) ); String webContentDir = IdeUtils.toRelativeAndFixSeparator( config.getEclipseProjectDirectory(), warSourceDirectory, false ); @@ -182,24 +183,26 @@ public class RadWebSettingsWriter IdeDependency[] deps = config.getDeps(); if ( deps != null ) { - for (final IdeDependency dependency : deps) { - log.debug("RadWebSettingsWriter: checking dependency " + dependency.toString()); + for ( final IdeDependency dependency : deps ) + { + log.debug( "RadWebSettingsWriter: checking dependency " + dependency.toString() ); - if (dependency.isReferencedProject() && !dependency.isTestDependency() && !dependency.isProvided()) { - log.debug("RadWebSettingsWriter: dependency " + dependency.toString() - + " selected for inclusion as lib-module"); + if ( dependency.isReferencedProject() && !dependency.isTestDependency() && !dependency.isProvided() ) + { + log.debug( "RadWebSettingsWriter: dependency " + dependency.toString() + + " selected for inclusion as lib-module" ); String depName = dependency.getEclipseProjectName(); String depJar = dependency.getArtifactId() + ".jar"; - writer.startElement(WEBSETTINGS_LIBMODULE); + writer.startElement( WEBSETTINGS_LIBMODULE ); - writer.startElement(WEBSETTINGS_LM_JAR); - writer.writeText(depJar); + writer.startElement( WEBSETTINGS_LM_JAR ); + writer.writeText( depJar ); writer.endElement(); // jar - writer.startElement(WEBSETTINGS_LM_PROJECT); - writer.writeText(depName); + writer.startElement( WEBSETTINGS_LM_PROJECT ); + writer.writeText( depName ); writer.endElement(); // project writer.endElement(); // libmodule Modified: maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/rad/RadWebsiteConfigWriter.java URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/rad/RadWebsiteConfigWriter.java?rev=1705359&r1=1705358&r2=1705359&view=diff ============================================================================== --- maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/rad/RadWebsiteConfigWriter.java (original) +++ maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/rad/RadWebsiteConfigWriter.java Fri Sep 25 21:53:36 2015 @@ -1,3 +1,5 @@ +package org.apache.maven.plugin.eclipse.writers.rad; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -16,7 +18,6 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.maven.plugin.eclipse.writers.rad; import java.io.File; import java.io.FileOutputStream; @@ -24,13 +25,10 @@ import java.io.IOException; import java.io.OutputStreamWriter; import java.io.Writer; -import org.apache.maven.artifact.repository.ArtifactRepository; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.eclipse.Constants; -import org.apache.maven.plugin.eclipse.EclipseSourceDir; import org.apache.maven.plugin.eclipse.Messages; import org.apache.maven.plugin.eclipse.writers.AbstractEclipseWriter; -import org.apache.maven.plugin.eclipse.writers.wtp.AbstractWtpResourceWriter; import org.codehaus.plexus.util.IOUtil; import org.codehaus.plexus.util.xml.PrettyPrintXMLWriter; import org.codehaus.plexus.util.xml.XMLWriter; @@ -55,7 +53,6 @@ public class RadWebsiteConfigWriter /** * write the website-config file for RAD6 if needed. * - * @see AbstractWtpResourceWriter#write(EclipseSourceDir[], ArtifactRepository, File) * @param sourceDirs all eclipse source directorys * @param localRepository the local reposetory * @param buildOutputDirectory build output directory (target) @@ -75,7 +72,7 @@ public class RadWebsiteConfigWriter } catch ( IOException ex ) { - throw new MojoExecutionException( Messages.getString( "EclipsePlugin.erroropeningfile" ), ex ); //$NON-NLS-1$ + throw new MojoExecutionException( Messages.getString( "EclipsePlugin.erroropeningfile" ), ex ); } XMLWriter writer = new PrettyPrintXMLWriter( w, "UTF-8", null ); writeModuleTypeFacetCore( writer ); Modified: 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?rev=1705359&r1=1705358&r2=1705359&view=diff ============================================================================== --- maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/workspace/EclipseCodeFormatterProfile.java (original) +++ maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/workspace/EclipseCodeFormatterProfile.java Fri Sep 25 21:53:36 2015 @@ -19,7 +19,6 @@ package org.apache.maven.plugin.eclipse. * under the License. */ - import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; @@ -85,11 +84,11 @@ public class EclipseCodeFormatterProfile } catch ( XmlPullParserException e ) { - throw new MojoExecutionException( Messages.getString( "EclipsePlugin.cantparseexisting", url.toString() ) ); //$NON-NLS-1$ + throw new MojoExecutionException( Messages.getString( "EclipsePlugin.cantparseexisting", url.toString() ) ); } catch ( IOException e ) { - throw new MojoExecutionException( Messages.getString( "EclipsePlugin.cantparseexisting", url.toString() ) ); //$NON-NLS-1$ + throw new MojoExecutionException( Messages.getString( "EclipsePlugin.cantparseexisting", url.toString() ) ); } finally { @@ -112,7 +111,7 @@ public class EclipseCodeFormatterProfile } catch ( IOException e ) { - throw new MojoExecutionException( Messages.getString( "EclipsePlugin.cantreadfile", url.toString() ), e ); //$NON-NLS-1$ + throw new MojoExecutionException( Messages.getString( "EclipsePlugin.cantreadfile", url.toString() ), e ); } finally { Modified: maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/workspace/EclipseSettingsWriter.java URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/workspace/EclipseSettingsWriter.java?rev=1705359&r1=1705358&r2=1705359&view=diff ============================================================================== --- maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/workspace/EclipseSettingsWriter.java (original) +++ maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/workspace/EclipseSettingsWriter.java Fri Sep 25 21:53:36 2015 @@ -1,3 +1,5 @@ +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 @@ -16,7 +18,6 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.maven.plugin.eclipse.writers.workspace; import java.io.File; import java.io.FileInputStream; @@ -42,15 +43,15 @@ public class EclipseSettingsWriter extends AbstractEclipseWriter { - private static final String JDK_1_2_SOURCES = "1.2"; //$NON-NLS-1$ + private static final String JDK_1_2_SOURCES = "1.2"; - private static final String PROP_ECLIPSE_PREFERENCES_VERSION = "eclipse.preferences.version"; //$NON-NLS-1$ + private static final String PROP_ECLIPSE_PREFERENCES_VERSION = "eclipse.preferences.version"; - private static final String PROP_JDT_CORE_COMPILER_COMPLIANCE = "org.eclipse.jdt.core.compiler.compliance"; //$NON-NLS-1$ + private static final String PROP_JDT_CORE_COMPILER_COMPLIANCE = "org.eclipse.jdt.core.compiler.compliance"; - private static final String PROP_JDT_CORE_COMPILER_SOURCE = "org.eclipse.jdt.core.compiler.source"; //$NON-NLS-1$ + private static final String PROP_JDT_CORE_COMPILER_SOURCE = "org.eclipse.jdt.core.compiler.source"; - private static final String PROP_JDT_CORE_COMPILER_ENCODING = "encoding/"; //$NON-NLS-1$ + private static final String PROP_JDT_CORE_COMPILER_ENCODING = "encoding/"; /** * @see org.apache.maven.plugin.eclipse.writers.EclipseWriter#write() @@ -71,63 +72,67 @@ public class EclipseSettingsWriter coreSettings.put( PROP_JDT_CORE_COMPILER_SOURCE, source ); coreSettings.put( PROP_JDT_CORE_COMPILER_COMPLIANCE, source ); } - + if ( encoding != null ) { File basedir = config.getProject().getBasedir(); - List compileSourceRoots = config.getProject().getCompileSourceRoots(); - if ( compileSourceRoots != null ) - { - for (Object compileSourceRoot : compileSourceRoots) { + List compileSourceRoots = config.getProject().getCompileSourceRoots(); + if ( compileSourceRoots != null ) + { + for ( Object compileSourceRoot : compileSourceRoots ) + { String sourcePath = (String) compileSourceRoot; - String relativePath = IdeUtils.toRelativeAndFixSeparator(basedir, new File(sourcePath), false); - coreSettings.put(PROP_JDT_CORE_COMPILER_ENCODING + relativePath, encoding); + String relativePath = IdeUtils.toRelativeAndFixSeparator( basedir, new File( sourcePath ), false ); + coreSettings.put( PROP_JDT_CORE_COMPILER_ENCODING + relativePath, encoding ); } - } - List testCompileSourceRoots = config.getProject().getTestCompileSourceRoots(); + } + List testCompileSourceRoots = config.getProject().getTestCompileSourceRoots(); if ( testCompileSourceRoots != null ) - { - for (Object testCompileSourceRoot : testCompileSourceRoots) { + { + for ( Object testCompileSourceRoot : testCompileSourceRoots ) + { String sourcePath = (String) testCompileSourceRoot; - String relativePath = IdeUtils.toRelativeAndFixSeparator(basedir, new File(sourcePath), false); - coreSettings.put(PROP_JDT_CORE_COMPILER_ENCODING + relativePath, encoding); + String relativePath = IdeUtils.toRelativeAndFixSeparator( basedir, new File( sourcePath ), false ); + coreSettings.put( PROP_JDT_CORE_COMPILER_ENCODING + relativePath, encoding ); } - } - List resources = config.getProject().getResources(); + } + List resources = config.getProject().getResources(); if ( resources != null ) - { - for (Object resource1 : resources) { + { + for ( Object resource1 : resources ) + { Resource resource = (Resource) resource1; String relativePath = - IdeUtils.toRelativeAndFixSeparator(basedir, new File(resource.getDirectory()), false); - coreSettings.put(PROP_JDT_CORE_COMPILER_ENCODING + relativePath, encoding); + IdeUtils.toRelativeAndFixSeparator( basedir, new File( resource.getDirectory() ), false ); + coreSettings.put( PROP_JDT_CORE_COMPILER_ENCODING + relativePath, encoding ); } - } - List testResources = config.getProject().getTestResources(); + } + List testResources = config.getProject().getTestResources(); if ( testResources != null ) - { - for (Object testResource : testResources) { + { + for ( Object testResource : testResources ) + { Resource resource = (Resource) testResource; String relativePath = - IdeUtils.toRelativeAndFixSeparator(basedir, new File(resource.getDirectory()), false); - coreSettings.put(PROP_JDT_CORE_COMPILER_ENCODING + relativePath, encoding); + IdeUtils.toRelativeAndFixSeparator( basedir, new File( resource.getDirectory() ), false ); + coreSettings.put( PROP_JDT_CORE_COMPILER_ENCODING + relativePath, encoding ); } - } + } } if ( target != null && !JDK_1_2_SOURCES.equals( target ) ) { - coreSettings.put( "org.eclipse.jdt.core.compiler.codegen.targetPlatform", target ); //$NON-NLS-1$ + coreSettings.put( "org.eclipse.jdt.core.compiler.codegen.targetPlatform", target ); } // write the settings, if needed if ( !coreSettings.isEmpty() ) { - File settingsDir = new File( config.getEclipseProjectDirectory(), EclipseWorkspaceWriter.DIR_DOT_SETTINGS ); //$NON-NLS-1$ + File settingsDir = new File( config.getEclipseProjectDirectory(), EclipseWorkspaceWriter.DIR_DOT_SETTINGS ); settingsDir.mkdirs(); - coreSettings.put( PROP_ECLIPSE_PREFERENCES_VERSION, "1" ); //$NON-NLS-1$ + coreSettings.put( PROP_ECLIPSE_PREFERENCES_VERSION, "1" ); try { @@ -154,22 +159,24 @@ public class EclipseSettingsWriter { coreSettings.store( new FileOutputStream( coreSettingsFile ), null ); - log.info( Messages.getString( "EclipseSettingsWriter.wrotesettings", //$NON-NLS-1$ + log.info( Messages.getString( "EclipseSettingsWriter.wrotesettings", coreSettingsFile.getCanonicalPath() ) ); } } catch ( FileNotFoundException e ) { - throw new MojoExecutionException( Messages.getString( "EclipseSettingsWriter.cannotcreatesettings" ), e ); //$NON-NLS-1$ + throw new MojoExecutionException( + Messages.getString( "EclipseSettingsWriter.cannotcreatesettings" ), e ); } catch ( IOException e ) { - throw new MojoExecutionException( Messages.getString( "EclipseSettingsWriter.errorwritingsettings" ), e ); //$NON-NLS-1$ + throw new MojoExecutionException( + Messages.getString( "EclipseSettingsWriter.errorwritingsettings" ), e ); } } else { - log.info( Messages.getString( "EclipseSettingsWriter.usingdefaults" ) ); //$NON-NLS-1$ + log.info( Messages.getString( "EclipseSettingsWriter.usingdefaults" ) ); } } } Modified: 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?rev=1705359&r1=1705358&r2=1705359&view=diff ============================================================================== --- maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/workspace/EclipseWorkspaceWriter.java (original) +++ maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/workspace/EclipseWorkspaceWriter.java Fri Sep 25 21:53:36 2015 @@ -19,7 +19,6 @@ package org.apache.maven.plugin.eclipse. * under the License. */ - import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; @@ -34,6 +33,8 @@ import org.apache.maven.plugin.eclipse.W import org.apache.maven.plugin.logging.Log; import org.codehaus.plexus.util.IOUtil; +/** + */ public class EclipseWorkspaceWriter implements WorkspaceWriter { @@ -41,33 +42,33 @@ public class EclipseWorkspaceWriter /** * Path under Eclipse workspace where Eclipse Plugin metadata/config is stored. */ - public static final String ECLIPSE_PLUGINS_METADATA_DIR = ".metadata/.plugins"; //$NON-NLS-1$ + public static final String ECLIPSE_PLUGINS_METADATA_DIR = ".metadata/.plugins"; /** * Path under {@value #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$ - + public static final String ECLIPSE_CORE_RUNTIME_SETTINGS_DIR = ECLIPSE_PLUGINS_METADATA_DIR + + "/org.eclipse.core.runtime/.settings"; + /** * Directory where workspace specific settings are written. */ - public static final String DIR_DOT_SETTINGS = ".settings"; //$NON-NLS-1$ - + public static final String DIR_DOT_SETTINGS = ".settings"; + /** * 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$ + public static final String ECLIPSE_JDT_CORE_PREFS_FILE = "org.eclipse.jdt.core.prefs"; /** * 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$ + public static final String CLASSPATH_VARIABLE_M2_REPO = "org.eclipse.jdt.core.classpathVariable.M2_REPO"; /** * 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$ + public static final String ECLIPSE_JDT_UI_PREFS_FILE = "org.eclipse.jdt.ui.prefs"; private WorkspaceConfiguration config; @@ -125,7 +126,7 @@ public class EclipseWorkspaceWriter Properties props = loadProperties( f ); - props.put( CLASSPATH_VARIABLE_M2_REPO, config.getLocalRepository().getBasedir() ); //$NON-NLS-1$ //$NON-NLS-2$ + props.put( CLASSPATH_VARIABLE_M2_REPO, config.getLocalRepository().getBasedir() ); storeProperties( props, f ); } @@ -145,12 +146,12 @@ public class EclipseWorkspaceWriter catch ( FileNotFoundException e ) { throw new MojoExecutionException( - Messages.getString( "EclipsePlugin.cantreadfile", f.getAbsolutePath() ), e ); //$NON-NLS-1$ + Messages.getString( "EclipsePlugin.cantreadfile", f.getAbsolutePath() ), e ); } catch ( IOException e ) { throw new MojoExecutionException( - Messages.getString( "EclipsePlugin.cantreadfile", f.getAbsolutePath() ), e ); //$NON-NLS-1$ + Messages.getString( "EclipsePlugin.cantreadfile", f.getAbsolutePath() ), e ); } } @@ -169,7 +170,7 @@ public class EclipseWorkspaceWriter } catch ( IOException ioe ) { - throw new MojoExecutionException( Messages.getString( "EclipsePlugin.cantwritetofile", //$NON-NLS-1$ + throw new MojoExecutionException( Messages.getString( "EclipsePlugin.cantwritetofile", f.getAbsolutePath() ) ); } finally Modified: 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?rev=1705359&r1=1705358&r2=1705359&view=diff ============================================================================== --- maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/workspace/WorkspaceWriter.java (original) +++ maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/workspace/WorkspaceWriter.java Fri Sep 25 21:53:36 2015 @@ -1,18 +1,22 @@ 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 + * 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 + * 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. + * 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; Modified: maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/wtp/AbstractWtpResourceWriter.java URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/wtp/AbstractWtpResourceWriter.java?rev=1705359&r1=1705358&r2=1705359&view=diff ============================================================================== --- maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/wtp/AbstractWtpResourceWriter.java (original) +++ maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/wtp/AbstractWtpResourceWriter.java Fri Sep 25 21:53:36 2015 @@ -1,3 +1,5 @@ +package org.apache.maven.plugin.eclipse.writers.wtp; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -16,7 +18,6 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.maven.plugin.eclipse.writers.wtp; import java.io.File; @@ -197,7 +198,7 @@ public abstract class AbstractWtpResourc // <dependency-type>uses</dependency-type> // </dependent-module> - handle = "module:/resource/" + dep.getEclipseProjectName() + "/" + dep.getEclipseProjectName(); //$NON-NLS-1$ //$NON-NLS-2$ + handle = "module:/resource/" + dep.getEclipseProjectName() + "/" + dep.getEclipseProjectName(); String archiveExtension = dep.getType(); if ( Constants.PROJECT_PACKAGING_EJB.equals( dep.getType() ) ) @@ -307,7 +308,7 @@ public abstract class AbstractWtpResourc // exclude test and provided and system dependencies outside the project if ( ( !dep.isTestDependency() && !dep.isProvided() && !dep.isSystemScopedOutsideProject( project ) ) && ( Constants.PROJECT_PACKAGING_JAR.equals( type ) || Constants.PROJECT_PACKAGING_EJB.equals( type ) - || "ejb-client".equals( type ) || Constants.PROJECT_PACKAGING_WAR.equals( type ) ) ) //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ + || "ejb-client".equals( type ) || Constants.PROJECT_PACKAGING_WAR.equals( type ) ) ) { addDependency( writer, dep, localRepository, config.getProject().getBasedir(), deployDir ); } Modified: maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/wtp/EclipseWtpApplicationXMLWriter.java URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/wtp/EclipseWtpApplicationXMLWriter.java?rev=1705359&r1=1705358&r2=1705359&view=diff ============================================================================== --- maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/wtp/EclipseWtpApplicationXMLWriter.java (original) +++ maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/wtp/EclipseWtpApplicationXMLWriter.java Fri Sep 25 21:53:36 2015 @@ -19,7 +19,6 @@ package org.apache.maven.plugin.eclipse. * under the License. */ - import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; @@ -30,10 +29,8 @@ import java.io.OutputStreamWriter; import java.io.Reader; import java.io.Writer; -import org.apache.maven.artifact.repository.ArtifactRepository; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.eclipse.Constants; -import org.apache.maven.plugin.eclipse.EclipseSourceDir; import org.apache.maven.plugin.ide.IdeDependency; import org.apache.maven.plugin.ide.IdeUtils; import org.apache.maven.plugin.ide.JeeUtils; @@ -123,7 +120,6 @@ public class EclipseWtpApplicationXMLWri /** * write the application.xml and the .modulemaps file to the META-INF directory. * - * @see AbstractWtpResourceWriter#write(EclipseSourceDir[], ArtifactRepository, File) * @throws MojoExecutionException when writing the config files was not possible */ public void write() @@ -154,7 +150,8 @@ public class EclipseWtpApplicationXMLWri File modulemapsXmlFile = new File( this.config.getEclipseProjectDirectory(), "target" + File.separator + "eclipseEar" - + File.separator + "META-INF" + File.separator + EclipseWtpApplicationXMLWriter.MODULEMAPS_FILENAME ); + + File.separator + "META-INF" + File.separator + + EclipseWtpApplicationXMLWriter.MODULEMAPS_FILENAME ); Xpp3Dom modulemapsXmlDom = readXMLFile( modulemapsXmlFile ); if ( modulemapsXmlDom == null ) { @@ -167,8 +164,9 @@ public class EclipseWtpApplicationXMLWri new String[] { "modules", "webModule" } ); IdeDependency[] deps = this.config.getDeps(); - for (IdeDependency dep : deps) { - updateApplicationXml(applicationXmlDom, modulemapsXmlDom, dep); + for ( IdeDependency dep : deps ) + { + updateApplicationXml( applicationXmlDom, modulemapsXmlDom, dep ); } removeUnusedEntries( applicationXmlDom, modulemapsXmlDom ); @@ -224,24 +222,29 @@ public class EclipseWtpApplicationXMLWri String sourcePath = sourceDirectory.getAbsolutePath(); - for (File file : files) { + for ( File file : files ) + { String dest = file.getAbsolutePath(); - dest = dest.substring(sourcePath.length() + 1); + dest = dest.substring( sourcePath.length() + 1 ); - File destination = new File(destinationDirectory, dest); + File destination = new File( destinationDirectory, dest ); - if (file.isFile()) { + if ( file.isFile() ) + { destination = destination.getParentFile(); - FileUtils.copyFileToDirectory(file, destination); - } else if (file.isDirectory() && !file.getName().equals(".svn") && !file.getName().equals("CVS")) { - if (!destination.exists() && !destination.mkdirs()) { - throw new IOException("Could not create destination directory '" + destination.getAbsolutePath() - + "'."); + FileUtils.copyFileToDirectory( file, destination ); + } + else if ( file.isDirectory() && !file.getName().equals( ".svn" ) && !file.getName().equals( "CVS" ) ) + { + if ( !destination.exists() && !destination.mkdirs() ) + { + throw new IOException( "Could not create destination directory '" + destination.getAbsolutePath() + + "'." ); } - copyDirectoryStructure(file, destination); + copyDirectoryStructure( file, destination ); } } } @@ -290,7 +293,8 @@ public class EclipseWtpApplicationXMLWri result.setAttribute( EclipseWtpApplicationXMLWriter.XMLNS_XMI, "http://www.omg.org/XMI" ); result.setAttribute( EclipseWtpApplicationXMLWriter.XMLNS_APPLICATION, "application.xmi" ); result.setAttribute( EclipseWtpApplicationXMLWriter.XMLNS_MODULEMAP, "modulemap.xmi" ); - result.setAttribute( EclipseWtpApplicationXMLWriter.XMI_ID, "EARProjectMap_" + System.identityHashCode( this ) ); + result.setAttribute( EclipseWtpApplicationXMLWriter.XMI_ID, "EARProjectMap_" + + System.identityHashCode( this ) ); return result; } @@ -306,9 +310,11 @@ public class EclipseWtpApplicationXMLWri { String id = getIdFromMapping( mapping ); Xpp3Dom[] children = applicationXmlDom.getChildren(); - for (Xpp3Dom aChildren : children) { - String childId = aChildren.getAttribute(EclipseWtpApplicationXMLWriter.ID); - if (childId != null && childId.equals(id)) { + for ( Xpp3Dom aChildren : children ) + { + String childId = aChildren.getAttribute( EclipseWtpApplicationXMLWriter.ID ); + if ( childId != null && childId.equals( id ) ) + { return aChildren; } } @@ -328,23 +334,19 @@ public class EclipseWtpApplicationXMLWri Xpp3Dom[] children = modulemapXmlDom.getChildren(); for ( int index = 0; index < children.length; index++ ) { - if ( children[index].getAttribute( EclipseWtpApplicationXMLWriter.MODULEMAPS_PROJECT_NAME ).equals( - dependency.getEclipseProjectName() ) ) + if ( children[index].getAttribute( EclipseWtpApplicationXMLWriter.MODULEMAPS_PROJECT_NAME ).equals( + dependency.getEclipseProjectName() ) ) { - if ( ( dependency.getType().equals( Constants.PROJECT_PACKAGING_EJB ) || dependency.getType().equals( - "ejb3" ) ) + // CHECKSTYLE_OFF: LineLength + if ( ( dependency.getType().equals( Constants.PROJECT_PACKAGING_EJB ) || dependency.getType().equals( "ejb3" ) ) && children[index].getName().equals( EclipseWtpApplicationXMLWriter.MODULEMAPS_MAPPINGS ) - && children[index].getChild( EclipseWtpApplicationXMLWriter.APPLICATION_XML_MODULE ).getAttribute( - EclipseWtpApplicationXMLWriter.XMI_TYPE ).equals( - EclipseWtpApplicationXMLWriter.MODULEMAPS_APPLICATION_EJB_MODULE ) ) + && children[index].getChild( EclipseWtpApplicationXMLWriter.APPLICATION_XML_MODULE ).getAttribute( EclipseWtpApplicationXMLWriter.XMI_TYPE ).equals( EclipseWtpApplicationXMLWriter.MODULEMAPS_APPLICATION_EJB_MODULE ) ) { return children[index]; } else if ( dependency.getType().equals( Constants.PROJECT_PACKAGING_WAR ) && children[index].getName().equals( EclipseWtpApplicationXMLWriter.MODULEMAPS_MAPPINGS ) - && children[index].getChild( EclipseWtpApplicationXMLWriter.APPLICATION_XML_MODULE ).getAttribute( - EclipseWtpApplicationXMLWriter.XMI_TYPE ).equals( - EclipseWtpApplicationXMLWriter.MODULEMAPS_APPLICATION_WEB_MODULE ) ) + && children[index].getChild( EclipseWtpApplicationXMLWriter.APPLICATION_XML_MODULE ).getAttribute( EclipseWtpApplicationXMLWriter.XMI_TYPE ).equals( EclipseWtpApplicationXMLWriter.MODULEMAPS_APPLICATION_WEB_MODULE ) ) { return children[index]; } @@ -358,6 +360,7 @@ public class EclipseWtpApplicationXMLWri modulemapXmlDom.removeChild( index ); break; } + // CHECKSTYLE_ON: LineLength } } // ok, its missing (or it changed type). create a new one based on its @@ -478,23 +481,31 @@ public class EclipseWtpApplicationXMLWri */ private void removeUnusedEntries( Xpp3Dom applicationXmlDom, Xpp3Dom modulemapsXmlDom ) { - for (Xpp3Dom aModulemapsXmlDomChildren : this.modulemapsXmlDomChildren) { - if (aModulemapsXmlDomChildren != null) { + for ( Xpp3Dom aModulemapsXmlDomChildren : this.modulemapsXmlDomChildren ) + { + if ( aModulemapsXmlDomChildren != null ) + { Xpp3Dom[] newModulemapsXmlDomChildren = modulemapsXmlDom.getChildren(); - for (int newIndex = 0; newIndex < newModulemapsXmlDomChildren.length; newIndex++) { - if (newModulemapsXmlDomChildren[newIndex] == aModulemapsXmlDomChildren) { - modulemapsXmlDom.removeChild(newIndex); + for ( int newIndex = 0; newIndex < newModulemapsXmlDomChildren.length; newIndex++ ) + { + if ( newModulemapsXmlDomChildren[newIndex] == aModulemapsXmlDomChildren ) + { + modulemapsXmlDom.removeChild( newIndex ); break; } } } } - for (Xpp3Dom anApplicationXmlDomChildren : this.applicationXmlDomChildren) { - if (anApplicationXmlDomChildren != null) { + for ( Xpp3Dom anApplicationXmlDomChildren : this.applicationXmlDomChildren ) + { + if ( anApplicationXmlDomChildren != null ) + { Xpp3Dom[] newApplicationXmlDomChildren = applicationXmlDom.getChildren(); - for (int newIndex = 0; newIndex < newApplicationXmlDomChildren.length; newIndex++) { - if (newApplicationXmlDomChildren[newIndex] == anApplicationXmlDomChildren) { - applicationXmlDom.removeChild(newIndex); + for ( int newIndex = 0; newIndex < newApplicationXmlDomChildren.length; newIndex++ ) + { + if ( newApplicationXmlDomChildren[newIndex] == anApplicationXmlDomChildren ) + { + applicationXmlDom.removeChild( newIndex ); break; } } @@ -559,13 +570,11 @@ public class EclipseWtpApplicationXMLWri else { handled( module ); - module.getChild( EclipseWtpApplicationXMLWriter.APPLICATION_XML_WEB ).getChild( - EclipseWtpApplicationXMLWriter.APPLICATION_XML_WEB_URI ).setValue( - dependency.getEclipseProjectName() + // CHECKSTYLE_OFF: LineLength + module.getChild( EclipseWtpApplicationXMLWriter.APPLICATION_XML_WEB ).getChild( EclipseWtpApplicationXMLWriter.APPLICATION_XML_WEB_URI ).setValue( dependency.getEclipseProjectName() + ".war" ); - module.getChild( EclipseWtpApplicationXMLWriter.APPLICATION_XML_WEB ).getChild( - EclipseWtpApplicationXMLWriter.APPLICATION_XML_CONTEXT_ROOT ).setValue( - contextRootInPom ); + module.getChild( EclipseWtpApplicationXMLWriter.APPLICATION_XML_WEB ).getChild( EclipseWtpApplicationXMLWriter.APPLICATION_XML_CONTEXT_ROOT ).setValue( contextRootInPom ); + // CHECKSTYLE_ON: LineLength } } } @@ -580,13 +589,15 @@ public class EclipseWtpApplicationXMLWri { String artifactId = dependency.getArtifactId(); String groupId = dependency.getGroupId(); - for (Xpp3Dom webModulesFromPom : this.webModulesFromPoms) { - Xpp3Dom webGroupId = webModulesFromPom.getChild("groupId"); - Xpp3Dom webArtifactId = webModulesFromPom.getChild("artifactId"); - Xpp3Dom webContextRoot = webModulesFromPom.getChild("contextRoot"); + for ( Xpp3Dom webModulesFromPom : this.webModulesFromPoms ) + { + Xpp3Dom webGroupId = webModulesFromPom.getChild( "groupId" ); + Xpp3Dom webArtifactId = webModulesFromPom.getChild( "artifactId" ); + Xpp3Dom webContextRoot = webModulesFromPom.getChild( "contextRoot" ); - if (webContextRoot != null && webArtifactId != null && webArtifactId.getValue().equals(artifactId) - && webGroupId != null && webGroupId.getValue().equals(groupId)) { + if ( webContextRoot != null && webArtifactId != null && webArtifactId.getValue().equals( artifactId ) + && webGroupId != null && webGroupId.getValue().equals( groupId ) ) + { return webContextRoot.getValue(); } } Modified: maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/wtp/EclipseWtpComponent15Writer.java URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/wtp/EclipseWtpComponent15Writer.java?rev=1705359&r1=1705358&r2=1705359&view=diff ============================================================================== --- maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/wtp/EclipseWtpComponent15Writer.java (original) +++ maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/wtp/EclipseWtpComponent15Writer.java Fri Sep 25 21:53:36 2015 @@ -1,3 +1,5 @@ +package org.apache.maven.plugin.eclipse.writers.wtp; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -16,7 +18,6 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.maven.plugin.eclipse.writers.wtp; import org.codehaus.plexus.util.xml.XMLWriter; @@ -38,7 +39,7 @@ public class EclipseWtpComponent15Writer */ protected String getComponentFileName() { - return "org.eclipse.wst.common.component"; //$NON-NLS-1$ + return "org.eclipse.wst.common.component"; } /** @@ -50,11 +51,11 @@ public class EclipseWtpComponent15Writer { if ( this.config.getWtpVersion() < 2.0f ) { - return "1.5.0"; //$NON-NLS-1$ + return "1.5.0"; } else { - return "2.0"; //$NON-NLS-1$ + return "2.0"; } } 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?rev=1705359&r1=1705358&r2=1705359&view=diff ============================================================================== --- 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 Fri Sep 25 21:53:36 2015 @@ -1,3 +1,5 @@ +package org.apache.maven.plugin.eclipse.writers.wtp; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -16,7 +18,6 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.maven.plugin.eclipse.writers.wtp; import java.io.File; import java.io.FileOutputStream; @@ -97,7 +98,7 @@ public class EclipseWtpComponentWriter } catch ( IOException ex ) { - throw new MojoExecutionException( Messages.getString( "EclipsePlugin.erroropeningfile" ), ex ); //$NON-NLS-1$ + throw new MojoExecutionException( Messages.getString( "EclipsePlugin.erroropeningfile" ), ex ); } // create a .component file and write out to it @@ -144,7 +145,7 @@ public class EclipseWtpComponentWriter File warSourceDirectory = new File( IdeUtils.getPluginSetting( config.getProject(), JeeUtils.ARTIFACT_MAVEN_WAR_PLUGIN, "warSourceDirectory", //$NON-NLS-1$ - config.getProject().getBasedir() + "/src/main/webapp" ) ); //$NON-NLS-1$ + config.getProject().getBasedir() + "/src/main/webapp" ) ); writeContextRoot( writer ); @@ -159,13 +160,14 @@ public class EclipseWtpComponentWriter Xpp3Dom[] webResources = IdeUtils.getPluginConfigurationDom( config.getProject(), JeeUtils.ARTIFACT_MAVEN_WAR_PLUGIN, new String[] { "webResources", "resource" } ); - for (Xpp3Dom webResource : webResources) { - File webResourceDirectory = new File(webResource.getChild("directory").getValue()); - writer.startElement(ELT_WB_RESOURCE); - writer.addAttribute(ATTR_DEPLOY_PATH, "/"); //$NON-NLS-1$ - writer.addAttribute(ATTR_SOURCE_PATH, - IdeUtils.toRelativeAndFixSeparator(config.getEclipseProjectDirectory(), - webResourceDirectory, false)); + for ( Xpp3Dom webResource : webResources ) + { + File webResourceDirectory = new File( webResource.getChild( "directory" ).getValue() ); + writer.startElement( ELT_WB_RESOURCE ); + writer.addAttribute( ATTR_DEPLOY_PATH, "/" ); //$NON-NLS-1$ + writer.addAttribute( ATTR_SOURCE_PATH, + IdeUtils.toRelativeAndFixSeparator( config.getEclipseProjectDirectory(), + webResourceDirectory, false ) ); writer.endElement(); } @@ -186,7 +188,7 @@ public class EclipseWtpComponentWriter String earSourceDirectory = IdeUtils.getPluginSetting( config.getProject(), JeeUtils.ARTIFACT_MAVEN_EAR_PLUGIN, "earSourceDirectory", //$NON-NLS-1$ - config.getProject().getBasedir() + defaultApplicationXML ); //$NON-NLS-1$ + config.getProject().getBasedir() + defaultApplicationXML ); writer.startElement( ELT_WB_RESOURCE ); writer.addAttribute( ATTR_DEPLOY_PATH, "/" ); //$NON-NLS-1$ writer.addAttribute( ATTR_SOURCE_PATH, @@ -196,20 +198,22 @@ public class EclipseWtpComponentWriter } if ( Constants.PROJECT_PACKAGING_WAR.equalsIgnoreCase( packaging ) - || Constants.PROJECT_PACKAGING_EAR.equalsIgnoreCase( packaging ) ) //$NON-NLS-1$ //$NON-NLS-2$ + || Constants.PROJECT_PACKAGING_EAR.equalsIgnoreCase( packaging ) ) { // write out the dependencies. writeWarOrEarResources( writer, config.getProject(), localRepository ); } - for (EclipseSourceDir dir : sourceDirs) { + for ( EclipseSourceDir dir : sourceDirs ) + { // test src/resources are not added to wtpmodules - if (!dir.isTest()) { + if ( !dir.isTest() ) + { // <wb-resource deploy-path="/" source-path="/src/java" /> - writer.startElement(ELT_WB_RESOURCE); - writer.addAttribute(ATTR_DEPLOY_PATH, target); - writer.addAttribute(ATTR_SOURCE_PATH, dir.getPath()); + writer.startElement( ELT_WB_RESOURCE ); + writer.addAttribute( ATTR_DEPLOY_PATH, target ); + writer.addAttribute( ATTR_SOURCE_PATH, dir.getPath() ); writer.endElement(); } } Modified: maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/wtp/EclipseWtpFacetsWriter.java URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/wtp/EclipseWtpFacetsWriter.java?rev=1705359&r1=1705358&r2=1705359&view=diff ============================================================================== --- maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/wtp/EclipseWtpFacetsWriter.java (original) +++ maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/wtp/EclipseWtpFacetsWriter.java Fri Sep 25 21:53:36 2015 @@ -1,3 +1,5 @@ +package org.apache.maven.plugin.eclipse.writers.wtp; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -16,7 +18,6 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.maven.plugin.eclipse.writers.wtp; import java.io.File; import java.io.FileOutputStream; @@ -45,39 +46,39 @@ public class EclipseWtpFacetsWriter extends AbstractWtpResourceWriter { - private static final String FACET_COM_IBM_WEBSPHERE_COEXISTENCE_EAR = "com.ibm.websphere.coexistence.ear"; //$NON-NLS-1$ + private static final String FACET_COM_IBM_WEBSPHERE_COEXISTENCE_EAR = "com.ibm.websphere.coexistence.ear"; - private static final String FACET_COM_IBM_WEBSPHERE_EXTENDED_EAR = "com.ibm.websphere.extended.ear"; //$NON-NLS-1$ + private static final String FACET_COM_IBM_WEBSPHERE_EXTENDED_EAR = "com.ibm.websphere.extended.ear"; - private static final String FACET_JST_EAR = "jst.ear"; //$NON-NLS-1$ + private static final String FACET_JST_EAR = "jst.ear"; - private static final String FACET_JST_UTILITY = "jst.utility"; //$NON-NLS-1$ + private static final String FACET_JST_UTILITY = "jst.utility"; - private static final String FACET_JST_EJB = "jst.ejb"; //$NON-NLS-1$ + private static final String FACET_JST_EJB = "jst.ejb"; - private static final String FACET_JST_WEB = "jst.web"; //$NON-NLS-1$ + private static final String FACET_JST_WEB = "jst.web"; - private static final String FACET_JST_JAVA = "jst.java"; //$NON-NLS-1$ + private static final String FACET_JST_JAVA = "jst.java"; - private static final String ATTR_VERSION = "version"; //$NON-NLS-1$ + private static final String ATTR_VERSION = "version"; - private static final String ELT_INSTALLED = "installed"; //$NON-NLS-1$ + private static final String ELT_INSTALLED = "installed"; - private static final String ATTR_FACET = "facet"; //$NON-NLS-1$ + private static final String ATTR_FACET = "facet"; - private static final String ELT_FIXED = "fixed"; //$NON-NLS-1$ + private static final String ELT_FIXED = "fixed"; - private static final String ELT_FACETED_PROJECT = "faceted-project"; //$NON-NLS-1$ + private static final String ELT_FACETED_PROJECT = "faceted-project"; /** * The .settings folder for Web Tools Project 1.x release. */ - private static final String DIR_WTP_SETTINGS = ".settings"; //$NON-NLS-1$ + private static final String DIR_WTP_SETTINGS = ".settings"; /** * File name where Eclipse Project's Facet configuration will be stored. */ - private static final String FILE_FACET_CORE_XML = "org.eclipse.wst.common.project.facet.core.xml"; //$NON-NLS-1$ + private static final String FILE_FACET_CORE_XML = "org.eclipse.wst.common.project.facet.core.xml"; /** * @see org.apache.maven.plugin.eclipse.writers.EclipseWriter#write() @@ -101,7 +102,7 @@ public class EclipseWtpFacetsWriter } catch ( IOException ex ) { - throw new MojoExecutionException( Messages.getString( "EclipsePlugin.erroropeningfile" ), ex ); //$NON-NLS-1$ + throw new MojoExecutionException( Messages.getString( "EclipsePlugin.erroropeningfile" ), ex ); } XMLWriter writer = new PrettyPrintXMLWriter( w, "UTF-8", null ); writeModuleTypeFacetCore( writer, packaging ); @@ -117,7 +118,7 @@ public class EclipseWtpFacetsWriter private void writeModuleTypeFacetCore( XMLWriter writer, String packaging ) { writer.startElement( ELT_FACETED_PROJECT ); - if ( Constants.PROJECT_PACKAGING_WAR.equalsIgnoreCase( packaging ) ) //$NON-NLS-1$ + if ( Constants.PROJECT_PACKAGING_WAR.equalsIgnoreCase( packaging ) ) { writeFacetFixedElement( writer, FACET_JST_JAVA ); // fixed writeFacetFixedElement( writer, FACET_JST_WEB ); // fixed @@ -130,14 +131,16 @@ public class EclipseWtpFacetsWriter { servletVersion = JeeUtils.resolveServletVersion( config.getProject() ); } - writeFacetInstalledElement( writer, FACET_JST_WEB, servletVersion ); // installed - writeFacetInstalledElement( writer, FACET_JST_JAVA, IdeUtils.resolveJavaVersion( config.getProject() ) ); // installed + // installed + writeFacetInstalledElement( writer, FACET_JST_WEB, servletVersion ); + // installed + writeFacetInstalledElement( writer, FACET_JST_JAVA, IdeUtils.resolveJavaVersion( config.getProject() ) ); } - else if ( Constants.PROJECT_PACKAGING_EJB.equalsIgnoreCase( packaging ) ) //$NON-NLS-1$ + else if ( Constants.PROJECT_PACKAGING_EJB.equalsIgnoreCase( packaging ) ) { writeFacetFixedElement( writer, FACET_JST_JAVA ); // fixed writeFacetFixedElement( writer, FACET_JST_EJB ); // fixed - + String ejbVersion; if ( config.getJeeVersion() != null ) { @@ -147,10 +150,12 @@ public class EclipseWtpFacetsWriter { ejbVersion = JeeUtils.resolveEjbVersion( config.getProject() ); } - writeFacetInstalledElement( writer, FACET_JST_EJB, ejbVersion ); // installed - writeFacetInstalledElement( writer, FACET_JST_JAVA, IdeUtils.resolveJavaVersion( config.getProject() ) ); // installed + // installed + writeFacetInstalledElement( writer, FACET_JST_EJB, ejbVersion ); + // installed + writeFacetInstalledElement( writer, FACET_JST_JAVA, IdeUtils.resolveJavaVersion( config.getProject() ) ); } - else if ( Constants.PROJECT_PACKAGING_EAR.equalsIgnoreCase( packaging ) ) //$NON-NLS-1$ + else if ( Constants.PROJECT_PACKAGING_EAR.equalsIgnoreCase( packaging ) ) { if ( this.config.getWorkspaceConfiguration().getWebsphereVersion() != null ) { @@ -158,10 +163,12 @@ public class EclipseWtpFacetsWriter writer.addAttribute( "name", config.getWorkspaceConfiguration().getDefaultDeployServerName() ); writer.endElement(); // runtime + // installed writeFacetInstalledElement( writer, FACET_COM_IBM_WEBSPHERE_EXTENDED_EAR, - this.config.getWorkspaceConfiguration().getWebsphereVersion() ); // installed + this.config.getWorkspaceConfiguration().getWebsphereVersion() ); + // installed writeFacetInstalledElement( writer, FACET_COM_IBM_WEBSPHERE_COEXISTENCE_EAR, - this.config.getWorkspaceConfiguration().getWebsphereVersion() ); // installed + this.config.getWorkspaceConfiguration().getWebsphereVersion() ); } writeFacetFixedElement( writer, FACET_JST_EAR ); // fixed @@ -181,9 +188,10 @@ public class EclipseWtpFacetsWriter { writeFacetFixedElement( writer, FACET_JST_JAVA ); // fixed writeFacetFixedElement( writer, FACET_JST_UTILITY ); // fixed - writeFacetInstalledElement( writer, FACET_JST_UTILITY, "1.0" ); //$NON-NLS-1$ - writeFacetInstalledElement( writer, FACET_JST_JAVA, IdeUtils.resolveJavaVersion( config.getProject() ) ); // installed // installed + writeFacetInstalledElement( writer, FACET_JST_UTILITY, "1.0" ); + // installed + writeFacetInstalledElement( writer, FACET_JST_JAVA, IdeUtils.resolveJavaVersion( config.getProject() ) ); } writeAdditionalProjectFacets( writer ); @@ -235,12 +243,13 @@ public class EclipseWtpFacetsWriter return; } - for (Object o : config.getProjectFacets().entrySet()) { + for ( Object o : config.getProjectFacets().entrySet() ) + { Entry facetEntry = (Entry) o; - writer.startElement(ELT_INSTALLED); - writer.addAttribute(ATTR_FACET, (String) facetEntry.getKey()); - writer.addAttribute(ATTR_VERSION, (String) facetEntry.getValue()); + writer.startElement( ELT_INSTALLED ); + writer.addAttribute( ATTR_FACET, (String) facetEntry.getKey() ); + writer.addAttribute( ATTR_VERSION, (String) facetEntry.getValue() ); writer.endElement(); // installed } } Modified: maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/wtp/EclipseWtpmodulesWriter.java URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/wtp/EclipseWtpmodulesWriter.java?rev=1705359&r1=1705358&r2=1705359&view=diff ============================================================================== --- maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/wtp/EclipseWtpmodulesWriter.java (original) +++ maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/wtp/EclipseWtpmodulesWriter.java Fri Sep 25 21:53:36 2015 @@ -1,3 +1,5 @@ +package org.apache.maven.plugin.eclipse.writers.wtp; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -16,7 +18,6 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.maven.plugin.eclipse.writers.wtp; import java.io.File; import java.io.FileOutputStream; @@ -62,7 +63,7 @@ public class EclipseWtpmodulesWriter } catch ( IOException ex ) { - throw new MojoExecutionException( Messages.getString( "EclipsePlugin.erroropeningfile" ), ex ); //$NON-NLS-1$ + throw new MojoExecutionException( Messages.getString( "EclipsePlugin.erroropeningfile" ), ex ); } XMLWriter writer = new PrettyPrintXMLWriter( w, "UTF-8", null ); @@ -86,13 +87,14 @@ public class EclipseWtpmodulesWriter String warSourceDirectory = IdeUtils.getPluginSetting( config.getProject(), JeeUtils.ARTIFACT_MAVEN_WAR_PLUGIN, "warSourceDirectory", //$NON-NLS-1$ - config.getProject().getBasedir() + "/src/main/webapp" ); //$NON-NLS-1$ + config.getProject().getBasedir() + "/src/main/webapp" ); writer.startElement( ELT_WB_RESOURCE ); writer.addAttribute( ATTR_DEPLOY_PATH, "/" ); //$NON-NLS-1$ - writer.addAttribute( ATTR_SOURCE_PATH, "/" //$NON-NLS-1$ - + IdeUtils.toRelativeAndFixSeparator( config.getEclipseProjectDirectory(), - new File( warSourceDirectory ), false ) ); + writer.addAttribute( ATTR_SOURCE_PATH, + "/" //$NON-NLS-1$ + + IdeUtils.toRelativeAndFixSeparator( config.getEclipseProjectDirectory(), + new File( warSourceDirectory ), false ) ); writer.endElement(); writeWarOrEarResources( writer, config.getProject(), config.getLocalRepository() );
