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/25 20:51:55 UTC
svn commit: r1517364 [1/3] - in /maven/plugins/trunk:
maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/
maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/reader/
maven-eclipse-plugin/src/main/java/org/apache/maven/plu...
Author: krosenvold
Date: Sun Aug 25 18:51:54 2013
New Revision: 1517364
URL: http://svn.apache.org/r1517364
Log:
Java5 for eclipse and javadoc plugin
Added:
maven/plugins/trunk/maven-javadoc-plugin/javadoc-options-javadoc-resources.xml
Modified:
maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/BuildCommand.java
maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/EclipseCleanMojo.java
maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/EclipsePlugin.java
maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/EclipseToMavenMojo.java
maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/InstallPluginsMojo.java
maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/MyEclipsePlugin.java
maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/RadCleanMojo.java
maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/RadPlugin.java
maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/RemoveCacheMojo.java
maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/WorkspaceConfiguration.java
maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/reader/ReadWorkspaceLocations.java
maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/AbstractEclipseManifestWriter.java
maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseAjdtWriter.java
maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseClasspathWriter.java
maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseLaunchConfigurationWriter.java
maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseOSGiManifestWriter.java
maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseProjectWriter.java
maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/myeclipse/MyEclipseSpringBeansWriter.java
maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/rad/RadApplicationXMLWriter.java
maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/rad/RadEjbClasspathWriter.java
maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/rad/RadLibCopier.java
maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/rad/RadManifestWriter.java
maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/rad/RadWebSettingsWriter.java
maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/workspace/EclipseSettingsWriter.java
maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/wtp/EclipseWtpApplicationXMLWriter.java
maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/wtp/EclipseWtpComponentWriter.java
maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/wtp/EclipseWtpFacetsWriter.java
maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/ide/AbstractIdeSupportMojo.java
maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/ide/IdeUtils.java
maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/ide/JeeUtils.java
maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/InstallPluginsMojoTest.java
maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/TempEclipseWorkspace.java
maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/it/AbstractEclipsePluginIT.java
maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/writers/EclipseClasspathWriterUnitTest.java
maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/writers/EclipseProjectWriterTest.java
maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/writers/EclipseWtpComponent15WriterTest.java
maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/AbstractFixJavadocMojo.java
maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/AbstractJavadocMojo.java
maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/JavadocUtil.java
maven/plugins/trunk/maven-javadoc-plugin/src/test/java/org/apache/maven/plugin/javadoc/FixJavadocMojoTest.java
maven/plugins/trunk/maven-javadoc-plugin/src/test/java/org/apache/maven/plugin/javadoc/JavadocReportTest.java
maven/plugins/trunk/maven-javadoc-plugin/src/test/java/org/apache/maven/plugin/javadoc/JavadocUtilTest.java
maven/plugins/trunk/maven-javadoc-plugin/src/test/java/org/apache/maven/plugin/javadoc/ProxyServer.java
Modified: maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/BuildCommand.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/BuildCommand.java?rev=1517364&r1=1517363&r2=1517364&view=diff
==============================================================================
--- maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/BuildCommand.java (original)
+++ maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/BuildCommand.java Sun Aug 25 18:51:54 2013
@@ -179,16 +179,15 @@ public class BuildCommand
writer.startElement( "dictionary" );
- for ( Iterator it = arguments.keySet().iterator(); it.hasNext(); )
- {
- String key = (String) it.next();
+ for (Object o : arguments.keySet()) {
+ String key = (String) o;
- writer.startElement( "key" );
- writer.writeText( key );
+ writer.startElement("key");
+ writer.writeText(key);
writer.endElement();
- writer.startElement( "value" );
- writer.writeText( (String) arguments.get( key ) );
+ writer.startElement("value");
+ writer.writeText((String) arguments.get(key));
writer.endElement();
}
Modified: maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/EclipseCleanMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/EclipseCleanMojo.java?rev=1517364&r1=1517363&r2=1517364&view=diff
==============================================================================
--- maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/EclipseCleanMojo.java (original)
+++ maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/EclipseCleanMojo.java Sun Aug 25 18:51:54 2013
@@ -101,9 +101,8 @@ public class EclipseCleanMojo
if ( additionalConfig != null )
{
- for ( int i = 0; i < additionalConfig.length; i++ )
- {
- delete( new File( basedir, additionalConfig[i].getName() ) );
+ for (EclipseConfigFile anAdditionalConfig : additionalConfig) {
+ delete(new File(basedir, anAdditionalConfig.getName()));
}
}
Modified: maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/EclipsePlugin.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/EclipsePlugin.java?rev=1517364&r1=1517363&r2=1517364&view=diff
==============================================================================
--- maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/EclipsePlugin.java (original)
+++ maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/EclipsePlugin.java Sun Aug 25 18:51:54 2013
@@ -907,7 +907,7 @@ public class EclipsePlugin
public final boolean setup()
throws MojoExecutionException
{
- boolean ready = true;
+ boolean ready;
checkDeprecations();
setProjectNameTemplate( IdeUtils.calculateProjectNameTemplate( getProjectNameTemplate(),
@@ -1059,12 +1059,9 @@ public class EclipsePlugin
boolean containsJREContainer = false;
// Check if classpathContainer contains a JRE (default, alternate or
// Execution Environment)
- for ( Iterator iter = classpathContainers.iterator(); iter.hasNext(); )
- {
- Object classPathContainer = iter.next();
- if ( classPathContainer != null
- && classPathContainer.toString().startsWith( COMMON_PATH_JDT_LAUNCHING_JRE_CONTAINER ) )
- {
+ for (Object classPathContainer : classpathContainers) {
+ if (classPathContainer != null
+ && classPathContainer.toString().startsWith(COMMON_PATH_JDT_LAUNCHING_JRE_CONTAINER)) {
containsJREContainer = true;
break;
}
@@ -1242,101 +1239,77 @@ public class EclipsePlugin
{
if ( additionalConfig != null )
{
- for ( int j = 0; j < additionalConfig.length; j++ )
- {
- EclipseConfigFile file = additionalConfig[j];
- File projectRelativeFile = new File( eclipseProjectDir, file.getName() );
- if ( projectRelativeFile.isDirectory() )
- {
+ for (EclipseConfigFile file : additionalConfig) {
+ File projectRelativeFile = new File(eclipseProjectDir, file.getName());
+ if (projectRelativeFile.isDirectory()) {
// just ignore?
- getLog().warn( Messages.getString( "EclipsePlugin.foundadir", //$NON-NLS-1$
- projectRelativeFile.getAbsolutePath() ) );
+ getLog().warn(Messages.getString("EclipsePlugin.foundadir", //$NON-NLS-1$
+ projectRelativeFile.getAbsolutePath()));
}
- try
- {
+ try {
projectRelativeFile.getParentFile().mkdirs();
- if ( file.getContent() == null )
- {
- if ( file.getLocation() != null )
- {
- InputStream inStream = locator.getResourceAsInputStream( file.getLocation() );
- OutputStream outStream = new FileOutputStream( projectRelativeFile );
- try
- {
- IOUtil.copy( inStream, outStream );
- }
- finally
- {
+ if (file.getContent() == null) {
+ if (file.getLocation() != null) {
+ InputStream inStream = locator.getResourceAsInputStream(file.getLocation());
+ OutputStream outStream = new FileOutputStream(projectRelativeFile);
+ try {
+ IOUtil.copy(inStream, outStream);
+ } finally {
IOUtil.close(inStream);
IOUtil.close(outStream);
- }
- }
- else
- {
+ }
+ } else {
URL url = file.getURL();
String endPointUrl = url.getProtocol() + "://" + url.getAuthority();
// Repository Id should be ignored by Wagon ...
- Repository repository = new Repository( "additonal-configs", endPointUrl );
- Wagon wagon = wagonManager.getWagon( repository );;
- if ( logger.isDebugEnabled() )
- {
+ Repository repository = new Repository("additonal-configs", endPointUrl);
+ Wagon wagon = wagonManager.getWagon(repository);
+ ;
+ if (logger.isDebugEnabled()) {
Debug debug = new Debug();
- wagon.addSessionListener( debug );
- wagon.addTransferListener( debug );
+ wagon.addSessionListener(debug);
+ wagon.addTransferListener(debug);
}
- wagon.setTimeout( 1000 );
+ wagon.setTimeout(1000);
Settings settings = mavenSettingsBuilder.buildSettings();
- ProxyInfo proxyInfo = null;
- if ( settings != null && settings.getActiveProxy() != null )
- {
+ ProxyInfo proxyInfo = null;
+ if (settings != null && settings.getActiveProxy() != null) {
Proxy settingsProxy = settings.getActiveProxy();
proxyInfo = new ProxyInfo();
- proxyInfo.setHost( settingsProxy.getHost() );
- proxyInfo.setType( settingsProxy.getProtocol() );
- proxyInfo.setPort( settingsProxy.getPort() );
- proxyInfo.setNonProxyHosts( settingsProxy.getNonProxyHosts() );
- proxyInfo.setUserName( settingsProxy.getUsername() );
- proxyInfo.setPassword( settingsProxy.getPassword() );
+ proxyInfo.setHost(settingsProxy.getHost());
+ proxyInfo.setType(settingsProxy.getProtocol());
+ proxyInfo.setPort(settingsProxy.getPort());
+ proxyInfo.setNonProxyHosts(settingsProxy.getNonProxyHosts());
+ proxyInfo.setUserName(settingsProxy.getUsername());
+ proxyInfo.setPassword(settingsProxy.getPassword());
}
-
- if ( proxyInfo != null )
- {
- wagon.connect( repository, wagonManager.getAuthenticationInfo( repository.getId() ), proxyInfo );
- }
- else
- {
- wagon.connect( repository, wagonManager.getAuthenticationInfo( repository.getId() ) );
+
+ if (proxyInfo != null) {
+ wagon.connect(repository, wagonManager.getAuthenticationInfo(repository.getId()), proxyInfo);
+ } else {
+ wagon.connect(repository, wagonManager.getAuthenticationInfo(repository.getId()));
}
-
- wagon.get( url.getPath(), projectRelativeFile );
+
+ wagon.get(url.getPath(), projectRelativeFile);
}
+ } else {
+ FileUtils.fileWrite(projectRelativeFile.getAbsolutePath(), file.getContent());
}
- else
- {
- FileUtils.fileWrite( projectRelativeFile.getAbsolutePath(), file.getContent() );
- }
- }
- catch ( WagonException e ) {
+ } catch (WagonException e) {
throw new MojoExecutionException(Messages.getString("EclipsePlugin.remoteexception", //$NON-NLS-1$
- new Object[] { file.getURL(),
- e.getMessage() }));
- }
- catch ( IOException e )
- {
- throw new MojoExecutionException( Messages.getString( "EclipsePlugin.cantwritetofile", //$NON-NLS-1$
- projectRelativeFile.getAbsolutePath() ) );
- }
- catch ( ResourceNotFoundException e )
- {
- throw new MojoExecutionException( Messages.getString( "EclipsePlugin.cantfindresource", //$NON-NLS-1$
- file.getLocation() ) );
- }
- catch ( XmlPullParserException e )
- {
- throw new MojoExecutionException( Messages.getString( "EclipsePlugin.settingsxmlfailure", //$NON-NLS-1$
- e.getMessage() ) );
+ new Object[]{file.getURL(),
+ e.getMessage()}));
+ } catch (IOException e) {
+ throw new MojoExecutionException(Messages.getString("EclipsePlugin.cantwritetofile", //$NON-NLS-1$
+ projectRelativeFile.getAbsolutePath()));
+ } catch (ResourceNotFoundException e) {
+ throw new MojoExecutionException(Messages.getString("EclipsePlugin.cantfindresource", //$NON-NLS-1$
+ file.getLocation()));
+ } catch (XmlPullParserException e) {
+ throw new MojoExecutionException(Messages.getString("EclipsePlugin.settingsxmlfailure", //$NON-NLS-1$
+ e.getMessage()));
}
}
}
@@ -1388,17 +1361,11 @@ public class EclipsePlugin
if ( buildcommands != null )
{
- for ( Iterator it = buildcommands.iterator(); it.hasNext(); )
- {
- Object cmd = it.next();
-
- if ( cmd instanceof BuildCommand )
- {
- convertedBuildCommands.add( cmd );
- }
- else
- {
- convertedBuildCommands.add( new BuildCommand( (String) cmd ) );
+ for (Object cmd : buildcommands) {
+ if (cmd instanceof BuildCommand) {
+ convertedBuildCommands.add(cmd);
+ } else {
+ convertedBuildCommands.add(new BuildCommand((String) cmd));
}
}
}
@@ -1444,38 +1411,31 @@ public class EclipsePlugin
if ( reactorProjects != null && wtpContextName == null
&& Constants.PROJECT_PACKAGING_WAR.equals( project.getPackaging() ) )
{
- for ( Iterator iter = reactorProjects.iterator(); iter.hasNext(); )
- {
- MavenProject reactorProject = (MavenProject) iter.next();
+ for (Object reactorProject1 : reactorProjects) {
+ MavenProject reactorProject = (MavenProject) reactorProject1;
- if ( Constants.PROJECT_PACKAGING_EAR.equals( reactorProject.getPackaging() ) )
- {
+ if (Constants.PROJECT_PACKAGING_EAR.equals(reactorProject.getPackaging())) {
Xpp3Dom[] warDefinitions =
- IdeUtils.getPluginConfigurationDom( reactorProject, JeeUtils.ARTIFACT_MAVEN_EAR_PLUGIN,
- new String[] { "modules", "webModule" } );
- for ( int index = 0; index < warDefinitions.length; index++ )
- {
- Xpp3Dom groupId = warDefinitions[index].getChild( "groupId" );
- Xpp3Dom artifactId = warDefinitions[index].getChild( "artifactId" );
- Xpp3Dom contextRoot = warDefinitions[index].getChild( "contextRoot" );
- if ( groupId != null && artifactId != null && contextRoot != null && groupId.getValue() != null
- && artifactId.getValue() != null && contextRoot.getValue() != null )
- {
+ IdeUtils.getPluginConfigurationDom(reactorProject, JeeUtils.ARTIFACT_MAVEN_EAR_PLUGIN,
+ new String[]{"modules", "webModule"});
+ for (Xpp3Dom warDefinition : warDefinitions) {
+ Xpp3Dom groupId = warDefinition.getChild("groupId");
+ Xpp3Dom artifactId = warDefinition.getChild("artifactId");
+ Xpp3Dom contextRoot = warDefinition.getChild("contextRoot");
+ if (groupId != null && artifactId != null && contextRoot != null && groupId.getValue() != null
+ && artifactId.getValue() != null && contextRoot.getValue() != null) {
getLog().info(
- "Found context root definition for " + groupId.getValue() + ":"
- + artifactId.getValue() + " " + contextRoot.getValue() );
- if ( project.getArtifactId().equals( artifactId.getValue() )
- && project.getGroupId().equals( groupId.getValue() ) )
- {
- config.setContextName( contextRoot.getValue() );
+ "Found context root definition for " + groupId.getValue() + ":"
+ + artifactId.getValue() + " " + contextRoot.getValue());
+ if (project.getArtifactId().equals(artifactId.getValue())
+ && project.getGroupId().equals(groupId.getValue())) {
+ config.setContextName(contextRoot.getValue());
}
- }
- else
- {
+ } else {
getLog().info(
- "Found incomplete ear configuration in " + reactorProject.getGroupId() + ":"
- + reactorProject.getGroupId() + " found "
- + warDefinitions[index].toString() );
+ "Found incomplete ear configuration in " + reactorProject.getGroupId() + ":"
+ + reactorProject.getGroupId() + " found "
+ + warDefinition.toString());
}
}
}
@@ -1716,19 +1676,17 @@ public class EclipsePlugin
String output )
throws MojoExecutionException
{
- for ( Iterator it = sourceRoots.iterator(); it.hasNext(); )
- {
+ for (Object sourceRoot1 : sourceRoots) {
- File sourceRootFile = new File( (String) it.next() );
+ File sourceRootFile = new File((String) sourceRoot1);
- if ( sourceRootFile.isDirectory() )
- {
+ if (sourceRootFile.isDirectory()) {
String sourceRoot =
- IdeUtils.toRelativeAndFixSeparator( projectBaseDir, sourceRootFile,
- !projectBaseDir.equals( basedir ) );
+ IdeUtils.toRelativeAndFixSeparator(projectBaseDir, sourceRootFile,
+ !projectBaseDir.equals(basedir));
- directories.add( new EclipseSourceDir( sourceRoot, output, false, test, sourceIncludes, sourceExcludes,
- false ) );
+ directories.add(new EclipseSourceDir(sourceRoot, output, false, test, sourceIncludes, sourceExcludes,
+ false));
}
}
}
@@ -1737,78 +1695,69 @@ public class EclipsePlugin
boolean test, final String output )
throws MojoExecutionException
{
- for ( Iterator it = resources.iterator(); it.hasNext(); )
- {
- Resource resource = (Resource) it.next();
+ for (Object resource1 : resources) {
+ Resource resource = (Resource) resource1;
- getLog().debug( "Processing resource dir: " + resource.getDirectory() );
+ getLog().debug("Processing resource dir: " + resource.getDirectory());
- List excludes = new ArrayList( resource.getExcludes() );
+ List excludes = new ArrayList(resource.getExcludes());
// automatically exclude java files: eclipse doesn't have the concept of resource directory so it will
// try to compile any java file found in maven resource dirs
- excludes.add( JAVA_FILE_PATTERN );
+ excludes.add(JAVA_FILE_PATTERN);
// TODO: figure out how to merge if the same dir is specified twice
// with different in/exclude patterns.
- File resourceDirectory = new File( /* basedir, */resource.getDirectory() );
+ File resourceDirectory = new File( /* basedir, */resource.getDirectory());
- if ( !resourceDirectory.exists() || !resourceDirectory.isDirectory() )
- {
- getLog().debug( "Resource dir: " + resourceDirectory + " either missing or not a directory." );
+ if (!resourceDirectory.exists() || !resourceDirectory.isDirectory()) {
+ getLog().debug("Resource dir: " + resourceDirectory + " either missing or not a directory.");
continue;
}
String resourcePath =
- IdeUtils.toRelativeAndFixSeparator( workspaceProjectBaseDir, resourceDirectory,
- !workspaceProjectBaseDir.equals( basedir ) );
+ IdeUtils.toRelativeAndFixSeparator(workspaceProjectBaseDir, resourceDirectory,
+ !workspaceProjectBaseDir.equals(basedir));
String thisOutput = output;
- if ( thisOutput != null )
- {
+ if (thisOutput != null) {
// sometimes thisOutput is already an absolute path
- File outputFile = new File( thisOutput );
- if ( !outputFile.isAbsolute() )
- {
- outputFile = new File( workspaceProjectBaseDir, thisOutput );
+ File outputFile = new File(thisOutput);
+ if (!outputFile.isAbsolute()) {
+ outputFile = new File(workspaceProjectBaseDir, thisOutput);
}
// create output dir if it doesn't exist
outputFile.mkdirs();
- if ( !StringUtils.isEmpty( resource.getTargetPath() ) )
- {
- outputFile = new File( outputFile, resource.getTargetPath() );
+ if (!StringUtils.isEmpty(resource.getTargetPath())) {
+ outputFile = new File(outputFile, resource.getTargetPath());
// create output dir if it doesn't exist
outputFile.mkdirs();
}
getLog().debug(
- "Making relative and fixing separator: { " + workspaceProjectBaseDir + ", "
- + outputFile + ", false }." );
- thisOutput = IdeUtils.toRelativeAndFixSeparator( workspaceProjectBaseDir, outputFile, false );
+ "Making relative and fixing separator: { " + workspaceProjectBaseDir + ", "
+ + outputFile + ", false }.");
+ thisOutput = IdeUtils.toRelativeAndFixSeparator(workspaceProjectBaseDir, outputFile, false);
}
EclipseSourceDir resourceDir =
- new EclipseSourceDir( resourcePath, thisOutput, true, test, resource.getIncludes(), excludes,
- resource.isFiltering() );
+ new EclipseSourceDir(resourcePath, thisOutput, true, test, resource.getIncludes(), excludes,
+ resource.isFiltering());
- if ( !directories.add( resourceDir ) )
- {
- EclipseSourceDir originalDir = (EclipseSourceDir) get( directories, resourceDir );
+ if (!directories.add(resourceDir)) {
+ EclipseSourceDir originalDir = (EclipseSourceDir) get(directories, resourceDir);
boolean merged = originalDir.merge(resourceDir);
- if (merged)
- {
+ if (merged) {
getLog().info(
- "Resource directory's path matches an existing source directory. Resources have been merged with the source directory "
- + originalDir.getPath());
- }
- else
- {
+ "Resource directory's path matches an existing source directory. Resources have been merged with the source directory "
+ + originalDir.getPath());
+ } else {
getLog()
- .info(
- "Resource directory's path matches an existing source directory but \"test\", \"filtering\" or \"output\" were different."
- + "The resulting eclipse configuration may not accurately reflect the project configuration for "
- + originalDir.getPath());
+ .info(
+ "Resource directory's path matches an existing source directory but \"test\", \"filtering\" or \"output\" were different."
+ + "The resulting eclipse configuration may not accurately reflect the project configuration for "
+ + originalDir.getPath());
}
}
@@ -1825,12 +1774,8 @@ public class EclipsePlugin
*/
private Object get( Set set, Object o )
{
- Iterator iter = set.iterator();
- while ( iter.hasNext() )
- {
- Object item = iter.next();
- if ( o.equals( item ) )
- {
+ for (Object item : set) {
+ if (o.equals(item)) {
return item;
}
}
@@ -1886,12 +1831,10 @@ public class EclipsePlugin
{
boolean enable = false;
List buildPlugins = project.getBuildPlugins();
- for ( Iterator it = buildPlugins.iterator(); it.hasNext(); )
- {
- Plugin plugin = (Plugin) it.next();
- if ( plugin.getGroupId().equals( ORG_CODEHAUS_MOJO )
- && plugin.getArtifactId().equals( ASPECTJ_MAVEN_PLUGIN ) )
- {
+ for (Object buildPlugin : buildPlugins) {
+ Plugin plugin = (Plugin) buildPlugin;
+ if (plugin.getGroupId().equals(ORG_CODEHAUS_MOJO)
+ && plugin.getArtifactId().equals(ASPECTJ_MAVEN_PLUGIN)) {
enable = true;
break;
}
@@ -1904,12 +1847,10 @@ public class EclipsePlugin
{
Xpp3Dom configuration = null;
List buildPlugins = project.getBuildPlugins();
- for ( Iterator it = buildPlugins.iterator(); it.hasNext(); )
- {
- Plugin plugin = (Plugin) it.next();
- if ( plugin.getGroupId().equals( ORG_CODEHAUS_MOJO )
- && plugin.getArtifactId().equals( ASPECTJ_MAVEN_PLUGIN ) )
- {
+ for (Object buildPlugin : buildPlugins) {
+ Plugin plugin = (Plugin) buildPlugin;
+ if (plugin.getGroupId().equals(ORG_CODEHAUS_MOJO)
+ && plugin.getArtifactId().equals(ASPECTJ_MAVEN_PLUGIN)) {
configuration = (Xpp3Dom) plugin.getConfiguration();
break;
}
@@ -1928,20 +1869,18 @@ public class EclipsePlugin
if ( aspectLibrariesParent != null )
{
Xpp3Dom[] aspectLibraries = aspectLibrariesParent.getChildren( ASPECT_LIBRARY );
- outerLoop: for ( int i = 0; i < aspectLibraries.length; i++ )
- {
- String artifactId = aspectLibraries[i].getChild( POM_ELT_ARTIFACT_ID ).getValue();
- String groupId = aspectLibraries[i].getChild( POM_ELT_GROUP_ID ).getValue();
- for ( int j = 0; j < deps.length; j++ )
- {
- if ( deps[j].getArtifactId().equals( artifactId ) && deps[j].getGroupId().equals( groupId ) )
- {
- deps[j].setAjdtDependency( true );
+ outerLoop:
+ for (Xpp3Dom aspectLibrary : aspectLibraries) {
+ String artifactId = aspectLibrary.getChild(POM_ELT_ARTIFACT_ID).getValue();
+ String groupId = aspectLibrary.getChild(POM_ELT_GROUP_ID).getValue();
+ for (IdeDependency dep : deps) {
+ if (dep.getArtifactId().equals(artifactId) && dep.getGroupId().equals(groupId)) {
+ dep.setAjdtDependency(true);
continue outerLoop;
}
}
- throw new MojoExecutionException( "AspectLibrary is not a dependency of project" );
+ throw new MojoExecutionException("AspectLibrary is not a dependency of project");
}
}
}
@@ -1957,20 +1896,18 @@ public class EclipsePlugin
if ( weaveDependenciesParent != null )
{
Xpp3Dom[] weaveDependencies = weaveDependenciesParent.getChildren( WEAVE_DEPENDENCY );
- outerLoop: for ( int i = 0; i < weaveDependencies.length; i++ )
- {
- String artifactId = weaveDependencies[i].getChild( POM_ELT_ARTIFACT_ID ).getValue();
- String groupId = weaveDependencies[i].getChild( POM_ELT_GROUP_ID ).getValue();
- for ( int j = 0; j < deps.length; j++ )
- {
- if ( deps[j].getArtifactId().equals( artifactId ) && deps[j].getGroupId().equals( groupId ) )
- {
- deps[j].setAjdtWeaveDependency( true );
+ outerLoop:
+ for (Xpp3Dom weaveDependency : weaveDependencies) {
+ String artifactId = weaveDependency.getChild(POM_ELT_ARTIFACT_ID).getValue();
+ String groupId = weaveDependency.getChild(POM_ELT_GROUP_ID).getValue();
+ for (IdeDependency dep : deps) {
+ if (dep.getArtifactId().equals(artifactId) && dep.getGroupId().equals(groupId)) {
+ dep.setAjdtWeaveDependency(true);
continue outerLoop;
}
}
- throw new MojoExecutionException( "WeaveDependency is not a dependency of project" );
+ throw new MojoExecutionException("WeaveDependency is not a dependency of project");
}
}
}
Modified: maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/EclipseToMavenMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/EclipseToMavenMojo.java?rev=1517364&r1=1517363&r2=1517364&view=diff
==============================================================================
--- maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/EclipseToMavenMojo.java (original)
+++ maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/EclipseToMavenMojo.java Sun Aug 25 18:51:54 2013
@@ -216,26 +216,22 @@ public class EclipseToMavenMojo
Map plugins = new HashMap();
Map models = new HashMap();
- for ( int j = 0; j < files.length; j++ )
- {
- File file = files[j];
-
+ for (File file : files) {
getLog().info(
- Messages.getString( "EclipseToMavenMojo.processingfile", file.getAbsolutePath() ) ); //$NON-NLS-1$
+ Messages.getString("EclipseToMavenMojo.processingfile", file.getAbsolutePath())); //$NON-NLS-1$
- processFile( file, plugins, models );
+ processFile(file, plugins, models);
}
int i = 1;
- for ( Iterator it = plugins.keySet().iterator(); it.hasNext(); )
- {
- getLog().info( Messages.getString( "EclipseToMavenMojo.processingplugin",
- new Object[]{ Integer.valueOf( i++ ),
- Integer.valueOf( plugins.keySet().size() ) } ) ); //$NON-NLS-1$
- String key = (String) it.next();
- EclipseOsgiPlugin plugin = (EclipseOsgiPlugin) plugins.get( key );
- Model model = (Model) models.get( key );
- writeArtifact( plugin, model, remoteRepo );
+ for (Object o : plugins.keySet()) {
+ getLog().info(Messages.getString("EclipseToMavenMojo.processingplugin",
+ new Object[]{Integer.valueOf(i++),
+ Integer.valueOf(plugins.keySet().size())})); //$NON-NLS-1$
+ String key = (String) o;
+ EclipseOsgiPlugin plugin = (EclipseOsgiPlugin) plugins.get(key);
+ Model model = (Model) models.get(key);
+ writeArtifact(plugin, model, remoteRepo);
}
}
@@ -289,24 +285,19 @@ public class EclipseToMavenMojo
protected void resolveVersionRanges( Model model, Map models )
throws MojoFailureException
{
- for ( Iterator it = model.getDependencies().iterator(); it.hasNext(); )
- {
- Dependency dep = (Dependency) it.next();
- if ( dep.getVersion().indexOf( "[" ) > -1
- || dep.getVersion().indexOf( "(" ) > -1 ) //$NON-NLS-1$ //$NON-NLS-2$
- {
- String key = getKey( model );
- Model dependencyModel = (Model) models.get( getKey( dep ) );
- if ( dependencyModel != null )
- {
- dep.setVersion( dependencyModel.getVersion() );
- }
- else
- {
+ for (Dependency dep : model.getDependencies()) {
+ if (dep.getVersion().contains("[")
+ || dep.getVersion().contains("(")) //$NON-NLS-1$ //$NON-NLS-2$
+ {
+ String key = getKey(model);
+ Model dependencyModel = (Model) models.get(getKey(dep));
+ if (dependencyModel != null) {
+ dep.setVersion(dependencyModel.getVersion());
+ } else {
throw new MojoFailureException(
- Messages.getString( "EclipseToMavenMojo.unabletoresolveversionrange",
- new Object[]{ dep //$NON-NLS-1$
- , key } ) ); //$NON-NLS-1$
+ Messages.getString("EclipseToMavenMojo.unabletoresolveversionrange",
+ new Object[]{dep //$NON-NLS-1$
+ , key})); //$NON-NLS-1$
}
}
}
@@ -424,9 +415,8 @@ public class EclipseToMavenMojo
if ( deps.length > 0 )
{
- for ( int k = 0; k < deps.length; k++ )
- {
- model.getDependencies().add( deps[k] );
+ for (Dependency dep : deps) {
+ model.getDependencies().add(dep);
}
}
@@ -445,7 +435,7 @@ public class EclipseToMavenMojo
throws MojoExecutionException
{
Writer fw = null;
- ArtifactMetadata metadata = null;
+ ArtifactMetadata metadata;
File pomFile = null;
Artifact pomArtifact =
artifactFactory.createArtifact( model.getGroupId(), model.getArtifactId(), model.getVersion(), null,
@@ -662,31 +652,29 @@ public class EclipseToMavenMojo
Map requireBundleHeader = analyzer.parseHeader( requireBundle );
// now iterates on bundles and extract dependencies
- for ( Iterator iter = requireBundleHeader.entrySet().iterator(); iter.hasNext(); )
- {
- Map.Entry entry = (Map.Entry) iter.next();
+ for (Object o : requireBundleHeader.entrySet()) {
+ Map.Entry entry = (Map.Entry) o;
String bundleName = (String) entry.getKey();
Map attributes = (Map) entry.getValue();
- String version = (String) attributes.get( Analyzer.BUNDLE_VERSION.toLowerCase() );
- boolean optional = "optional".equals( attributes.get( "resolution:" ) ); //$NON-NLS-1$ //$NON-NLS-2$
+ String version = (String) attributes.get(Analyzer.BUNDLE_VERSION.toLowerCase());
+ boolean optional = "optional".equals(attributes.get("resolution:")); //$NON-NLS-1$ //$NON-NLS-2$
- if ( version == null )
- {
+ if (version == null) {
getLog().info(
- Messages.getString( "EclipseToMavenMojo.missingversionforbundle", bundleName ) ); //$NON-NLS-1$
+ Messages.getString("EclipseToMavenMojo.missingversionforbundle", bundleName)); //$NON-NLS-1$
version = "[0,)"; //$NON-NLS-1$
}
- version = fixBuildNumberSeparator( version );
+ version = fixBuildNumberSeparator(version);
Dependency dep = new Dependency();
- dep.setGroupId( createGroupId( bundleName ) );
- dep.setArtifactId( createArtifactId( bundleName ) );
- dep.setVersion( version );
- dep.setOptional( optional );
+ dep.setGroupId(createGroupId(bundleName));
+ dep.setArtifactId(createArtifactId(bundleName));
+ dep.setVersion(version);
+ dep.setOptional(optional);
- dependencies.add( dep );
+ dependencies.add(dep);
}
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=1517364&r1=1517363&r2=1517364&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 Sun Aug 25 18:51:54 2013
@@ -192,35 +192,28 @@ public class InstallPluginsMojo
eclipseDir.mkdirs();
}
- for ( Iterator it = artifacts.iterator(); it.hasNext(); )
- {
- Artifact artifact = (Artifact) it.next();
+ for (Object artifact1 : artifacts) {
+ Artifact artifact = (Artifact) artifact1;
- if ( pluginDependencyTypes.indexOf( artifact.getType() ) > -1 )
- {
- 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
- {
+ install(artifact, project);
+ } else {
getLog().debug(
- "Skipping dependency: "
- + artifact.getId()
- + ". Set pluginDependencyTypes with a comma-separated list of types to change this." );
+ "Skipping dependency: "
+ + artifact.getId()
+ + ". Set pluginDependencyTypes with a comma-separated list of types to change this.");
}
}
}
@@ -268,10 +261,10 @@ public class InstallPluginsMojo
Properties properties = project.getProperties();
if ( properties != null )
{
- installAsJar = !Boolean.valueOf( properties.getProperty( PROP_UNPACK_PLUGIN, "false" ) ).booleanValue();
+ installAsJar = !Boolean.valueOf(properties.getProperty(PROP_UNPACK_PLUGIN, "false"));
}
- Attributes attributes = null;
+ Attributes attributes;
try
{
// don't verify, plugins zipped by eclipse:make-artifacts could have a bad signature
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=1517364&r1=1517363&r2=1517364&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 Sun Aug 25 18:51:54 2013
@@ -124,11 +124,9 @@ public class MyEclipsePlugin
"/src/main/webapp" ); //$NON-NLS-1$
EclipseSourceDir[] sourceDirs = config.getSourceDirs();
- for ( int i = 0; i < sourceDirs.length; i++ )
- {
- if ( !sourceDirs[i].isTest() )
- {
- sourceDirs[i].setOutput( warSourceDirectory + "/WEB-INF/classes" );
+ for (EclipseSourceDir sourceDir : sourceDirs) {
+ if (!sourceDir.isTest()) {
+ sourceDir.setOutput(warSourceDirectory + "/WEB-INF/classes");
}
}
}
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=1517364&r1=1517363&r2=1517364&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 Sun Aug 25 18:51:54 2013
@@ -176,11 +176,10 @@ public class RadCleanMojo
{
String[] oldFiles =
FileUtils.getFilesFromExtension( directory.getAbsolutePath(), new String[] { packagingType } );
- for ( int index = 0; index < oldFiles.length; index++ )
- {
- File f = new File( oldFiles[index] );
+ 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=1517364&r1=1517363&r2=1517364&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 Sun Aug 25 18:51:54 2013
@@ -308,24 +308,19 @@ public class RadPlugin
&& ( Constants.PROJECT_PACKAGING_JAR.equals( artifact.getType() )
|| Constants.PROJECT_PACKAGING_EJB.equals( artifact.getType() ) || Constants.PROJECT_PACKAGING_WAR.equals( artifact.getType() ) ) )
{
- for ( Iterator iter = this.reactorProjects.iterator(); iter.hasNext(); )
- {
- MavenProject reactorProject = (MavenProject) iter.next();
-
- if ( reactorProject.getGroupId().equals( artifact.getGroupId() )
- && reactorProject.getArtifactId().equals( artifact.getArtifactId() ) )
- {
- if ( reactorProject.getVersion().equals( artifact.getVersion() ) )
- {
+ 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())) {
return true;
- }
- else
- {
+ } else {
getLog().info(
- "Artifact "
- + artifact.getId()
- + " already available as a reactor project, but with different version. Expected: "
- + artifact.getVersion() + ", found: " + reactorProject.getVersion() );
+ "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=1517364&r1=1517363&r2=1517364&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 Sun Aug 25 18:51:54 2013
@@ -70,16 +70,12 @@ public class RemoveCacheMojo
*/
private void deleteMarkerFiles( List/* <File> */notAvailableMarkerFiles )
{
- for ( Iterator iter = notAvailableMarkerFiles.iterator(); iter.hasNext(); )
- {
- File markerFile = (File) iter.next();
- try
- {
- IdeUtils.delete( markerFile, getLog() );
- }
- catch ( MojoExecutionException e )
- {
- getLog().warn( e.getMessage(), e );
+ for (Object notAvailableMarkerFile : notAvailableMarkerFiles) {
+ File markerFile = (File) notAvailableMarkerFile;
+ try {
+ IdeUtils.delete(markerFile, getLog());
+ } catch (MojoExecutionException e) {
+ getLog().warn(e.getMessage(), e);
}
}
}
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=1517364&r1=1517363&r2=1517364&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 Sun Aug 25 18:51:54 2013
@@ -130,23 +130,23 @@ public class WorkspaceConfiguration
{
if ( getDefaultDeployServerId() != null && getDefaultDeployServerId().startsWith( "was." ) )
{
- if ( getDefaultDeployServerId().indexOf( "v7" ) >= 0 )
+ if (getDefaultDeployServerId().contains("v7"))
{
return "7.0";
}
- if ( getDefaultDeployServerId().indexOf( "v61" ) >= 0 )
+ if (getDefaultDeployServerId().contains("v61"))
{
return "6.1";
}
- if ( getDefaultDeployServerId().indexOf( "v6" ) >= 0 )
+ if (getDefaultDeployServerId().contains("v6"))
{
return "6.0";
}
- if ( getDefaultDeployServerId().indexOf( "v51" ) >= 0 )
+ if (getDefaultDeployServerId().contains("v51"))
{
return "5.1";
}
- if ( getDefaultDeployServerId().indexOf( "v5" ) >= 0 )
+ 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=1517364&r1=1517363&r2=1517364&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 Sun Aug 25 18:51:54 2013
@@ -133,7 +133,7 @@ public class ReadWorkspaceLocations
{
String id = (String) idIterator.next();
String name = (String) servers.get( id );
- if ( id.indexOf( wtpDefaultServer ) >= 0 || name.indexOf( wtpDefaultServer ) >= 0 )
+ if (id.contains(wtpDefaultServer) || name.contains(wtpDefaultServer))
{
workspaceConfiguration.setDefaultDeployServerId( id );
workspaceConfiguration.setDefaultDeployServerName( name );
@@ -161,7 +161,7 @@ public class ReadWorkspaceLocations
*/
private String getContainerFromExecutable( String rawExecutable, Map jreMap, Log logger )
{
- String foundContainer = null;
+ String foundContainer;
if ( rawExecutable != null )
{
String executable;
@@ -451,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 ( int vmTypeIndex = 0; vmTypeIndex < vmTypes.length; vmTypeIndex++ )
- {
- String typeId = vmTypes[vmTypeIndex].getAttribute( "id" );
- Xpp3Dom[] vm = vmTypes[vmTypeIndex].getChildren( "vm" );
- for ( int vmIndex = 0; vmIndex < vm.length; vmIndex++ )
- {
- try
- {
- String path = vm[vmIndex].getAttribute( "path" );
- String name = vm[vmIndex].getAttribute( "name" );
- String vmId = vm[vmIndex].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,
- new Object[] { 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,
+ new Object[]{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: " + vm[vmIndex].toString() );
+ } catch (IOException e) {
+ logger.warn("Could not interpret entry: " + aVm.toString());
}
}
}
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=1517364&r1=1517363&r2=1517364&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 Sun Aug 25 18:51:54 2013
@@ -71,10 +71,9 @@ public abstract class AbstractEclipseMan
String[] entries = newValue.split( " " );
Arrays.sort( entries );
StringBuilder buffer = new StringBuilder( newValue.length() );
- for ( int index = 0; index < entries.length; index++ )
- {
- buffer.append( entries[index] );
- buffer.append( ' ' );
+ for (String entry : entries) {
+ buffer.append(entry);
+ buffer.append(' ');
}
return buffer.toString();
}
@@ -161,24 +160,20 @@ public abstract class AbstractEclipseMan
Attributes newMap = manifest.getMainAttributes();
keys.addAll( existingMap.keySet() );
keys.addAll( newMap.keySet() );
- Iterator iterator = keys.iterator();
- while ( iterator.hasNext() )
- {
- Attributes.Name key = (Attributes.Name) iterator.next();
- String newValue = (String) newMap.get( key );
- String existingValue = (String) existingMap.get( key );
+ for (Object key1 : keys) {
+ Attributes.Name key = (Attributes.Name) key1;
+ 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 ( ( 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 (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");
return false;
}
}
@@ -196,9 +191,8 @@ public abstract class AbstractEclipseMan
StringBuilder StringBuilder = new StringBuilder();
IdeDependency[] deps = this.config.getDeps();
- for ( int index = 0; index < deps.length; index++ )
- {
- addDependencyToClassPath( StringBuilder, deps[index] );
+ for (IdeDependency dep : deps) {
+ addDependencyToClassPath(StringBuilder, dep);
}
return StringBuilder.toString();
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=1517364&r1=1517363&r2=1517364&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 Sun Aug 25 18:51:54 2013
@@ -83,16 +83,13 @@ public class EclipseAjdtWriter
IdeDependency[] deps = config.getDeps();
int ajdtDepCount = 0;
int ajdtWeaveDepCount = 0;
- for ( int i = 0; i < deps.length; i++ )
- {
- if ( deps[i].isAjdtDependency() )
- {
- addDependency( ajdtSettings, deps[i], ASPECT_DEP_PROP, ++ajdtDepCount );
+ for (IdeDependency dep : deps) {
+ if (dep.isAjdtDependency()) {
+ addDependency(ajdtSettings, dep, ASPECT_DEP_PROP, ++ajdtDepCount);
}
- if ( deps[i].isAjdtWeaveDependency() )
- {
- addDependency( ajdtSettings, deps[i], WEAVE_DEP_PROP, ++ajdtWeaveDepCount );
+ if (dep.isAjdtWeaveDependency()) {
+ addDependency(ajdtSettings, dep, WEAVE_DEP_PROP, ++ajdtWeaveDepCount);
}
}
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=1517364&r1=1517363&r2=1517364&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 Sun Aug 25 18:51:54 2013
@@ -286,24 +286,21 @@ public class EclipseClasspathWriter
buildXmlPrinter.addAttribute( NAME, "copy-resources" );
buildXmlPrinter.addAttribute( "depends", "init" );
- for ( Iterator it = specialSources.iterator(); it.hasNext(); )
- {
+ for (Object specialSource : specialSources) {
// TODO: merge source dirs on output path+filtering to reduce
// <copy> tags for speed.
- EclipseSourceDir dir = (EclipseSourceDir) it.next();
- 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() );
+ 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());
}
- if ( dir.getExcludeAsString() != null )
- {
- buildXmlPrinter.addAttribute( "excludes", dir.getExcludeAsString() );
+ if (dir.getExcludeAsString() != null) {
+ buildXmlPrinter.addAttribute("excludes", dir.getExcludeAsString());
}
buildXmlPrinter.endElement();
@@ -354,16 +351,12 @@ public class EclipseClasspathWriter
// be declared BEFORE all other dependencies so that container access rules don't fail
// ----------------------------------------------------------------------
IdeDependency[] depsToWrite = config.getDeps();
- for ( int j = 0; j < depsToWrite.length; j++ )
- {
- IdeDependency dep = depsToWrite[j];
- 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);
}
}
}
@@ -377,18 +370,13 @@ public class EclipseClasspathWriter
// ----------------------------------------------------------------------
// The project's dependencies
// ----------------------------------------------------------------------
- for ( int j = 0; j < depsToWrite.length; j++ )
- {
- IdeDependency dep = depsToWrite[j];
-
- 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);
}
}
}
@@ -413,11 +401,10 @@ public class EclipseClasspathWriter
// Container classpath entries
// ----------------------------------------------------------------------
- for ( Iterator it = config.getClasspathContainers().iterator(); it.hasNext(); )
- {
- writer.startElement( ELT_CLASSPATHENTRY );
- writer.addAttribute( ATTR_KIND, "con" ); //$NON-NLS-1$
- writer.addAttribute( ATTR_PATH, (String) it.next() );
+ 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
}
}
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=1517364&r1=1517363&r2=1517364&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 Sun Aug 25 18:51:54 2013
@@ -124,9 +124,8 @@ public abstract class EclipseLaunchConfi
+ " factoryID='org.eclipse.ui.internal.WorkingSetFactory'" + " label='workingSet'"
+ " name='workingSet'>";
- for ( Iterator it = getMonitoredResources().iterator(); it.hasNext(); )
- {
- MonitoredResource monitoredResource = (MonitoredResource) it.next();
+ for (Object o : getMonitoredResources()) {
+ MonitoredResource monitoredResource = (MonitoredResource) o;
workingSet += monitoredResource.print();
}
@@ -208,11 +207,9 @@ public abstract class EclipseLaunchConfi
writer.startElement( "listAttribute" );
writer.addAttribute( "key", key );
- for ( int i = 0; i < values.length; i++ )
- {
- String value = values[i];
- writer.startElement( "listEntry" );
- writer.addAttribute( "value", value );
+ for (String value : values) {
+ writer.startElement("listEntry");
+ writer.addAttribute("value", value);
writer.endElement();
}
Modified: maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseOSGiManifestWriter.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseOSGiManifestWriter.java?rev=1517364&r1=1517363&r2=1517364&view=diff
==============================================================================
--- maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseOSGiManifestWriter.java (original)
+++ maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseOSGiManifestWriter.java Sun Aug 25 18:51:54 2013
@@ -128,7 +128,7 @@ public class EclipseOSGiManifestWriter
String line;
while ( ( line = in.readLine() ) != null )
{
- if ( inBundleClasspathEntry && line.indexOf( ":" ) > -1 )
+ if ( inBundleClasspathEntry && line.contains(":"))
{
inBundleClasspathEntry = false;
}
@@ -243,16 +243,13 @@ public class EclipseOSGiManifestWriter
IdeDependency[] deps = config.getDeps();
- for ( int j = 0; j < deps.length; j++ )
- {
- IdeDependency dep = deps[j];
- if ( !dep.isProvided() && !dep.isReferencedProject() && !dep.isTestDependency() && !dep.isOsgiBundle() )
- {
- bundleClasspathSb.append( "," + NEWLINE );
+ for (IdeDependency dep : deps) {
+ if (!dep.isProvided() && !dep.isReferencedProject() && !dep.isTestDependency() && !dep.isOsgiBundle()) {
+ bundleClasspathSb.append("," + NEWLINE);
- log.debug( "Adding artifact to manifest: " + dep.getArtifactId() );
+ log.debug("Adding artifact to manifest: " + dep.getArtifactId());
- bundleClasspathSb.append( " " + dep.getFile().getName() );
+ bundleClasspathSb.append(" " + dep.getFile().getName());
}
}
// only insert the name of the property if there are local libraries
Modified: maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseProjectWriter.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseProjectWriter.java?rev=1517364&r1=1517363&r2=1517364&view=diff
==============================================================================
--- maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseProjectWriter.java (original)
+++ maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseProjectWriter.java Sun Aug 25 18:51:54 2013
@@ -119,10 +119,9 @@ public class EclipseProjectWriter
if ( naturesElement != null )
{
Xpp3Dom[] existingNatures = naturesElement.getChildren( ELT_NATURE );
- for ( int j = 0; j < existingNatures.length; j++ )
- {
+ for (Xpp3Dom existingNature : existingNatures) {
// adds all the existing natures
- projectnatures.add( existingNatures[j].getValue() );
+ projectnatures.add(existingNature.getValue());
}
}
@@ -130,12 +129,10 @@ public class EclipseProjectWriter
if ( buildSpec != null )
{
Xpp3Dom[] existingBuildCommands = buildSpec.getChildren( ELT_BUILD_COMMAND );
- for ( int j = 0; j < existingBuildCommands.length; j++ )
- {
- Xpp3Dom buildCommandName = existingBuildCommands[j].getChild( ELT_NAME );
- if ( buildCommandName != null )
- {
- buildCommands.add( new BuildCommand( existingBuildCommands[j] ) );
+ for (Xpp3Dom existingBuildCommand : existingBuildCommands) {
+ Xpp3Dom buildCommandName = existingBuildCommand.getChild(ELT_NAME);
+ if (buildCommandName != null) {
+ buildCommands.add(new BuildCommand(existingBuildCommand));
}
}
}
@@ -144,14 +141,12 @@ public class EclipseProjectWriter
if ( linkedResourcesElement != null )
{
Xpp3Dom[] existingLinks = linkedResourcesElement.getChildren( ELT_LINK );
- for ( int j = 0; j < existingLinks.length; j++ )
- {
- Xpp3Dom linkName = existingLinks[j].getChild( ELT_NAME );
- if ( linkName != null )
- {
+ for (Xpp3Dom existingLink : existingLinks) {
+ Xpp3Dom linkName = existingLink.getChild(ELT_NAME);
+ if (linkName != null) {
// add all the existing symbolic links
- linkNames.add( existingLinks[j].getChild( ELT_NAME ).getValue() );
- linkedResources.add( new LinkedResource( existingLinks[j] ) );
+ linkNames.add(existingLink.getChild(ELT_NAME).getValue());
+ linkedResources.add(new LinkedResource(existingLink));
}
}
}
@@ -172,19 +167,16 @@ public class EclipseProjectWriter
}
// adds new entries after the existing ones
- for ( Iterator iter = config.getProjectnatures().iterator(); iter.hasNext(); )
- {
- projectnatures.add( iter.next() );
+ for (Object o2 : config.getProjectnatures()) {
+ projectnatures.add(o2);
}
- for ( Iterator iter = config.getBuildCommands().iterator(); iter.hasNext(); )
- {
- buildCommands.add( (BuildCommand) iter.next() );
+ for (Object o1 : config.getBuildCommands()) {
+ buildCommands.add((BuildCommand) o1);
}
- for ( Iterator iter = config.getLinkedResources().iterator(); iter.hasNext(); )
- {
- linkedResources.add( (LinkedResource) iter.next() );
+ for (Object o : config.getLinkedResources()) {
+ linkedResources.add((LinkedResource) o);
}
Writer w;
@@ -216,17 +208,14 @@ public class EclipseProjectWriter
if ( !config.isPde() )
{
List duplicates = new ArrayList();
- for ( int j = 0; j < dependencies.length; j++ )
- {
- IdeDependency dep = dependencies[j];
+ for (IdeDependency dep : dependencies) {
// Avoid duplicates entries when same project is refered using multiple types
// (ejb, test-jar ...)
- if ( dep.isReferencedProject() && !duplicates.contains( dep.getEclipseProjectName() ) )
- {
- writer.startElement( "project" ); //$NON-NLS-1$
- writer.writeText( dep.getEclipseProjectName() );
+ if (dep.isReferencedProject() && !duplicates.contains(dep.getEclipseProjectName())) {
+ writer.startElement("project"); //$NON-NLS-1$
+ writer.writeText(dep.getEclipseProjectName());
writer.endElement();
- duplicates.add( dep.getEclipseProjectName() );
+ duplicates.add(dep.getEclipseProjectName());
}
}
}
@@ -235,19 +224,17 @@ public class EclipseProjectWriter
writer.startElement( ELT_BUILD_SPEC );
- for ( Iterator it = buildCommands.iterator(); it.hasNext(); )
- {
- ( (BuildCommand) it.next() ).print( writer );
+ for (Object buildCommand : buildCommands) {
+ ((BuildCommand) buildCommand).print(writer);
}
writer.endElement(); // buildSpec
writer.startElement( ELT_NATURES );
- for ( Iterator it = projectnatures.iterator(); it.hasNext(); )
- {
- writer.startElement( ELT_NATURE );
- writer.writeText( (String) it.next() );
+ for (Object projectnature : projectnatures) {
+ writer.startElement(ELT_NATURE);
+ writer.writeText((String) projectnature);
writer.endElement(); // name
}
@@ -261,9 +248,8 @@ public class EclipseProjectWriter
// preserve the symbolic links
if ( linkedResources.size() > 0 )
{
- for ( Iterator it = linkedResources.iterator(); it.hasNext(); )
- {
- ( (LinkedResource) it.next() ).print( writer );
+ for (Object linkedResource : linkedResources) {
+ ((LinkedResource) linkedResource).print(writer);
}
}
@@ -287,16 +273,12 @@ public class EclipseProjectWriter
if ( config.isPde() )
{
- for ( int j = 0; j < dependencies.length; j++ )
- {
- IdeDependency dep = dependencies[j];
-
- if ( dep.isAddedToClasspath() && !dep.isProvided() && !dep.isReferencedProject()
- && !dep.isTestDependency() && !dep.isOsgiBundle() )
- {
+ for (IdeDependency dep : dependencies) {
+ if (dep.isAddedToClasspath() && !dep.isProvided() && !dep.isReferencedProject()
+ && !dep.isTestDependency() && !dep.isOsgiBundle()) {
String name = dep.getFile().getName();
- addLink( writer, name, IdeUtils.fixSeparator( IdeUtils.getCanonicalPath( dep.getFile() ) ),
- LINK_TYPE_FILE );
+ addLink(writer, name, IdeUtils.fixSeparator(IdeUtils.getCanonicalPath(dep.getFile())),
+ LINK_TYPE_FILE);
}
}
}
@@ -328,17 +310,15 @@ public class EclipseProjectWriter
private void addSourceLinks( XMLWriter writer, File projectBaseDir, File basedir, List sourceRoots )
throws MojoExecutionException
{
- for ( Iterator it = sourceRoots.iterator(); it.hasNext(); )
- {
- String sourceRootString = (String) it.next();
- File sourceRoot = new File( sourceRootString );
-
- if ( sourceRoot.isDirectory() )
- {
- String name = IdeUtils.toRelativeAndFixSeparator( projectBaseDir, sourceRoot, true );
- String location = IdeUtils.fixSeparator( IdeUtils.getCanonicalPath( sourceRoot ) );
+ for (Object sourceRoot1 : sourceRoots) {
+ String sourceRootString = (String) sourceRoot1;
+ File sourceRoot = new File(sourceRootString);
+
+ if (sourceRoot.isDirectory()) {
+ String name = IdeUtils.toRelativeAndFixSeparator(projectBaseDir, sourceRoot, true);
+ String location = IdeUtils.fixSeparator(IdeUtils.getCanonicalPath(sourceRoot));
- addLink( writer, name, location, LINK_TYPE_DIRECTORY );
+ addLink(writer, name, location, LINK_TYPE_DIRECTORY);
}
}
}
@@ -346,17 +326,15 @@ public class EclipseProjectWriter
private void addResourceLinks( XMLWriter writer, File projectBaseDir, File basedir, List sourceRoots )
throws MojoExecutionException
{
- for ( Iterator it = sourceRoots.iterator(); it.hasNext(); )
- {
- String resourceDirString = ( (Resource) it.next() ).getDirectory();
- File resourceDir = new File( resourceDirString );
-
- if ( resourceDir.isDirectory() )
- {
- String name = IdeUtils.toRelativeAndFixSeparator( projectBaseDir, resourceDir, true );
- String location = IdeUtils.fixSeparator( IdeUtils.getCanonicalPath( resourceDir ) );
+ for (Object sourceRoot : sourceRoots) {
+ String resourceDirString = ((Resource) sourceRoot).getDirectory();
+ File resourceDir = new File(resourceDirString);
+
+ if (resourceDir.isDirectory()) {
+ String name = IdeUtils.toRelativeAndFixSeparator(projectBaseDir, resourceDir, true);
+ String location = IdeUtils.fixSeparator(IdeUtils.getCanonicalPath(resourceDir));
- addLink( writer, name, location, LINK_TYPE_DIRECTORY );
+ addLink(writer, name, location, LINK_TYPE_DIRECTORY);
}
}
}