You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ag...@apache.org on 2015/05/02 22:02:31 UTC
svn commit: r1677345 - in /maven/plugins/trunk/maven-eclipse-plugin/src:
main/java/org/apache/maven/plugin/eclipse/
main/java/org/apache/maven/plugin/eclipse/reader/
test/java/org/apache/maven/plugin/eclipse/reader/
Author: agudian
Date: Sat May 2 20:02:31 2015
New Revision: 1677345
URL: http://svn.apache.org/r1677345
Log:
[MECLIPSE-757] Support JavaSE-1.7 / JavaSE-1.8 execution environment names and add an option to favour those standard JVM names instead of explicit JRE ids.
Modified:
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/reader/ReadWorkspaceLocations.java
maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/reader/ReadWorkspaceLocationsTest.java
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=1677345&r1=1677344&r2=1677345&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 Sat May 2 20:02:31 2015
@@ -179,8 +179,8 @@ public class EclipsePlugin
private List projectnatures;
/**
- * List of artifacts, represented as <code>groupId:artifactId</code>, to exclude from the eclipse classpath,
- * being provided by some eclipse classPathContainer.
+ * List of artifacts, represented as <code>groupId:artifactId</code>, to exclude from the eclipse classpath, being
+ * provided by some eclipse classPathContainer.
*
* @see http://jira.codehaus.org/browse/MECLIPSE-79
* @since 2.5
@@ -310,8 +310,8 @@ public class EclipsePlugin
private String wtpversion;
/**
- * JEE context name of the WTP module. ( ex. WEB context name ). You can use "ROOT" if you want to map the webapp
- * to the root context.
+ * JEE context name of the WTP module. ( ex. WEB context name ). You can use "ROOT" if you want to map the webapp to
+ * the root context.
*/
@Parameter( property = "wtpContextName" )
private String wtpContextName;
@@ -447,6 +447,14 @@ public class EclipsePlugin
@Parameter( property = "eclipse.wtpdefaultserver" )
private String wtpdefaultserver;
+ /**
+ * If set to <code>true</code>, the standard execution environment matching the compiler settings is set as JRE. If
+ * set to <code>false</code>, the JRE matching the configured compiler-plugin executable or JAVA_HOME is selected by
+ * name, if it is configured in the workspace.
+ */
+ @Parameter( property = "eclipse.preferStandardClasspathContainer", defaultValue = "false" )
+ private boolean preferStandardClasspathContainer;
+
private WorkspaceConfiguration workspaceConfiguration;
/**
@@ -518,7 +526,8 @@ public class EclipsePlugin
private List sourceIncludes;
/**
- * A list of links to local files in the system. A configuration like this one in the pom :
+ * A list of links to local files in the system. A configuration like this one in the pom :
+ *
* <pre>
* <plugin>
* <groupId>org.apache.maven.plugins</groupId>
@@ -534,7 +543,9 @@ public class EclipsePlugin
* </configuration>
* </plugin>
* </pre>
+ *
* will produce in the .project :
+ *
* <pre>
* <linkedResources>
* <link>
@@ -549,7 +560,7 @@ public class EclipsePlugin
*/
@Parameter
private List linkedResources;
-
+
/**
* Put classpath container entries last in eclipse classpath configuration. Note that this behaviour, although
* useful in situations were you want to override resources found in classpath containers, will made JRE classes
@@ -559,35 +570,63 @@ public class EclipsePlugin
*/
@Parameter( property = "eclipse.classpathContainersLast", defaultValue = "false" )
protected boolean classpathContainersLast;
-
+
/**
- * Whether to place test resources after main resources. Note that the default behavior of Maven version 2.0.8 or
+ * Whether to place test resources after main resources. Note that the default behavior of Maven version 2.0.8 or
* later is to have test dirs before main dirs in classpath so this is discouraged if you need to reproduce the
* maven behavior during tests. The default behavior is also changed in eclipse plugin version 2.6 in order to
- * better match the maven one.
- * Switching to "test source last" can anyway be useful if you need to run your application in eclipse, since there
- * is no concept in eclipse of "phases" with different set of source dirs and dependencies like we have in maven.
+ * better match the maven one. Switching to "test source last" can anyway be useful if you need to run your
+ * application in eclipse, since there is no concept in eclipse of "phases" with different set of source dirs and
+ * dependencies like we have in maven.
*
* @since 2.9
*/
@Parameter( property = "eclipse.testSourcesLast", defaultValue = "false" )
protected boolean testSourcesLast;
-
+
/**
- * The plugin is often capable in predicting the required jee version based on the dependencies of the project.
- * By setting this parameter to one of the {@code jeeversion} options the version will be locked.
- *
+ * The plugin is often capable in predicting the required jee version based on the dependencies of the project. By
+ * setting this parameter to one of the {@code jeeversion} options the version will be locked.
* <table>
- * <thead>
- * <tr><th>jeeversion</th><th>EJB version</th><th>Servlet version</th><th>JSP version</th></tr>
- * </thead>
- * <tbody>
- * <tr><td>6.0</td><td>3.1</td><td>3.0</td><td>2.2</td></tr>
- * <tr><td>5.0</td><td>3.0</td><td>2.5</td><td>2.1</td></tr>
- * <tr><td>1.4</td><td>2.1</td><td>2.4</td><td>2.0</td></tr>
- * <tr><td>1.3</td><td>2.0</td><td>2.3</td><td>1.2</td></tr>
- * <tr><td>1.2</td><td>1.1</td><td>2.2</td><td>1.1</td></tr>
- * </tbody>
+ * <thead>
+ * <tr>
+ * <th>jeeversion</th>
+ * <th>EJB version</th>
+ * <th>Servlet version</th>
+ * <th>JSP version</th>
+ * </tr>
+ * </thead> <tbody>
+ * <tr>
+ * <td>6.0</td>
+ * <td>3.1</td>
+ * <td>3.0</td>
+ * <td>2.2</td>
+ * </tr>
+ * <tr>
+ * <td>5.0</td>
+ * <td>3.0</td>
+ * <td>2.5</td>
+ * <td>2.1</td>
+ * </tr>
+ * <tr>
+ * <td>1.4</td>
+ * <td>2.1</td>
+ * <td>2.4</td>
+ * <td>2.0</td>
+ * </tr>
+ * <tr>
+ * <td>1.3</td>
+ * <td>2.0</td>
+ * <td>2.3</td>
+ * <td>1.2</td>
+ * </tr>
+ * <tr>
+ * <td>1.2</td>
+ * <td>1.1</td>
+ * <td>2.2</td>
+ * <td>1.1</td>
+ * </tr>
+ * </tbody>
* </table>
*
* @since 2.9
@@ -1005,9 +1044,11 @@ public class EclipsePlugin
boolean containsJREContainer = false;
// Check if classpathContainer contains a JRE (default, alternate or
// Execution Environment)
- for (Object classPathContainer : classpathContainers) {
- 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;
}
@@ -1180,76 +1221,102 @@ public class EclipsePlugin
{
if ( additionalConfig != null )
{
- for (EclipseConfigFile file : additionalConfig) {
- 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 {
- IOUtil.close(inStream);
- IOUtil.close(outStream);
+ 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) {
+ 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());
}
- } 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()));
+ else
+ {
+ FileUtils.fileWrite( projectRelativeFile.getAbsolutePath(), file.getContent() );
+ }
+ }
+ 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() ) );
}
}
}
@@ -1301,11 +1368,15 @@ public class EclipsePlugin
if ( buildcommands != null )
{
- for (Object cmd : buildcommands) {
- 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 ) );
}
}
}
@@ -1350,31 +1421,35 @@ public class EclipsePlugin
if ( reactorProjects != null && wtpContextName == null
&& Constants.PROJECT_PACKAGING_WAR.equals( project.getPackaging() ) )
{
- for (Object reactorProject1 : reactorProjects) {
+ 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 (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());
+ 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() );
}
- } else {
- getLog().info(
- "Found incomplete ear configuration in " + reactorProject.getGroupId() + ":"
- + reactorProject.getGroupId() + " found "
- + warDefinition.toString());
+ }
+ else
+ {
+ getLog().info( "Found incomplete ear configuration in " + reactorProject.getGroupId() + ":"
+ + reactorProject.getGroupId() + " found " + warDefinition.toString() );
}
}
}
@@ -1386,7 +1461,7 @@ public class EclipsePlugin
{
config.setContextName( project.getArtifactId() );
}
- else if ( "ROOT".equals(wtpContextName) )
+ else if ( "ROOT".equals( wtpContextName ) )
{
config.setContextName( "" );
}
@@ -1473,8 +1548,7 @@ public class EclipsePlugin
if ( getWorkspaceConfiguration().getDefaultClasspathContainer() != null )
{
- getLog().info(
- "Adding default classpath container: "
+ getLog().info( "Adding default classpath container: "
+ getWorkspaceConfiguration().getDefaultClasspathContainer() );
classpathContainers.add( getWorkspaceConfiguration().getDefaultClasspathContainer() );
}
@@ -1544,8 +1618,7 @@ public class EclipsePlugin
buildOutputDirectory.equals( new File( project.getBuild().getOutputDirectory() ) );
if ( useStandardOutputDir )
{
- getLog().debug(
- "testOutput toRelativeAndFixSeparator " + projectBaseDir + " , "
+ getLog().debug( "testOutput toRelativeAndFixSeparator " + projectBaseDir + " , "
+ project.getBuild().getTestOutputDirectory() );
testOutput =
IdeUtils.toRelativeAndFixSeparator( projectBaseDir,
@@ -1573,9 +1646,9 @@ public class EclipsePlugin
// NOTE: Since MNG-3118, test classes come before main classes
boolean testBeforeMain = isMavenVersion( "[2.0.8,)" );
-
+
// let users override this if needed, they need to simulate more than the test phase in eclipse
- if (testSourcesLast)
+ if ( testSourcesLast )
{
testBeforeMain = false;
}
@@ -1600,17 +1673,19 @@ public class EclipsePlugin
String output )
throws MojoExecutionException
{
- for (Object sourceRoot1 : sourceRoots) {
+ for ( Object sourceRoot1 : sourceRoots )
+ {
- File sourceRootFile = new File((String) sourceRoot1);
+ 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 ) );
}
}
}
@@ -1619,69 +1694,74 @@ public class EclipsePlugin
boolean test, final String output )
throws MojoExecutionException
{
- for (Object resource1 : resources) {
+ 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);
+ getLog().debug( "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) {
- getLog().info(
- "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());
+ boolean merged = originalDir.merge( resourceDir );
+ if ( merged )
+ {
+ getLog().info( "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() );
}
}
@@ -1698,8 +1778,10 @@ public class EclipsePlugin
*/
private Object get( Set set, Object o )
{
- for (Object item : set) {
- if (o.equals(item)) {
+ for ( Object item : set )
+ {
+ if ( o.equals( item ) )
+ {
return item;
}
}
@@ -1755,10 +1837,12 @@ public class EclipsePlugin
{
boolean enable = false;
List buildPlugins = project.getBuildPlugins();
- for (Object buildPlugin : buildPlugins) {
+ for ( Object buildPlugin : buildPlugins )
+ {
Plugin plugin = (Plugin) buildPlugin;
- if (plugin.getGroupId().equals(ORG_CODEHAUS_MOJO)
- && plugin.getArtifactId().equals(ASPECTJ_MAVEN_PLUGIN)) {
+ if ( plugin.getGroupId().equals( ORG_CODEHAUS_MOJO )
+ && plugin.getArtifactId().equals( ASPECTJ_MAVEN_PLUGIN ) )
+ {
enable = true;
break;
}
@@ -1771,10 +1855,12 @@ public class EclipsePlugin
{
Xpp3Dom configuration = null;
List buildPlugins = project.getBuildPlugins();
- for (Object buildPlugin : buildPlugins) {
+ for ( Object buildPlugin : buildPlugins )
+ {
Plugin plugin = (Plugin) buildPlugin;
- if (plugin.getGroupId().equals(ORG_CODEHAUS_MOJO)
- && plugin.getArtifactId().equals(ASPECTJ_MAVEN_PLUGIN)) {
+ if ( plugin.getGroupId().equals( ORG_CODEHAUS_MOJO )
+ && plugin.getArtifactId().equals( ASPECTJ_MAVEN_PLUGIN ) )
+ {
configuration = (Xpp3Dom) plugin.getConfiguration();
break;
}
@@ -1793,18 +1879,20 @@ public class EclipsePlugin
if ( aspectLibrariesParent != null )
{
Xpp3Dom[] aspectLibraries = aspectLibrariesParent.getChildren( ASPECT_LIBRARY );
- 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);
+ 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" );
}
}
}
@@ -1820,18 +1908,20 @@ public class EclipsePlugin
if ( weaveDependenciesParent != null )
{
Xpp3Dom[] weaveDependencies = weaveDependenciesParent.getChildren( WEAVE_DEPENDENCY );
- 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);
+ 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" );
}
}
}
@@ -1921,7 +2011,8 @@ public class EclipsePlugin
getLog().info( Messages.getString( "EclipsePlugin.workspace", workspace ) );
workspaceConfiguration.setWorkspaceDirectory( workspace );
- new ReadWorkspaceLocations().init( getLog(), workspaceConfiguration, project, wtpdefaultserver );
+ new ReadWorkspaceLocations().init( getLog(), workspaceConfiguration, project, wtpdefaultserver,
+ preferStandardClasspathContainer );
}
return workspaceConfiguration;
}
@@ -1955,8 +2046,7 @@ public class EclipsePlugin
}
/**
- * Utility method that locates a project producing the given artifact
- * and verifies if it's a valid Eclipse project.
+ * Utility method that locates a project producing the given artifact and verifies if it's a valid Eclipse project.
*
* @param artifact the artifact a project should produce.
* @return <code>true</code> if the artifact is produced by a reactor projectart.
@@ -1964,9 +2054,9 @@ public class EclipsePlugin
protected boolean isAvailableAsAReactorProject( Artifact artifact )
{
MavenProject project = getReactorProject( artifact );
- return ( project != null && new File( project.getBasedir(), ".project" ).exists() ) ;
+ return ( project != null && new File( project.getBasedir(), ".project" ).exists() );
}
-
+
/**
* Utility method that locates a project in the workspace for the given artifact.
*
@@ -1990,8 +2080,7 @@ public class EclipsePlugin
}
else
{
- getLog().info(
- "Artifact "
+ getLog().info( "Artifact "
+ artifact.getId()
+ " already available as a workspace project, but with different version. Expected: "
+ artifact.getBaseVersion() + ", found: " + workspaceArtefact.getVersion() );
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=1677345&r1=1677344&r2=1677345&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 Sat May 2 20:02:31 2015
@@ -82,15 +82,18 @@ public class ReadWorkspaceLocations
private static final String CLASSPATHENTRY_DEFAULT = "org.eclipse.jdt.launching.JRE_CONTAINER";
- private static final String CLASSPATHENTRY_STANDARD =
- CLASSPATHENTRY_DEFAULT + "/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/";
+ private static final String CLASSPATHENTRY_STANDARD = CLASSPATHENTRY_DEFAULT
+ + "/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/";
private static final String CLASSPATHENTRY_FORMAT = ReadWorkspaceLocations.CLASSPATHENTRY_DEFAULT + "/{0}/{1}";
public void init( Log log, WorkspaceConfiguration workspaceConfiguration, MavenProject project,
- String wtpDefaultServer )
+ String wtpDefaultServer, boolean preferStandardClasspathContainer )
{
- detectDefaultJREContainer( workspaceConfiguration, project, log );
+ workspaceConfiguration.setDefaultClasspathContainer( detectDefaultJREContainer( workspaceConfiguration,
+ project,
+ preferStandardClasspathContainer,
+ log ) );
readWorkspace( workspaceConfiguration, log );
detectWTPDefaultServer( workspaceConfiguration, wtpDefaultServer, log );
}
@@ -104,20 +107,20 @@ public class ReadWorkspaceLocations
*/
private void detectWTPDefaultServer( WorkspaceConfiguration workspaceConfiguration, String wtpDefaultServer, Log log )
{
- HashMap servers = readDefinedServers( workspaceConfiguration, log );
+ Map<String, String> servers = readDefinedServers( workspaceConfiguration, log );
if ( servers == null || servers.isEmpty() )
{
return;
}
if ( wtpDefaultServer != null )
{
- Set ids = servers.keySet();
+ Set<String> ids = servers.keySet();
// first we try the exact match
- Iterator idIterator = ids.iterator();
+ Iterator<String> idIterator = ids.iterator();
while ( workspaceConfiguration.getDefaultDeployServerId() == null && idIterator.hasNext() )
{
- String id = (String) idIterator.next();
- String name = (String) servers.get( id );
+ String id = idIterator.next();
+ String name = servers.get( id );
if ( wtpDefaultServer.equals( id ) || wtpDefaultServer.equals( name ) )
{
workspaceConfiguration.setDefaultDeployServerId( id );
@@ -131,9 +134,9 @@ public class ReadWorkspaceLocations
idIterator = ids.iterator();
while ( workspaceConfiguration.getDefaultDeployServerId() == null && idIterator.hasNext() )
{
- String id = (String) idIterator.next();
- String name = (String) servers.get( id );
- if (id.contains(wtpDefaultServer) || name.contains(wtpDefaultServer))
+ String id = idIterator.next();
+ String name = servers.get( id );
+ if ( id.contains( wtpDefaultServer ) || name.contains( wtpDefaultServer ) )
{
workspaceConfiguration.setDefaultDeployServerId( id );
workspaceConfiguration.setDefaultDeployServerName( name );
@@ -145,8 +148,8 @@ public class ReadWorkspaceLocations
{
// now take the default server
log.info( "no substring wtp server match." );
- workspaceConfiguration.setDefaultDeployServerId( (String) servers.get( "" ) );
- workspaceConfiguration.setDefaultDeployServerName( (String) servers.get( workspaceConfiguration.getDefaultDeployServerId() ) );
+ workspaceConfiguration.setDefaultDeployServerId( servers.get( "" ) );
+ workspaceConfiguration.setDefaultDeployServerName( servers.get( workspaceConfiguration.getDefaultDeployServerId() ) );
}
log.info( "Using as WTP server : " + workspaceConfiguration.getDefaultDeployServerName() );
}
@@ -159,7 +162,7 @@ public class ReadWorkspaceLocations
* @param logger the logger to log the error's
* @return the found container or null if non found.
*/
- private String getContainerFromExecutable( String rawExecutable, Map jreMap, Log logger )
+ private String getContainerFromExecutable( String rawExecutable, Map<String, String> jreMap, Log logger )
{
String foundContainer;
if ( rawExecutable != null )
@@ -177,7 +180,7 @@ public class ReadWorkspaceLocations
File executableFile = new File( executable );
while ( executableFile != null )
{
- foundContainer = (String) jreMap.get( executableFile.getPath() );
+ foundContainer = jreMap.get( executableFile.getPath() );
if ( foundContainer != null )
{
logger.debug( "detected classpathContainer from executable: " + foundContainer );
@@ -195,47 +198,70 @@ public class ReadWorkspaceLocations
*
* @param workspaceConfiguration the location of the workspace.
* @param project the maven project the get the configuration
+ * @param preferStandardClasspathContainer prefer using the standard classpath container name
* @param logger the logger for errors
*/
- private void detectDefaultJREContainer( WorkspaceConfiguration workspaceConfiguration, MavenProject project,
- Log logger )
+ private String detectDefaultJREContainer( WorkspaceConfiguration workspaceConfiguration, MavenProject project,
+ boolean preferStandardClasspathContainer, Log logger )
{
- String defaultJREContainer = ReadWorkspaceLocations.CLASSPATHENTRY_DEFAULT;
- if ( workspaceConfiguration.getWorkspaceDirectory() != null )
+ File workspaceDirectory = workspaceConfiguration.getWorkspaceDirectory();
+
+ Map<String, String> jreMap =
+ readAvailableJREs( preferStandardClasspathContainer ? null : workspaceDirectory, logger );
+ if ( jreMap != null )
{
- Map jreMap = readAvailableJREs( workspaceConfiguration.getWorkspaceDirectory(), logger );
- if ( jreMap != null )
+ String foundContainer = null;
+ if ( preferStandardClasspathContainer )
{
- String foundContainer =
- getContainerFromExecutable( System.getProperty( "maven.compiler.executable" ), jreMap, logger );
- if ( foundContainer == null )
- {
- foundContainer =
- getContainerFromExecutable( IdeUtils.getCompilerPluginSetting( project, "executable" ), jreMap,
- logger );
- }
- if ( foundContainer == null )
- {
- String sourceVersion = IdeUtils.getCompilerSourceVersion( project );
- foundContainer = (String) jreMap.get( sourceVersion );
- if ( foundContainer != null )
- {
- logger.debug( "detected classpathContainer from sourceVersion(" + sourceVersion + "): "
- + foundContainer );
- }
- }
- if ( foundContainer == null )
+ foundContainer = getContainerFromSourceVersion( project, jreMap, logger );
+ if ( foundContainer != null )
{
- foundContainer = getContainerFromExecutable( System.getProperty( "java.home" ), jreMap, logger );
+ return foundContainer;
}
+ }
+
+ foundContainer =
+ getContainerFromExecutable( System.getProperty( "maven.compiler.executable" ), jreMap, logger );
+ if ( foundContainer != null )
+ {
+ return foundContainer;
+ }
+
+ foundContainer =
+ getContainerFromExecutable( IdeUtils.getCompilerPluginSetting( project, "executable" ), jreMap, logger );
+ if ( foundContainer != null )
+ {
+ return foundContainer;
+ }
+
+ if ( !preferStandardClasspathContainer )
+ {
+ foundContainer = getContainerFromSourceVersion( project, jreMap, logger );
if ( foundContainer != null )
{
- defaultJREContainer = foundContainer;
+ return foundContainer;
}
+ }
+ foundContainer = getContainerFromExecutable( System.getProperty( "java.home" ), jreMap, logger );
+ if ( foundContainer != null )
+ {
+ return foundContainer;
}
}
- workspaceConfiguration.setDefaultClasspathContainer( defaultJREContainer );
+ return ReadWorkspaceLocations.CLASSPATHENTRY_DEFAULT;
+ }
+
+ private String getContainerFromSourceVersion( MavenProject project, Map<String, String> jreMap, Log logger )
+ {
+ String foundContainer;
+ String sourceVersion = IdeUtils.getCompilerSourceVersion( project );
+ foundContainer = (String) jreMap.get( sourceVersion );
+ if ( foundContainer != null )
+ {
+ logger.debug( "detected classpathContainer from sourceVersion(" + sourceVersion + "): " + foundContainer );
+ }
+ return foundContainer;
}
/**
@@ -254,10 +280,11 @@ public class ReadWorkspaceLocations
if ( location.exists() )
{
SafeChunkyInputStream fileInputStream = null;
+ DataInputStream dataInputStream = null;
try
{
fileInputStream = new SafeChunkyInputStream( location );
- DataInputStream dataInputStream = new DataInputStream( fileInputStream );
+ dataInputStream = new DataInputStream( fileInputStream );
String file = dataInputStream.readUTF().trim();
if ( file.length() > 0 )
@@ -273,6 +300,7 @@ public class ReadWorkspaceLocations
finally
{
IOUtil.close( fileInputStream );
+ IOUtil.close( dataInputStream );
}
}
File projectBase = new File( workspaceLocation, project.getName() );
@@ -342,11 +370,11 @@ public class ReadWorkspaceLocations
String artifact = getValue( pom, ReadWorkspaceLocations.ARTEFACT_ID, null );
String group =
- getValue( pom, ReadWorkspaceLocations.GROUP_ID, getValue( pom, ReadWorkspaceLocations.PARENT_GROUP_ID,
- null ) );
+ getValue( pom, ReadWorkspaceLocations.GROUP_ID,
+ getValue( pom, ReadWorkspaceLocations.PARENT_GROUP_ID, null ) );
String version =
- getValue( pom, ReadWorkspaceLocations.VERSION, getValue( pom, ReadWorkspaceLocations.PARENT_VERSION,
- null ) );
+ getValue( pom, ReadWorkspaceLocations.VERSION,
+ getValue( pom, ReadWorkspaceLocations.PARENT_VERSION, null ) );
String packaging = getValue( pom, ReadWorkspaceLocations.PACKAGING, "jar" );
logger.debug( "found workspace artefact " + group + ":" + artifact + ":" + version + " " + packaging + " ("
@@ -361,9 +389,9 @@ public class ReadWorkspaceLocations
}
}
- /* package */HashMap<String,String> readDefinedServers( WorkspaceConfiguration workspaceConfiguration, Log logger )
+ /* package */Map<String, String> readDefinedServers( WorkspaceConfiguration workspaceConfiguration, Log logger )
{
- HashMap<String,String> detectedRuntimes = new HashMap<String,String>();
+ Map<String, String> detectedRuntimes = new HashMap<String, String>();
if ( workspaceConfiguration.getWorkspaceDirectory() != null )
{
Xpp3Dom runtimesElement = null;
@@ -417,8 +445,26 @@ public class ReadWorkspaceLocations
* @param logger the logger to error messages
* @return the map with found jre's
*/
- private HashMap<String,String> readAvailableJREs( File workspaceLocation, Log logger )
+ private Map<String, String> readAvailableJREs( File workspaceLocation, Log logger )
{
+ Map<String, String> jreMap = new HashMap<String, String>();
+ jreMap.put( "1.2", CLASSPATHENTRY_STANDARD + "J2SE-1.2" );
+ jreMap.put( "1.3", CLASSPATHENTRY_STANDARD + "J2SE-1.3" );
+ jreMap.put( "1.4", CLASSPATHENTRY_STANDARD + "J2SE-1.4" );
+ jreMap.put( "1.5", CLASSPATHENTRY_STANDARD + "J2SE-1.5" );
+ jreMap.put( "5", jreMap.get( "1.5" ) );
+ jreMap.put( "1.6", CLASSPATHENTRY_STANDARD + "JavaSE-1.6" );
+ jreMap.put( "6", jreMap.get( "1.6" ) );
+ jreMap.put( "1.7", CLASSPATHENTRY_STANDARD + "JavaSE-1.7" );
+ jreMap.put( "7", jreMap.get( "1.7" ) );
+ jreMap.put( "1.8", CLASSPATHENTRY_STANDARD + "JavaSE-1.8" );
+ jreMap.put( "8", jreMap.get( "1.8" ) );
+
+ if ( workspaceLocation == null )
+ {
+ return jreMap;
+ }
+
Xpp3Dom vms;
try
{
@@ -440,53 +486,55 @@ public class ReadWorkspaceLocations
logger.error( "Could not read workspace JRE preferences", e );
return null;
}
-
- HashMap<String,String> jreMap = new HashMap<String,String>();
- jreMap.put( "1.2", CLASSPATHENTRY_STANDARD + "J2SE-1.2" );
- jreMap.put( "1.3", CLASSPATHENTRY_STANDARD + "J2SE-1.3" );
- jreMap.put( "1.4", CLASSPATHENTRY_STANDARD + "J2SE-1.4" );
- jreMap.put( "1.5", CLASSPATHENTRY_STANDARD + "J2SE-1.5" );
- jreMap.put( "5", jreMap.get( "1.5" ) );
- jreMap.put( "1.6", CLASSPATHENTRY_STANDARD + "JavaSE-1.6" );
- jreMap.put( "6", jreMap.get( "1.6" ) );
String defaultJRE = vms.getAttribute( "defaultVM" ).trim();
Xpp3Dom[] vmTypes = vms.getChildren( "vmType" );
- for (Xpp3Dom vmType : vmTypes) {
- String typeId = vmType.getAttribute("id");
- Xpp3Dom[] vm = vmType.getChildren("vm");
- for (Xpp3Dom aVm : vm) {
- try {
- String path = aVm.getAttribute("path");
- String name = aVm.getAttribute("name");
- String vmId = aVm.getAttribute("id").trim();
+ for ( Xpp3Dom vmType : vmTypes )
+ {
+ String typeId = vmType.getAttribute( "id" );
+ Xpp3Dom[] vm = vmType.getChildren( "vm" );
+ for ( Xpp3Dom aVm : vm )
+ {
+ try
+ {
+ String path = aVm.getAttribute( "path" );
+ String name = aVm.getAttribute( "name" );
+ String vmId = aVm.getAttribute( "id" ).trim();
String classpathEntry =
- MessageFormat.format(ReadWorkspaceLocations.CLASSPATHENTRY_FORMAT,
- typeId, name);
- String jrePath = new File(path).getCanonicalPath();
- File rtJarFile = new File(new File(jrePath), "jre/lib/rt.jar");
- if (!rtJarFile.exists()) {
- logger.warn(Messages.getString("EclipsePlugin.invalidvminworkspace", jrePath));
+ MessageFormat.format( ReadWorkspaceLocations.CLASSPATHENTRY_FORMAT, typeId, name );
+ String jrePath = new File( path ).getCanonicalPath();
+ File rtJarFile = new File( new File( jrePath ), "jre/lib/rt.jar" );
+ if ( !rtJarFile.exists() )
+ {
+ logger.warn( Messages.getString( "EclipsePlugin.invalidvminworkspace", jrePath ) );
continue;
}
- JarFile rtJar = new JarFile(rtJarFile);
- String version = rtJar.getManifest().getMainAttributes().getValue("Specification-Version");
- if (defaultJRE.endsWith("," + vmId)) {
- jreMap.put(jrePath, ReadWorkspaceLocations.CLASSPATHENTRY_DEFAULT);
- jreMap.put(version, ReadWorkspaceLocations.CLASSPATHENTRY_DEFAULT);
- logger.debug("Default Classpath Container version: " + version + " location: " + jrePath);
- } else if (!jreMap.containsKey(jrePath)) {
- if (!jreMap.containsKey(version)) {
- jreMap.put(version, classpathEntry);
+ JarFile rtJar = new JarFile( rtJarFile );
+ String version = rtJar.getManifest().getMainAttributes().getValue( "Specification-Version" );
+ if ( defaultJRE.endsWith( "," + vmId ) )
+ {
+ jreMap.put( jrePath, ReadWorkspaceLocations.CLASSPATHENTRY_DEFAULT );
+ jreMap.put( version, ReadWorkspaceLocations.CLASSPATHENTRY_DEFAULT );
+ logger.debug( "Default Classpath Container version: " + version + " location: " + jrePath );
+ }
+ else if ( !jreMap.containsKey( jrePath ) )
+ {
+ if ( !jreMap.containsKey( version ) )
+ {
+ jreMap.put( version, classpathEntry );
}
- jreMap.put(jrePath, classpathEntry);
- logger.debug("Additional Classpath Container version: " + version + " " + classpathEntry
- + " location: " + jrePath);
- } else {
- logger.debug("Ignored (duplicated) additional Classpath Container version: " + version + " "
- + classpathEntry + " location: " + jrePath);
+ jreMap.put( jrePath, classpathEntry );
+ logger.debug( "Additional Classpath Container version: " + version + " " + classpathEntry
+ + " location: " + jrePath );
}
- } catch (IOException e) {
- logger.warn("Could not interpret entry: " + aVm.toString());
+ else
+ {
+ logger.debug( "Ignored (duplicated) additional Classpath Container version: " + version + " "
+ + classpathEntry + " location: " + jrePath );
+ }
+ }
+ catch ( IOException e )
+ {
+ logger.warn( "Could not interpret entry: " + aVm.toString() );
}
}
}
@@ -520,7 +568,7 @@ public class ReadWorkspaceLocations
getProjectLocation( workspaceConfiguration.getWorkspaceDirectory(), project );
if ( projectLocation != null )
{
- logger.debug( "read workpsace project " + projectLocation );
+ logger.debug( "read workpsace project " + projectLocation );
IdeDependency ideDependency = readArtefact( projectLocation, logger );
if ( ideDependency != null )
{
@@ -535,7 +583,7 @@ public class ReadWorkspaceLocations
}
}
}
- logger.debug( dependencies.size() + " from workspace " + workspaceConfiguration.getWorkspaceDirectory() );
- workspaceConfiguration.setWorkspaceArtefacts(dependencies.toArray( new IdeDependency[dependencies.size()] ));
+ logger.debug( dependencies.size() + " from workspace " + workspaceConfiguration.getWorkspaceDirectory() );
+ workspaceConfiguration.setWorkspaceArtefacts( dependencies.toArray( new IdeDependency[dependencies.size()] ) );
}
}
Modified: maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/reader/ReadWorkspaceLocationsTest.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/reader/ReadWorkspaceLocationsTest.java?rev=1677345&r1=1677344&r2=1677345&view=diff
==============================================================================
--- maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/reader/ReadWorkspaceLocationsTest.java (original)
+++ maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/reader/ReadWorkspaceLocationsTest.java Sat May 2 20:02:31 2015
@@ -15,11 +15,10 @@ package org.apache.maven.plugin.eclipse.
import java.io.File;
import java.io.IOException;
-import java.util.HashMap;
+import java.util.Map;
import junit.framework.TestCase;
-import org.apache.commons.io.FileUtils;
import org.apache.maven.plugin.eclipse.TempEclipseWorkspace;
import org.apache.maven.plugin.eclipse.WorkspaceConfiguration;
import org.apache.maven.plugin.logging.Log;
@@ -136,7 +135,7 @@ private File metaDataDirectory;
mm.replayAll();
ReadWorkspaceLocations objectUnderTest = new ReadWorkspaceLocations();
- HashMap servers = objectUnderTest.readDefinedServers( workspaceConfiguration, logger );
+ Map<String, String> servers = objectUnderTest.readDefinedServers( workspaceConfiguration, logger );
mm.verifyAll();
assertTrue( servers.isEmpty() );
@@ -157,7 +156,7 @@ private File metaDataDirectory;
mm.replayAll();
ReadWorkspaceLocations objectUnderTest = new ReadWorkspaceLocations();
- HashMap servers = objectUnderTest.readDefinedServers( workspaceConfiguration, logger );
+ Map<String, String> servers = objectUnderTest.readDefinedServers( workspaceConfiguration, logger );
mm.verifyAll();
assertTrue( servers.isEmpty() );