You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ah...@apache.org on 2008/01/28 01:47:50 UTC
svn commit: r615684 - in /maven/plugins/branches/MECLIPSE-344: ./
src/main/java/org/apache/maven/plugin/eclipse/
src/main/java/org/apache/maven/plugin/eclipse/reader/
src/main/java/org/apache/maven/plugin/eclipse/writers/
src/main/java/org/apache/maven...
Author: aheritier
Date: Sun Jan 27 16:47:47 2008
New Revision: 615684
URL: http://svn.apache.org/viewvc?rev=615684&view=rev
Log:
MECLIPSE-344 : connecting existing workspace artifact-projects
Patch submitted by Richard van Nieuwenhoven
Applied with few modifications ..
Added:
maven/plugins/branches/MECLIPSE-344/src/main/java/org/apache/maven/plugin/eclipse/reader/
maven/plugins/branches/MECLIPSE-344/src/main/java/org/apache/maven/plugin/eclipse/reader/ReadWorkspaceLocations.java (with props)
maven/plugins/branches/MECLIPSE-344/src/test/java/org/apache/maven/plugin/eclipse/TempEclipseWorkspace.java (with props)
maven/plugins/branches/MECLIPSE-344/src/test/resources/eclipse/
maven/plugins/branches/MECLIPSE-344/src/test/resources/eclipse/dummyJDK/
maven/plugins/branches/MECLIPSE-344/src/test/resources/eclipse/dummyJDK/1.3/
maven/plugins/branches/MECLIPSE-344/src/test/resources/eclipse/dummyJDK/1.3.1/
maven/plugins/branches/MECLIPSE-344/src/test/resources/eclipse/dummyJDK/1.3.1/jre/
maven/plugins/branches/MECLIPSE-344/src/test/resources/eclipse/dummyJDK/1.3.1/jre/lib/
maven/plugins/branches/MECLIPSE-344/src/test/resources/eclipse/dummyJDK/1.3.1/jre/lib/rt.jar (with props)
maven/plugins/branches/MECLIPSE-344/src/test/resources/eclipse/dummyJDK/1.3/jre/
maven/plugins/branches/MECLIPSE-344/src/test/resources/eclipse/dummyJDK/1.3/jre/lib/
maven/plugins/branches/MECLIPSE-344/src/test/resources/eclipse/dummyJDK/1.3/jre/lib/rt.jar (with props)
maven/plugins/branches/MECLIPSE-344/src/test/resources/eclipse/dummyJDK/1.4/
maven/plugins/branches/MECLIPSE-344/src/test/resources/eclipse/dummyJDK/1.4.2/
maven/plugins/branches/MECLIPSE-344/src/test/resources/eclipse/dummyJDK/1.4.2/jre/
maven/plugins/branches/MECLIPSE-344/src/test/resources/eclipse/dummyJDK/1.4.2/jre/lib/
maven/plugins/branches/MECLIPSE-344/src/test/resources/eclipse/dummyJDK/1.4.2/jre/lib/rt.jar (with props)
maven/plugins/branches/MECLIPSE-344/src/test/resources/eclipse/dummyJDK/1.4/jre/
maven/plugins/branches/MECLIPSE-344/src/test/resources/eclipse/dummyJDK/1.4/jre/lib/
maven/plugins/branches/MECLIPSE-344/src/test/resources/eclipse/dummyJDK/1.4/jre/lib/rt.jar (with props)
maven/plugins/branches/MECLIPSE-344/src/test/resources/eclipse/dummyJDK/1.5/
maven/plugins/branches/MECLIPSE-344/src/test/resources/eclipse/dummyJDK/1.5.0/
maven/plugins/branches/MECLIPSE-344/src/test/resources/eclipse/dummyJDK/1.5.0/jre/
maven/plugins/branches/MECLIPSE-344/src/test/resources/eclipse/dummyJDK/1.5.0/jre/lib/
maven/plugins/branches/MECLIPSE-344/src/test/resources/eclipse/dummyJDK/1.5.0/jre/lib/rt.jar (with props)
maven/plugins/branches/MECLIPSE-344/src/test/resources/eclipse/dummyJDK/1.5/jre/
maven/plugins/branches/MECLIPSE-344/src/test/resources/eclipse/dummyJDK/1.5/jre/lib/
maven/plugins/branches/MECLIPSE-344/src/test/resources/eclipse/dummyJDK/1.5/jre/lib/rt.jar (with props)
maven/plugins/branches/MECLIPSE-344/src/test/resources/eclipse/eclipseWithDefault13/
maven/plugins/branches/MECLIPSE-344/src/test/resources/eclipse/eclipseWithDefault13/workspace/
maven/plugins/branches/MECLIPSE-344/src/test/resources/eclipse/eclipseWithDefault13/workspace/.metadata/
maven/plugins/branches/MECLIPSE-344/src/test/resources/eclipse/eclipseWithDefault13/workspace/.metadata/.plugins/
maven/plugins/branches/MECLIPSE-344/src/test/resources/eclipse/eclipseWithDefault13/workspace/.metadata/.plugins/org.eclipse.core.resources/
maven/plugins/branches/MECLIPSE-344/src/test/resources/eclipse/eclipseWithDefault13/workspace/.metadata/.plugins/org.eclipse.core.resources/.projects/
maven/plugins/branches/MECLIPSE-344/src/test/resources/eclipse/eclipseWithDefault13/workspace/.metadata/.plugins/org.eclipse.core.resources/.projects/direct-compile/
maven/plugins/branches/MECLIPSE-344/src/test/resources/eclipse/eclipseWithDefault13/workspace/.metadata/.plugins/org.eclipse.core.resources/.projects/direct-compile/.location (with props)
maven/plugins/branches/MECLIPSE-344/src/test/resources/eclipse/eclipseWithDefault15/
maven/plugins/branches/MECLIPSE-344/src/test/resources/eclipse/eclipseWithDefault15/workspace/
maven/plugins/branches/MECLIPSE-344/src/test/resources/eclipse/eclipseWithDefault15/workspace/.metadata/
maven/plugins/branches/MECLIPSE-344/src/test/resources/eclipse/eclipseWithDefault15/workspace/.metadata/.plugins/
maven/plugins/branches/MECLIPSE-344/src/test/resources/eclipse/eclipseWithDefault15/workspace/.metadata/.plugins/org.eclipse.core.resources/
maven/plugins/branches/MECLIPSE-344/src/test/resources/eclipse/eclipseWithDefault15/workspace/.metadata/.plugins/org.eclipse.core.resources/.projects/
maven/plugins/branches/MECLIPSE-344/src/test/resources/eclipse/eclipseWithDefault15/workspace/.metadata/.plugins/org.eclipse.core.resources/.projects/direct-compile/
maven/plugins/branches/MECLIPSE-344/src/test/resources/eclipse/eclipseWithDefault15/workspace/.metadata/.plugins/org.eclipse.core.resources/.projects/direct-compile/.location (with props)
maven/plugins/branches/MECLIPSE-344/src/test/resources/eclipse/rad7WithDefault14/
maven/plugins/branches/MECLIPSE-344/src/test/resources/eclipse/rad7WithDefault14/workspace/
maven/plugins/branches/MECLIPSE-344/src/test/resources/eclipse/rad7WithDefault14/workspace/.metadata/
maven/plugins/branches/MECLIPSE-344/src/test/resources/eclipse/rad7WithDefault14/workspace/.metadata/.plugins/
maven/plugins/branches/MECLIPSE-344/src/test/resources/eclipse/rad7WithDefault14/workspace/.metadata/.plugins/org.eclipse.core.resources/
maven/plugins/branches/MECLIPSE-344/src/test/resources/eclipse/rad7WithDefault14/workspace/.metadata/.plugins/org.eclipse.core.resources/.projects/
maven/plugins/branches/MECLIPSE-344/src/test/resources/eclipse/rad7WithDefault14/workspace/.metadata/.plugins/org.eclipse.core.resources/.projects/direct-compile/
maven/plugins/branches/MECLIPSE-344/src/test/resources/eclipse/rad7WithDefault14/workspace/.metadata/.plugins/org.eclipse.core.resources/.projects/direct-compile/.location (with props)
Modified:
maven/plugins/branches/MECLIPSE-344/pom.xml
maven/plugins/branches/MECLIPSE-344/src/main/java/org/apache/maven/plugin/eclipse/EclipsePlugin.java
maven/plugins/branches/MECLIPSE-344/src/main/java/org/apache/maven/plugin/eclipse/WorkspaceConfiguration.java
maven/plugins/branches/MECLIPSE-344/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseClasspathWriter.java
maven/plugins/branches/MECLIPSE-344/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseProjectWriter.java
maven/plugins/branches/MECLIPSE-344/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseWriterConfig.java
maven/plugins/branches/MECLIPSE-344/src/main/java/org/apache/maven/plugin/eclipse/writers/rad/RadWebSettingsWriter.java
maven/plugins/branches/MECLIPSE-344/src/main/java/org/apache/maven/plugin/eclipse/writers/wtp/AbstractWtpResourceWriter.java
maven/plugins/branches/MECLIPSE-344/src/main/java/org/apache/maven/plugin/eclipse/writers/wtp/EclipseWtpApplicationXMLWriter.java
maven/plugins/branches/MECLIPSE-344/src/main/java/org/apache/maven/plugin/eclipse/writers/wtp/EclipseWtpFacetsWriter.java
maven/plugins/branches/MECLIPSE-344/src/main/java/org/apache/maven/plugin/ide/AbstractIdeSupportMojo.java
maven/plugins/branches/MECLIPSE-344/src/main/java/org/apache/maven/plugin/ide/IdeUtils.java
maven/plugins/branches/MECLIPSE-344/src/test/java/org/apache/maven/plugin/eclipse/EclipsePluginTest.java
Modified: maven/plugins/branches/MECLIPSE-344/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/branches/MECLIPSE-344/pom.xml?rev=615684&r1=615683&r2=615684&view=diff
==============================================================================
--- maven/plugins/branches/MECLIPSE-344/pom.xml (original)
+++ maven/plugins/branches/MECLIPSE-344/pom.xml Sun Jan 27 16:47:47 2008
@@ -1,23 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements. See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership. The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License. You may obtain a copy of the License at
-
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied. See the License for the
-specific language governing permissions and limitations
-under the License.
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
-->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<artifactId>maven-plugins</artifactId>
<groupId>org.apache.maven.plugins</groupId>
@@ -34,7 +35,9 @@
</prerequisites>
<scm>
<connection>scm:svn:http://svn.apache.org/repos/asf/maven/plugins/trunk/maven-eclipse-plugin/</connection>
- <developerConnection>scm:svn:https://svn.apache.org/repos/asf/maven/plugins/trunk/maven-eclipse-plugin/</developerConnection>
+ <developerConnection>
+ scm:svn:https://svn.apache.org/repos/asf/maven/plugins/trunk/maven-eclipse-plugin/
+ </developerConnection>
<url>http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/</url>
</scm>
<issueManagement>
@@ -66,6 +69,7 @@
<value>${maven.home}</value>
</property>
</systemProperties>
+ <argLine>${maven.test.jvmargs}</argLine>
</configuration>
</plugin>
</plugins>
@@ -180,5 +184,31 @@
<version>3.8.2</version>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.eclipse.core</groupId>
+ <artifactId>resources</artifactId>
+ <version>[3.1.0,4.0.0)</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.eclipse.ant</groupId>
+ <artifactId>core</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.eclipse.core</groupId>
+ <artifactId>expressions</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.eclipse.core</groupId>
+ <artifactId>filesystem</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.eclipse.core</groupId>
+ <artifactId>runtime</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
</dependencies>
+ <properties>
+ <maven.test.jvmargs>-Xmx256m</maven.test.jvmargs>
+ </properties>
</project>
Modified: maven/plugins/branches/MECLIPSE-344/src/main/java/org/apache/maven/plugin/eclipse/EclipsePlugin.java
URL: http://svn.apache.org/viewvc/maven/plugins/branches/MECLIPSE-344/src/main/java/org/apache/maven/plugin/eclipse/EclipsePlugin.java?rev=615684&r1=615683&r2=615684&view=diff
==============================================================================
--- maven/plugins/branches/MECLIPSE-344/src/main/java/org/apache/maven/plugin/eclipse/EclipsePlugin.java (original)
+++ maven/plugins/branches/MECLIPSE-344/src/main/java/org/apache/maven/plugin/eclipse/EclipsePlugin.java Sun Jan 27 16:47:47 2008
@@ -35,6 +35,7 @@
import org.apache.maven.artifact.handler.ArtifactHandler;
import org.apache.maven.model.Resource;
import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.eclipse.reader.ReadWorkspaceLocations;
import org.apache.maven.plugin.eclipse.writers.EclipseClasspathWriter;
import org.apache.maven.plugin.eclipse.writers.EclipseManifestWriter;
import org.apache.maven.plugin.eclipse.writers.EclipseOSGiManifestWriter;
@@ -364,6 +365,15 @@
*/
private boolean wtpapplicationxml;
+ /**
+ * What WTP defined server to use for deployment informations.
+ *
+ * @parameter expression="${eclipse.wtpdefaultserver}"
+ */
+ private String wtpdefaultserver;
+
+ private WorkspaceConfiguration workspaceConfiguration;
+
protected boolean isJavaProject()
{
return isJavaProject;
@@ -710,7 +720,8 @@
protected void verifyClasspathContainerListIsComplete()
{
boolean containsJREContainer = false;
- // Check if classpathContainer contains a JRE (default, alternate or Execution Environment)
+ // Check if classpathContainer contains a JRE (default, alternate or
+ // Execution Environment)
for ( Iterator iter = classpathContainers.iterator(); iter.hasNext(); )
{
Object classPathContainer = iter.next();
@@ -906,6 +917,8 @@
EclipseWriterConfig config = new EclipseWriterConfig();
+ config.setWorkspaceConfiguration( getWorkspaceConfiguration() );
+
config.setProjectNameTemplate( calculateProjectNameTemplate() );
String projectName = IdeUtils.getProjectName( config.getProjectNameTemplate(), project );
@@ -1075,8 +1088,14 @@
protected void fillDefaultClasspathContainers( String packaging )
{
classpathContainers = new ArrayList();
- classpathContainers.add( COMMON_PATH_JDT_LAUNCHING_JRE_CONTAINER );
+ if ( getWorkspaceConfiguration().getDefaultClasspathContainer() != null )
+ {
+ getLog().info(
+ "Adding default classpath contaigner: " +
+ getWorkspaceConfiguration().getDefaultClasspathContainer() );
+ classpathContainers.add( getWorkspaceConfiguration().getDefaultClasspathContainer() );
+ }
if ( pde )
{
classpathContainers.add( REQUIRED_PLUGINS_CONTAINER );
@@ -1287,6 +1306,43 @@
*/
public String getProjectNameForArifact( Artifact artifact )
{
+ IdeDependency[] workspaceArtefacts = getWorkspaceArtefacts();
+ for ( int index = 0; workspaceArtefacts != null && index < workspaceArtefacts.length; index++ )
+ {
+ IdeDependency workspaceArtefact = workspaceArtefacts[index];
+ if ( workspaceArtefact.isAddedToClasspath() &&
+ workspaceArtefact.getGroupId().equals( artifact.getGroupId() ) &&
+ workspaceArtefact.getArtifactId().equals( artifact.getArtifactId() ) )
+ {
+ if ( workspaceArtefact.getVersion().equals( artifact.getVersion() ) )
+ {
+ return workspaceArtefact.getEclipseProjectName();
+ }
+ }
+ }
return IdeUtils.getProjectName( calculateProjectNameTemplate(), artifact );
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected IdeDependency[] getWorkspaceArtefacts()
+ {
+ return getWorkspaceConfiguration().getWorkspaceArtefacts();
+ }
+
+ public WorkspaceConfiguration getWorkspaceConfiguration()
+ {
+ if ( workspaceConfiguration == null )
+ {
+ workspaceConfiguration = new WorkspaceConfiguration();
+ if ( this.workspace != null )
+ {
+ workspaceConfiguration.setWorkspaceDirectory( new File( this.workspace ) );
+ }
+ new ReadWorkspaceLocations().init( getLog(), this.workspaceConfiguration, this.project,
+ this.wtpdefaultserver );
+ }
+ return workspaceConfiguration;
}
}
Modified: maven/plugins/branches/MECLIPSE-344/src/main/java/org/apache/maven/plugin/eclipse/WorkspaceConfiguration.java
URL: http://svn.apache.org/viewvc/maven/plugins/branches/MECLIPSE-344/src/main/java/org/apache/maven/plugin/eclipse/WorkspaceConfiguration.java?rev=615684&r1=615683&r2=615684&view=diff
==============================================================================
--- maven/plugins/branches/MECLIPSE-344/src/main/java/org/apache/maven/plugin/eclipse/WorkspaceConfiguration.java (original)
+++ maven/plugins/branches/MECLIPSE-344/src/main/java/org/apache/maven/plugin/eclipse/WorkspaceConfiguration.java Sun Jan 27 16:47:47 2008
@@ -4,6 +4,7 @@
import java.net.URL;
import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.plugin.ide.IdeDependency;
public class WorkspaceConfiguration
{
@@ -15,6 +16,14 @@
private ArtifactRepository localRepository;
+ private String defaultClasspathContainer;
+
+ private IdeDependency[] workspaceArtefacts;
+
+ private String defaultDeployServerId;
+
+ private String defaultDeployServerName;
+
public File getWorkspaceDirectory()
{
return this.workspaceDirectory;
@@ -53,6 +62,73 @@
public void setLocalRepository( ArtifactRepository localRepository )
{
this.localRepository = localRepository;
+ }
+
+ public String getDefaultClasspathContainer()
+ {
+ return defaultClasspathContainer;
+ }
+
+ public void setDefaultClasspathContainer( String defaultClasspathContainer )
+ {
+ this.defaultClasspathContainer = defaultClasspathContainer;
+ }
+
+ public IdeDependency[] getWorkspaceArtefacts()
+ {
+ return workspaceArtefacts;
+ }
+
+ public void setWorkspaceArtefacts( IdeDependency[] workspaceArtefacts )
+ {
+ this.workspaceArtefacts = workspaceArtefacts;
+ }
+
+ public String getDefaultDeployServerId()
+ {
+ return defaultDeployServerId;
+ }
+
+ public void setDefaultDeployServerId( String defaultDeployServerId )
+ {
+ this.defaultDeployServerId = defaultDeployServerId;
+ }
+
+ public String getDefaultDeployServerName()
+ {
+ return defaultDeployServerName;
+ }
+
+ public void setDefaultDeployServerName( String defaultDeployServerName )
+ {
+ this.defaultDeployServerName = defaultDeployServerName;
+ }
+
+ /**
+ * @return the defined websphere server version and null if the target is no websphere.
+ */
+ public String getWebsphereVersion()
+ {
+ if ( getDefaultDeployServerId() != null && getDefaultDeployServerId().startsWith( "was." ) )
+ {
+ if ( getDefaultDeployServerId().indexOf( "v61" ) >= 0 )
+ {
+ return "6.1";
+ }
+ if ( getDefaultDeployServerId().indexOf( "v6" ) >= 0 )
+ {
+ return "6.0";
+ }
+ if ( getDefaultDeployServerId().indexOf( "v51" ) >= 0 )
+ {
+ return "5.1";
+ }
+ if ( getDefaultDeployServerId().indexOf( "v5" ) >= 0 )
+ {
+ return "5.0";
+ }
+ }
+ return null;
}
}
Added: maven/plugins/branches/MECLIPSE-344/src/main/java/org/apache/maven/plugin/eclipse/reader/ReadWorkspaceLocations.java
URL: http://svn.apache.org/viewvc/maven/plugins/branches/MECLIPSE-344/src/main/java/org/apache/maven/plugin/eclipse/reader/ReadWorkspaceLocations.java?rev=615684&view=auto
==============================================================================
--- maven/plugins/branches/MECLIPSE-344/src/main/java/org/apache/maven/plugin/eclipse/reader/ReadWorkspaceLocations.java (added)
+++ maven/plugins/branches/MECLIPSE-344/src/main/java/org/apache/maven/plugin/eclipse/reader/ReadWorkspaceLocations.java Sun Jan 27 16:47:47 2008
@@ -0,0 +1,527 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law
+ * or agreed to in writing, software distributed under the License is
+ * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the specific language
+ * governing permissions and limitations under the License.
+ */
+package org.apache.maven.plugin.eclipse.reader;
+
+import java.io.DataInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.StringReader;
+import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+import java.util.jar.JarFile;
+
+import org.apache.maven.plugin.eclipse.WorkspaceConfiguration;
+import org.apache.maven.plugin.ide.IdeDependency;
+import org.apache.maven.plugin.ide.IdeUtils;
+import org.apache.maven.plugin.logging.Log;
+import org.apache.maven.project.MavenProject;
+import org.codehaus.plexus.util.xml.Xpp3Dom;
+import org.codehaus.plexus.util.xml.Xpp3DomBuilder;
+import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
+import org.eclipse.core.internal.localstore.SafeChunkyInputStream;
+
+/**
+ * Scan the eclipse workspace and create a array with {@link IdeDependency} for all found artefacts.
+ *
+ * @author Richard van Nieuwenhoven
+ * @version $Id$
+ */
+public class ReadWorkspaceLocations
+{
+
+ private static final String BINARY_LOCATION_FILE = ".location";
+
+ private static final String METADATA_PLUGINS_ORG_ECLIPSE_CORE_RESOURCES_PROJECTS =
+ ".metadata/.plugins/org.eclipse.core.resources/.projects";
+
+ private static final String[] PARENT_VERSION = new String[] { "parent", "version" };
+
+ private static final String[] PARENT_GROUP_ID = new String[] { "parent", "groupId" };
+
+ private static final String[] PACKAGING = new String[] { "packaging" };
+
+ private static final String[] VERSION = new String[] { "version" };
+
+ private static final String[] GROUP_ID = new String[] { "groupId" };
+
+ private static final String[] ARTEFACT_ID = new String[] { "artifactId" };
+
+ private static final String METADATA_PLUGINS_ORG_ECLIPSE_CORE_RUNTIME_LAUNCHING_PREFS =
+ ".metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.launching.prefs";
+
+ private static final String METADATA_PLUGINS_ORG_ECLIPSE_CORE_RUNTIME_PREFS_VM_KEY =
+ "org.eclipse.jdt.launching.PREF_VM_XML";
+
+ private static final String METADATA_PLUGINS_ORG_ECLIPSE_CORE_RUNTIME_SERVER_PREFS =
+ ".metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.wst.server.core.prefs";
+
+ private static final String METADATA_PLUGINS_ORG_ECLIPSE_CORE_RUNTIME_PREFS_RUNTIMES_KEY = "runtimes";
+
+ 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_FORMAT = ReadWorkspaceLocations.CLASSPATHENTRY_DEFAULT + "/{0}/{1}";
+
+ public void init( Log log, WorkspaceConfiguration workspaceConfiguration, MavenProject project,
+ String wtpDefaultServer )
+ {
+ detectDefaultJREContaigner( workspaceConfiguration, project, log );
+ readWorkspace( workspaceConfiguration, log );
+ detectWTPDefaultServer( log, workspaceConfiguration, wtpDefaultServer );
+ }
+
+ private void detectWTPDefaultServer( Log log, WorkspaceConfiguration workspaceConfiguration, String wtpDefaultServer )
+ {
+ HashMap servers = readDefinedServers( workspaceConfiguration, log );
+ if ( wtpDefaultServer != null )
+ {
+ Set ids = servers.keySet();
+ // first we try the exact match
+ Iterator idIterator = ids.iterator();
+ while ( workspaceConfiguration.getDefaultDeployServerId() == null && idIterator.hasNext() )
+ {
+ String id = (String) idIterator.next();
+ String name = (String) servers.get( id );
+ if ( wtpDefaultServer.equals( id ) || wtpDefaultServer.equals( name ) )
+ {
+ workspaceConfiguration.setDefaultDeployServerId( id );
+ workspaceConfiguration.setDefaultDeployServerName( name );
+ }
+ }
+ if ( workspaceConfiguration.getDefaultDeployServerId() == null )
+ {
+ log.info( "no exact wtp server match." );
+ // now we will try the substring match
+ idIterator = ids.iterator();
+ while ( workspaceConfiguration.getDefaultDeployServerId() == null && idIterator.hasNext() )
+ {
+ String id = (String) idIterator.next();
+ String name = (String) servers.get( id );
+ if ( id.indexOf( wtpDefaultServer ) >= 0 || name.indexOf( wtpDefaultServer ) >= 0 )
+ {
+ workspaceConfiguration.setDefaultDeployServerId( id );
+ workspaceConfiguration.setDefaultDeployServerName( name );
+ }
+ }
+ }
+ }
+ if ( workspaceConfiguration.getDefaultDeployServerId() == null && servers.size() > 0 )
+ {
+ // now take the default server
+ log.info( "no substring wtp server match." );
+ workspaceConfiguration.setDefaultDeployServerId( (String) servers.get( "" ) );
+ workspaceConfiguration.setDefaultDeployServerName( (String) servers.get( workspaceConfiguration.getDefaultDeployServerId() ) );
+ }
+ log.info( "Using as WTP server : " + workspaceConfiguration.getDefaultDeployServerName() );
+ }
+
+ /**
+ * Take the compiler executable and try to find a JRE that contains that compiler.
+ *
+ * @param rawExecutable the executable with the complete path.
+ * @param jreMap the map with defined JRE's.
+ * @param logger the logger to log the error's
+ * @return the found container or null if non found.
+ */
+ private String getContaignerFromExecutable( String rawExecutable, Map jreMap, Log logger )
+ {
+ String foundContaigner = null;
+ if ( rawExecutable != null )
+ {
+ String executable;
+ try
+ {
+ executable = new File( rawExecutable ).getCanonicalPath();
+ logger.debug( "detected executable: " + executable );
+ }
+ catch ( Exception e )
+ {
+ return null;
+ }
+ File executableFile = new File( executable );
+ while ( executableFile != null )
+ {
+ foundContaigner = (String) jreMap.get( executableFile.getPath() );
+ if ( foundContaigner != null )
+ {
+ logger.debug( "detected classpathContaigner from executable: " + foundContaigner );
+ return foundContaigner;
+
+ }
+ executableFile = executableFile.getParentFile();
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Search the default JREContainer from eclipse for the current MavenProject
+ *
+ * @param workspaceLocation the location of the workspace.
+ * @param project the maven project the get the configuration
+ * @param logger the logger for errors
+ */
+ private void detectDefaultJREContaigner( WorkspaceConfiguration workspaceConfiguration, MavenProject project,
+ Log logger )
+ {
+ String defaultJREContainer = ReadWorkspaceLocations.CLASSPATHENTRY_DEFAULT;
+ if ( workspaceConfiguration.getWorkspaceDirectory() != null )
+ {
+ Map jreMap = readAvailableJREs( workspaceConfiguration.getWorkspaceDirectory(), logger );
+ if ( jreMap != null )
+ {
+ String foundContaigner =
+ getContaignerFromExecutable( System.getProperty( "maven.compiler.executable" ), jreMap, logger );
+ if ( foundContaigner == null )
+ {
+ foundContaigner =
+ getContaignerFromExecutable( IdeUtils.getCompilerPluginSetting( project, "executable" ),
+ jreMap, logger );
+ }
+ if ( foundContaigner == null )
+ {
+ String sourceVersion = IdeUtils.getCompilerSourceVersion( project );
+ foundContaigner = (String) jreMap.get( sourceVersion );
+ if ( foundContaigner != null )
+ {
+ logger.debug( "detected classpathContaigner from sourceVersion(" + sourceVersion + "): " +
+ foundContaigner );
+ }
+ }
+ if ( foundContaigner == null )
+ {
+ foundContaigner = getContaignerFromExecutable( System.getProperty( "java.home" ), jreMap, logger );
+ }
+ if ( foundContaigner != null )
+ {
+ defaultJREContainer = foundContaigner;
+ }
+
+ }
+ }
+ workspaceConfiguration.setDefaultClasspathContainer( defaultJREContainer );
+ }
+
+ /**
+ * Get the project location for a project in the eclipse metadata.
+ *
+ * @param workspaceLocation the location of the workspace
+ * @param project the project subdirectory in the metadata
+ * @return the full path to the project.
+ */
+ private String getProjectLocation( File workspaceLocation, File project )
+ {
+ String projectLocation = null;
+ File location = new File( project, ReadWorkspaceLocations.BINARY_LOCATION_FILE );
+ if ( location.exists() )
+ {
+ try
+ {
+ SafeChunkyInputStream fileInputStream = new SafeChunkyInputStream( location );
+ DataInputStream dataInputStream = new DataInputStream( fileInputStream );
+ String file = dataInputStream.readUTF().trim();
+
+ if ( file.length() > 0 )
+ {
+ file = file.substring( file.indexOf( ':' ) + 1 );
+ while ( !Character.isLetterOrDigit( file.charAt( 0 ) ) )
+ {
+ file = file.substring( 1 );
+ }
+ if ( file.indexOf( ':' ) < 0 )
+ {
+ file = File.separator + file;
+ }
+ projectLocation = file;
+ }
+
+ }
+ catch ( FileNotFoundException e )
+ {
+ projectLocation = "unknown";
+ }
+ catch ( IOException e )
+ {
+ projectLocation = "unknown";
+ }
+ }
+ if ( projectLocation == null )
+ {
+ File projectBase = new File( workspaceLocation, project.getName() );
+ if ( projectBase.isDirectory() )
+ {
+ projectLocation = projectBase.getAbsolutePath();
+ }
+ }
+ return projectLocation;
+ }
+
+ /**
+ * get a value from a dom element.
+ *
+ * @param element the element to get a value from
+ * @param elementNames the sub elements to get
+ * @param defaultValue teh default value if the value was null or empty
+ * @return the value of the dome element.
+ */
+ private String getValue( Xpp3Dom element, String[] elementNames, String defaultValue )
+ {
+ String value = null;
+ Xpp3Dom dom = element;
+ for ( int index = 0; dom != null && index < elementNames.length; index++ )
+ {
+ dom = dom.getChild( elementNames[index] );
+ }
+ if ( dom != null )
+ {
+ value = dom.getValue();
+ }
+ if ( value == null || value.trim().length() == 0 )
+ {
+ return defaultValue;
+ }
+ else
+ {
+ return value;
+ }
+ }
+
+ /**
+ * Read the artefact information from the pom in the project location and the eclipse project name from the .project
+ * file.
+ *
+ * @param projectLocation the location of the project
+ * @param logger the logger to report errors and debug info.
+ * @return an {@link IdeDependency} or null.
+ * @throws FileNotFoundException
+ * @throws XmlPullParserException
+ * @throws IOException
+ */
+ private IdeDependency readArtefact( String projectLocation, Log logger )
+ throws FileNotFoundException, XmlPullParserException, IOException
+ {
+ File projectFile = new File( new File( projectLocation ), ".project" );
+ String eclipseProjectName = new File( projectLocation ).getName();
+ if ( projectFile.exists() )
+ {
+ Xpp3Dom project = Xpp3DomBuilder.build( new FileReader( projectFile ) );
+ eclipseProjectName = getValue( project, new String[] { "name" }, eclipseProjectName );
+ }
+ File pomFile = new File( new File( projectLocation ), "pom.xml" );
+ if ( pomFile.exists() )
+ {
+ Xpp3Dom pom = Xpp3DomBuilder.build( new FileReader( pomFile ) );
+
+ String artifact = getValue( pom, ReadWorkspaceLocations.ARTEFACT_ID, null );
+ String group =
+ getValue( pom, ReadWorkspaceLocations.GROUP_ID, getValue( pom, ReadWorkspaceLocations.PARENT_GROUP_ID,
+ null ) );
+ String version =
+ getValue( pom, ReadWorkspaceLocations.VERSION, getValue( pom, ReadWorkspaceLocations.PARENT_VERSION,
+ null ) );
+ String packageing = getValue( pom, ReadWorkspaceLocations.PACKAGING, "jar" );
+
+ logger.debug( "found workspace artefact " + group + ":" + artifact + ":" + version + " " + packageing +
+ " (" + eclipseProjectName + ")" + " -> " + projectLocation );
+ return new IdeDependency( group, artifact, version, packageing, true, false, false, false, false, null,
+ packageing, false, null, 0, eclipseProjectName );
+ }
+ else
+ {
+ logger.debug( "ignored workspace project NO pom available " + projectLocation );
+ return null;
+ }
+ }
+
+ private HashMap readDefinedServers( WorkspaceConfiguration workspaceConfiguration, Log logger )
+ {
+ HashMap detectedRuntimes = new HashMap();
+ if ( workspaceConfiguration.getWorkspaceDirectory() != null )
+ {
+ Xpp3Dom runtimesElement = null;
+ try
+ {
+ File prefs =
+ new File( workspaceConfiguration.getWorkspaceDirectory(),
+ ReadWorkspaceLocations.METADATA_PLUGINS_ORG_ECLIPSE_CORE_RUNTIME_SERVER_PREFS );
+ Properties properties = new Properties();
+ properties.load( new FileInputStream( prefs ) );
+ runtimesElement =
+ Xpp3DomBuilder.build( new StringReader(
+ properties.getProperty( ReadWorkspaceLocations.METADATA_PLUGINS_ORG_ECLIPSE_CORE_RUNTIME_PREFS_RUNTIMES_KEY ) ) );
+ }
+ catch ( Exception e )
+ {
+ logger.error( "Could not read workspace wtp server runtimes preferences", e );
+ }
+
+ if ( runtimesElement != null )
+ {
+ Xpp3Dom[] runtimeArray = runtimesElement.getChildren( "runtime" );
+ for ( int index = 0; runtimeArray != null && index < runtimeArray.length; index++ )
+ {
+ String id = runtimeArray[index].getAttribute( "id" );
+ String name = runtimeArray[index].getAttribute( "name" );
+ if ( detectedRuntimes.isEmpty() )
+ {
+ logger.debug( "Using WTP runtime with id: \"" + id + "\" as default runtime" );
+ detectedRuntimes.put( "", id );
+ }
+ detectedRuntimes.put( id, name );
+ logger.debug( "Detected WTP runtime with id: \"" + id + "\" and name: \"" + name + "\"" );
+ }
+ }
+ }
+ return detectedRuntimes;
+ }
+
+ /**
+ * Read the JRE definition configured in the workspace. They will be put in a HashMap with as key there path and as
+ * value the JRE constant. a second key is included with the JRE version as a key.
+ *
+ * @param workspaceLocation the workspace location
+ * @param logger the logger to error messages
+ * @return the map with found jre's
+ */
+ private HashMap readAvailableJREs( File workspaceLocation, Log logger )
+ {
+ HashMap jreMap = new HashMap();
+ 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" ) );
+ Xpp3Dom vms;
+ try
+ {
+ File prefs =
+ new File( workspaceLocation,
+ ReadWorkspaceLocations.METADATA_PLUGINS_ORG_ECLIPSE_CORE_RUNTIME_LAUNCHING_PREFS );
+ Properties properties = new Properties();
+ properties.load( new FileInputStream( prefs ) );
+ vms =
+ Xpp3DomBuilder.build( new StringReader(
+ properties.getProperty( ReadWorkspaceLocations.METADATA_PLUGINS_ORG_ECLIPSE_CORE_RUNTIME_PREFS_VM_KEY ) ) );
+ }
+ catch ( Exception e )
+ {
+ logger.error( "Could not read workspace JRE preferences", e );
+ return jreMap;
+ }
+ 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();
+ String classpathEntry =
+ MessageFormat.format( ReadWorkspaceLocations.CLASSPATHENTRY_FORMAT,
+ new Object[] { typeId, name } );
+ String jrePath = new File( path ).getCanonicalPath();
+ JarFile rtJar = new JarFile( new File( new File( jrePath ), "jre/lib/rt.jar" ) );
+ 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 Contaigner 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 Contaigner version: " + version + " " + classpathEntry +
+ " location: " + jrePath );
+ }
+ else
+ {
+ logger.debug( "Ignored (duplicated) additional Classpath Contaigner version: " + version + " " +
+ classpathEntry + " location: " + jrePath );
+ }
+ }
+ catch ( IOException e )
+ {
+ logger.warn( "Could not interpret entry: " + vm.toString() );
+ }
+ }
+ }
+ return jreMap;
+ }
+
+ /**
+ * Scan the eclipse workspace and create a array with {@link IdeDependency} for all found artifacts.
+ *
+ * @param workspaceLocation the location of the eclipse workspace.
+ * @param logger the logger to report errors and debug info.
+ */
+ private void readWorkspace( WorkspaceConfiguration workspaceConfiguration, Log logger )
+ {
+ ArrayList dependencys = new ArrayList();
+ if ( workspaceConfiguration.getWorkspaceDirectory() != null )
+ {
+ File workspace =
+ new File( workspaceConfiguration.getWorkspaceDirectory(),
+ ReadWorkspaceLocations.METADATA_PLUGINS_ORG_ECLIPSE_CORE_RESOURCES_PROJECTS );
+
+ File[] directories = workspace.listFiles();
+ for ( int index = 0; directories != null && index < directories.length; index++ )
+ {
+ File project = directories[index];
+ if ( project.isDirectory() )
+ {
+ try
+ {
+ String projectLocation =
+ getProjectLocation( workspaceConfiguration.getWorkspaceDirectory(), project );
+ if ( projectLocation != null )
+ {
+ IdeDependency ideDependency = readArtefact( projectLocation, logger );
+ if ( ideDependency != null )
+ {
+ dependencys.add( ideDependency );
+ }
+ }
+ }
+ catch ( Exception e )
+ {
+ logger.warn( "could not read workspace project:" + project );
+ }
+ }
+ }
+ }
+ workspaceConfiguration.setWorkspaceArtefacts( (IdeDependency[]) dependencys.toArray( new IdeDependency[dependencys.size()] ) );
+ }
+}
Propchange: maven/plugins/branches/MECLIPSE-344/src/main/java/org/apache/maven/plugin/eclipse/reader/ReadWorkspaceLocations.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/plugins/branches/MECLIPSE-344/src/main/java/org/apache/maven/plugin/eclipse/reader/ReadWorkspaceLocations.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Modified: maven/plugins/branches/MECLIPSE-344/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseClasspathWriter.java
URL: http://svn.apache.org/viewvc/maven/plugins/branches/MECLIPSE-344/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseClasspathWriter.java?rev=615684&r1=615683&r2=615684&view=diff
==============================================================================
--- maven/plugins/branches/MECLIPSE-344/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseClasspathWriter.java (original)
+++ maven/plugins/branches/MECLIPSE-344/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseClasspathWriter.java Sun Jan 27 16:47:47 2008
@@ -376,7 +376,7 @@
if ( dep.isReferencedProject() && !config.isPde() )
{
- path = "/" + IdeUtils.getProjectName( config.getProjectNameTemplate(), dep ); //$NON-NLS-1$
+ path = "/" + dep.getEclipseProjectName(); //$NON-NLS-1$
kind = ATTR_SRC;
}
else if ( dep.isReferencedProject() && config.isPde() )
@@ -428,11 +428,20 @@
else
{
String fullPath = artifactPath.getPath();
+ String relativePath =
+ IdeUtils.toRelativeAndFixSeparator( localRepositoryFile, new File( fullPath ), false );
- path = M2_REPO + "/" //$NON-NLS-1$
- + IdeUtils.toRelativeAndFixSeparator( localRepositoryFile, new File( fullPath ), false );
-
- kind = ATTR_VAR; //$NON-NLS-1$
+ if ( !new File( relativePath ).isAbsolute() )
+ {
+ path = M2_REPO + "/" //$NON-NLS-1$
+ + relativePath;
+ kind = ATTR_VAR; //$NON-NLS-1$
+ }
+ else
+ {
+ path = relativePath;
+ kind = ATTR_LIB;
+ }
}
if ( dep.getSourceAttachment() != null )
Modified: maven/plugins/branches/MECLIPSE-344/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseProjectWriter.java
URL: http://svn.apache.org/viewvc/maven/plugins/branches/MECLIPSE-344/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseProjectWriter.java?rev=615684&r1=615683&r2=615684&view=diff
==============================================================================
--- maven/plugins/branches/MECLIPSE-344/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseProjectWriter.java (original)
+++ maven/plugins/branches/MECLIPSE-344/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseProjectWriter.java Sun Jan 27 16:47:47 2008
@@ -194,7 +194,7 @@
if ( dep.isReferencedProject() )
{
writer.startElement( "project" ); //$NON-NLS-1$
- writer.writeText( IdeUtils.getProjectName( config.getProjectNameTemplate(), dep ) );
+ writer.writeText( dep.getEclipseProjectName() );
writer.endElement();
}
}
Modified: maven/plugins/branches/MECLIPSE-344/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseWriterConfig.java
URL: http://svn.apache.org/viewvc/maven/plugins/branches/MECLIPSE-344/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseWriterConfig.java?rev=615684&r1=615683&r2=615684&view=diff
==============================================================================
--- maven/plugins/branches/MECLIPSE-344/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseWriterConfig.java (original)
+++ maven/plugins/branches/MECLIPSE-344/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseWriterConfig.java Sun Jan 27 16:47:47 2008
@@ -27,6 +27,7 @@
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.plugin.eclipse.EclipsePlugin;
import org.apache.maven.plugin.eclipse.EclipseSourceDir;
+import org.apache.maven.plugin.eclipse.WorkspaceConfiguration;
import org.apache.maven.plugin.ide.IdeDependency;
import org.apache.maven.project.MavenProject;
@@ -143,6 +144,18 @@
* @see EclipsePlugin#getWtpversion()
*/
private float wtpVersion;
+
+ private WorkspaceConfiguration workspaceConfiguration;
+
+ public WorkspaceConfiguration getWorkspaceConfiguration()
+ {
+ return workspaceConfiguration;
+ }
+
+ public void setWorkspaceConfiguration( WorkspaceConfiguration workspaceConfiguration )
+ {
+ this.workspaceConfiguration = workspaceConfiguration;
+ }
/**
* Getter for <code>deps</code>.
Modified: maven/plugins/branches/MECLIPSE-344/src/main/java/org/apache/maven/plugin/eclipse/writers/rad/RadWebSettingsWriter.java
URL: http://svn.apache.org/viewvc/maven/plugins/branches/MECLIPSE-344/src/main/java/org/apache/maven/plugin/eclipse/writers/rad/RadWebSettingsWriter.java?rev=615684&r1=615683&r2=615684&view=diff
==============================================================================
--- maven/plugins/branches/MECLIPSE-344/src/main/java/org/apache/maven/plugin/eclipse/writers/rad/RadWebSettingsWriter.java (original)
+++ maven/plugins/branches/MECLIPSE-344/src/main/java/org/apache/maven/plugin/eclipse/writers/rad/RadWebSettingsWriter.java Sun Jan 27 16:47:47 2008
@@ -183,7 +183,7 @@
log.debug( "RadWebSettingsWriter: dependency " + dependency.toString() +
" selected for inclusion as lib-module" );
- String depName = IdeUtils.getProjectName( config.getProjectNameTemplate(), dependency );
+ String depName = dependency.getEclipseProjectName();
String depJar = dependency.getArtifactId() + ".jar";
writer.startElement( WEBSETTINGS_LIBMODULE );
Modified: maven/plugins/branches/MECLIPSE-344/src/main/java/org/apache/maven/plugin/eclipse/writers/wtp/AbstractWtpResourceWriter.java
URL: http://svn.apache.org/viewvc/maven/plugins/branches/MECLIPSE-344/src/main/java/org/apache/maven/plugin/eclipse/writers/wtp/AbstractWtpResourceWriter.java?rev=615684&r1=615683&r2=615684&view=diff
==============================================================================
--- maven/plugins/branches/MECLIPSE-344/src/main/java/org/apache/maven/plugin/eclipse/writers/wtp/AbstractWtpResourceWriter.java (original)
+++ maven/plugins/branches/MECLIPSE-344/src/main/java/org/apache/maven/plugin/eclipse/writers/wtp/AbstractWtpResourceWriter.java Sun Jan 27 16:47:47 2008
@@ -208,10 +208,20 @@
else
{
File localRepositoryFile = new File( localRepository.getBasedir() );
+ String relativePath = IdeUtils.toRelativeAndFixSeparator( localRepositoryFile, repoFile, false );
- handle = "module:/classpath/var/M2_REPO/" //$NON-NLS-1$
- +
- IdeUtils.toRelativeAndFixSeparator( localRepositoryFile, repoFile, false );
+ if ( !new File( relativePath ).isAbsolute() )
+ {
+ handle = "module:/classpath/var/M2_REPO/" //$NON-NLS-1$
+ +
+ relativePath;
+ }
+ else
+ {
+ handle = "module:/classpath/lib/" //$NON-NLS-1$
+ +
+ IdeUtils.toRelativeAndFixSeparator( config.getEclipseProjectDirectory(), repoFile, false );
+ }
}
if ( Constants.PROJECT_PACKAGING_EAR.equals( this.config.getPackaging() ) && !"/".equals( deployPath ) )
{
Modified: maven/plugins/branches/MECLIPSE-344/src/main/java/org/apache/maven/plugin/eclipse/writers/wtp/EclipseWtpApplicationXMLWriter.java
URL: http://svn.apache.org/viewvc/maven/plugins/branches/MECLIPSE-344/src/main/java/org/apache/maven/plugin/eclipse/writers/wtp/EclipseWtpApplicationXMLWriter.java?rev=615684&r1=615683&r2=615684&view=diff
==============================================================================
--- maven/plugins/branches/MECLIPSE-344/src/main/java/org/apache/maven/plugin/eclipse/writers/wtp/EclipseWtpApplicationXMLWriter.java (original)
+++ maven/plugins/branches/MECLIPSE-344/src/main/java/org/apache/maven/plugin/eclipse/writers/wtp/EclipseWtpApplicationXMLWriter.java Sun Jan 27 16:47:47 2008
@@ -88,6 +88,8 @@
private static final String XMLNS_SCHEMA_LOCATION = "xmlns:schemaLocation";
+ private static final String XSI_SCHEMA_LOCATION = "xsi:schemaLocation";
+
private static final String XMLNS_XMI = "xmlns:xmi";
private static final String XMLNS_XSI = "xmlns:xsi";
@@ -244,7 +246,18 @@
result.setAttribute( EclipseWtpApplicationXMLWriter.VERSION, "1.4" );
result.setAttribute( EclipseWtpApplicationXMLWriter.XMLNS, "http://java.sun.com/xml/ns/j2ee" );
result.setAttribute( EclipseWtpApplicationXMLWriter.XMLNS_XSI, "http://www.w3.org/2001/XMLSchema-instance" );
- result.setAttribute( EclipseWtpApplicationXMLWriter.XMLNS_SCHEMA_LOCATION,
+
+ // special case for development websphere's ....
+ String locationAttribute;
+ if ( this.config.getWorkspaceConfiguration().getWebsphereVersion() != null )
+ {
+ locationAttribute = EclipseWtpApplicationXMLWriter.XSI_SCHEMA_LOCATION;
+ }
+ else
+ {
+ locationAttribute = EclipseWtpApplicationXMLWriter.XMLNS_SCHEMA_LOCATION;
+ }
+ result.setAttribute( locationAttribute,
"http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/application_1_4.xsd" );
result.addChild( new Xpp3Dom( EclipseWtpApplicationXMLWriter.APPLICATION_XML_DESCRIPTION ) );
Xpp3Dom name = new Xpp3Dom( EclipseWtpApplicationXMLWriter.APPLICATION_XML_DISPLAY_NAME );
Modified: maven/plugins/branches/MECLIPSE-344/src/main/java/org/apache/maven/plugin/eclipse/writers/wtp/EclipseWtpFacetsWriter.java
URL: http://svn.apache.org/viewvc/maven/plugins/branches/MECLIPSE-344/src/main/java/org/apache/maven/plugin/eclipse/writers/wtp/EclipseWtpFacetsWriter.java?rev=615684&r1=615683&r2=615684&view=diff
==============================================================================
--- maven/plugins/branches/MECLIPSE-344/src/main/java/org/apache/maven/plugin/eclipse/writers/wtp/EclipseWtpFacetsWriter.java (original)
+++ maven/plugins/branches/MECLIPSE-344/src/main/java/org/apache/maven/plugin/eclipse/writers/wtp/EclipseWtpFacetsWriter.java Sun Jan 27 16:47:47 2008
@@ -46,6 +46,10 @@
extends AbstractWtpResourceWriter
{
+ private static final String FACET_COM_IBM_WEBSPHERE_COEXISTENCE_EAR = "com.ibm.websphere.coexistence.ear"; //$NON-NLS-1$
+
+ private static final String FACET_COM_IBM_WEBSPHERE_EXTENDED_EAR = "com.ibm.websphere.extended.ear"; //$NON-NLS-1$
+
private static final String FACET_JST_EAR = "jst.ear"; //$NON-NLS-1$
private static final String FACET_JST_UTILITY = "jst.utility"; //$NON-NLS-1$
@@ -140,6 +144,23 @@
}
else if ( Constants.PROJECT_PACKAGING_EAR.equalsIgnoreCase( packaging ) ) //$NON-NLS-1$
{
+ if ( this.config.getWorkspaceConfiguration().getWebsphereVersion() != null )
+ {
+ writer.startElement( "runtime" );
+ writer.addAttribute( "name", config.getWorkspaceConfiguration().getDefaultDeployServerName() );
+ writer.endElement(); // runtime
+
+ writer.startElement( ELT_INSTALLED );
+ writer.addAttribute( ATTR_FACET, FACET_COM_IBM_WEBSPHERE_EXTENDED_EAR );
+ writer.addAttribute( ATTR_VERSION, this.config.getWorkspaceConfiguration().getWebsphereVersion() );
+ writer.endElement(); // installed
+
+ writer.startElement( ELT_INSTALLED );
+ writer.addAttribute( ATTR_FACET, FACET_COM_IBM_WEBSPHERE_COEXISTENCE_EAR );
+ writer.addAttribute( ATTR_VERSION, this.config.getWorkspaceConfiguration().getWebsphereVersion() );
+ writer.endElement(); // installed
+
+ }
writer.startElement( ELT_FIXED );
writer.addAttribute( ATTR_FACET, FACET_JST_EAR );
writer.endElement(); // fixed
@@ -147,6 +168,7 @@
writer.addAttribute( ATTR_FACET, FACET_JST_EAR );
writer.addAttribute( ATTR_VERSION, JeeUtils.resolveJeeVersion( config.getProject() ) );
writer.endElement(); // installed
+
}
else if ( Constants.PROJECT_PACKAGING_JAR.equalsIgnoreCase( packaging ) ) //$NON-NLS-1$
{
Modified: maven/plugins/branches/MECLIPSE-344/src/main/java/org/apache/maven/plugin/ide/AbstractIdeSupportMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/branches/MECLIPSE-344/src/main/java/org/apache/maven/plugin/ide/AbstractIdeSupportMojo.java?rev=615684&r1=615683&r2=615684&view=diff
==============================================================================
--- maven/plugins/branches/MECLIPSE-344/src/main/java/org/apache/maven/plugin/ide/AbstractIdeSupportMojo.java (original)
+++ maven/plugins/branches/MECLIPSE-344/src/main/java/org/apache/maven/plugin/ide/AbstractIdeSupportMojo.java Sun Jan 27 16:47:47 2008
@@ -204,6 +204,24 @@
private Logger logger;
/**
+ * This eclipse workspace is read and all artifacts detected there will be connected as eclipse projects and will
+ * not be linked to the jars in the local repository. Requirement is that it was created with the similar wtp
+ * settings as the reactor projects, but the project name template my differ. The pom's in the workspace projects
+ * may not contain variables in the artefactId, groupId and version tags.
+ *
+ * @parameter expression="${eclipse.workspaceToConnect}"
+ */
+ protected String workspace;
+
+ /**
+ * Limit the use of project references to the current workspaceToConnect. No project references will be created to
+ * projects in the reactor when they are not available in the workspace.
+ *
+ * @parameter expression="${eclipse.limitProjectReferencesToWorkspace}" default-value="false"
+ */
+ protected boolean limitProjectReferencesToWorkspace;
+
+ /**
* Getter for <code>artifactMetadataSource</code>.
*
* @return Returns the artifactMetadataSource.
@@ -570,9 +588,9 @@
int dependencyDepth = node.getDepth();
Artifact art = node.getArtifact();
boolean isReactorProject = getUseProjectReferences() && isAvailableAsAReactorProject( art );
-
+ boolean isWorkspaceProject = getUseProjectReferences() && isAvailableAsAWorkspaceProject( art );
// don't resolve jars for reactor projects
- if ( !isReactorProject )
+ if ( !isReactorProject || ( limitProjectReferencesToWorkspace && !isWorkspaceProject ) )
{
try
{
@@ -653,9 +671,13 @@
isOsgiBundle = osgiSymbolicName != null;
+ boolean useProjectReference = ( isReactorProject && !limitProjectReferencesToWorkspace ) || // default
+ ( limitProjectReferencesToWorkspace && isWorkspaceProject ) || // limitProjectReferencesToWorkspace
+ ( !isReactorProject && isWorkspaceProject ); // default + workspace projects
+
IdeDependency dep =
new IdeDependency( art.getGroupId(), art.getArtifactId(), art.getVersion(),
- art.getClassifier(), isReactorProject,
+ art.getClassifier(), useProjectReference,
Artifact.SCOPE_TEST.equals( art.getScope() ),
Artifact.SCOPE_SYSTEM.equals( art.getScope() ),
Artifact.SCOPE_PROVIDED.equals( art.getScope() ),
@@ -798,6 +820,48 @@
" already available as a reactor project, but with different version. Expected: " +
artifact.getVersion() + ", found: " + reactorProject.getVersion() );
}
+ }
+ }
+ }
+ return false;
+ }
+
+ /**
+ * @return an array with all dependencies avaliable in the workspace, to be implemented by the subclasses.
+ */
+ protected IdeDependency[] getWorkspaceArtefacts()
+ {
+ return new IdeDependency[0];
+ }
+
+ /**
+ * Utility method that locates a project in the workspace for the given artifact.
+ *
+ * @param artifact the artifact a project should produce.
+ * @return <code>true</code> if the artifact is produced by a reactor projectart.
+ */
+ private boolean isAvailableAsAWorkspaceProject( Artifact artifact )
+ {
+ IdeDependency[] workspaceArtefacts = getWorkspaceArtefacts();
+ for ( int index = 0; workspaceArtefacts != null && index < workspaceArtefacts.length; index++ )
+ {
+ IdeDependency workspaceArtefact = workspaceArtefacts[index];
+ if ( workspaceArtefact.getGroupId().equals( artifact.getGroupId() ) &&
+ workspaceArtefact.getArtifactId().equals( artifact.getArtifactId() ) )
+ {
+ if ( workspaceArtefact.getVersion().equals( artifact.getVersion() ) )
+ {
+ workspaceArtefact.setAddedToClasspath( true );
+ logger.debug( "Using workspace project: " + workspaceArtefact.getEclipseProjectName() );
+ return true;
+ }
+ else
+ {
+ getLog().info(
+ "Artifact " +
+ artifact.getId() +
+ " already available as a workspace project, but with different version. Expected: " +
+ artifact.getVersion() + ", found: " + workspaceArtefact.getVersion() );
}
}
}
Modified: maven/plugins/branches/MECLIPSE-344/src/main/java/org/apache/maven/plugin/ide/IdeUtils.java
URL: http://svn.apache.org/viewvc/maven/plugins/branches/MECLIPSE-344/src/main/java/org/apache/maven/plugin/ide/IdeUtils.java?rev=615684&r1=615683&r2=615684&view=diff
==============================================================================
--- maven/plugins/branches/MECLIPSE-344/src/main/java/org/apache/maven/plugin/ide/IdeUtils.java (original)
+++ maven/plugins/branches/MECLIPSE-344/src/main/java/org/apache/maven/plugin/ide/IdeUtils.java Sun Jan 27 16:47:47 2008
@@ -266,7 +266,10 @@
return (Xpp3Dom[]) configurationDomList.toArray( new Xpp3Dom[configurationDomList.size()] );
}
- public static String getProjectName( String template, IdeDependency dep )
+ /**
+ * Use {@link IdeDependency#getEclipseProjectName()} instead.
+ */
+ protected static String getProjectName( String template, IdeDependency dep )
{
return getProjectName( template, dep.getGroupId(), dep.getArtifactId(), dep.getVersion() );
}
@@ -288,7 +291,7 @@
return getProjectName( template, project.getGroupId(), project.getArtifactId(), project.getVersion() );
}
- public static String getProjectName( IdeDependency dep, boolean addVersionToProjectName )
+ private static String getProjectName( IdeDependency dep, boolean addVersionToProjectName )
{
return getProjectName( addVersionToProjectName ? PROJECT_NAME_WITH_VERSION_TEMPLATE
: PROJECT_NAME_DEFAULT_TEMPLATE, dep );
Modified: maven/plugins/branches/MECLIPSE-344/src/test/java/org/apache/maven/plugin/eclipse/EclipsePluginTest.java
URL: http://svn.apache.org/viewvc/maven/plugins/branches/MECLIPSE-344/src/test/java/org/apache/maven/plugin/eclipse/EclipsePluginTest.java?rev=615684&r1=615683&r2=615684&view=diff
==============================================================================
--- maven/plugins/branches/MECLIPSE-344/src/test/java/org/apache/maven/plugin/eclipse/EclipsePluginTest.java (original)
+++ maven/plugins/branches/MECLIPSE-344/src/test/java/org/apache/maven/plugin/eclipse/EclipsePluginTest.java Sun Jan 27 16:47:47 2008
@@ -81,15 +81,17 @@
testProject( "project-06" );
}
- // @TODO temporarily disabled, since it randomly fails due to a different order for dependencies in classpath and
- // wtpmodules. This is not a problem, since order could be ignored in this test, but we should rewrite the
- // file-comparing
- // step which at the moment just does line by line comparison
- // public void testProject07()
- // throws Exception
- // {
- // testProject( "project-07" );
- // }
+ /**
+ * @TODO temporarily disabled, since it randomly fails due to a different order for dependencies in classpath and
+ * wtpmodules. This is not a problem, since order could be ignored in this test, but we should rewrite the
+ * file-comparing step which at the moment just does line by line comparison
+ * @throws Exception
+ */
+ public void testProject07()
+ throws Exception
+ {
+ // testProject( "project-07" );
+ }
public void testProject08()
throws Exception
@@ -363,6 +365,21 @@
testProject( "project-32" );
}
+ /**
+ * MECLIPSE-287 : dependencies with and without classifiers MECLIPSE-151 : test jar source attachments
+ *
+ * @TODO temporarily disabled, since it randomly fails due to a different order for dependencies in classpath and
+ * wtpmodules. This is not a problem, since order could be ignored in this test, but we should rewrite the
+ * file-comparing step which at the moment just does line by line comparison project 7 is affected by this as
+ * well.
+ * @throws Exception any exception thrown during test
+ */
+ public void testProject33()
+ throws Exception
+ {
+ // testProject( "project-33" );
+ }
+
public void testProject34()
throws Exception
{
@@ -427,7 +444,7 @@
}
/**
- * MECLIPSE-56 : problem with encoding of non-ascii characters in pom.xml
+ * MECLIPSE-56 : problem with encoding of non-ascii characters in pom.xml
*/
public void testMECLIPSE_56_encoding()
throws Exception
@@ -441,6 +458,52 @@
testProject( "project-38" );
}
+ public void testProject39()
+ throws Exception
+ {
+ // AHE : Failing for me with expected:<[]> but was:<[J2SE-1.3]>
+ checkJRESettingsWithEclipseWorkspace( "project-39", new TempEclipseWorkspace( "eclipseWithDefault13", true ),
+ "", null );
+ checkJRESettingsWithEclipseWorkspace( "project-39", new TempEclipseWorkspace( "eclipseWithDefault15", false ),
+ "J2SE-1.3", null );
+ checkJRESettingsWithEclipseWorkspace( "project-39", new TempEclipseWorkspace( "rad7WithDefault14", false ),
+ "J2SE-1.3", null );
+ }
+
+ public void testProject40()
+ throws Exception
+ {
+ String jre131 = new java.io.File( "target/test-classes/eclipse/dummyJDK/1.3.1/bin/javac" ).getCanonicalPath();
+ // AHE : Failing for me with expected:<[JVM 1.3.1]> but was:<[]>
+ checkJRESettingsWithEclipseWorkspace( "project-40", new TempEclipseWorkspace( "eclipseWithDefault13", true ),
+ "JVM 1.3.1", jre131 );
+ // AHE : Failing for me with expected:<[JVM 1.3.1]> but was:<[]>
+ checkJRESettingsWithEclipseWorkspace( "project-40", new TempEclipseWorkspace( "eclipseWithDefault15", false ),
+ "JVM 1.3.1", jre131 );
+ checkJRESettingsWithEclipseWorkspace( "project-40", new TempEclipseWorkspace( "rad7WithDefault14", false ), "",
+ jre131 );
+ }
+
+ public void testProject41()
+ throws Exception
+ {
+ TempEclipseWorkspace rad7 = new TempEclipseWorkspace( "rad7WithDefault14", false );
+ Properties properties = new Properties();
+ properties.setProperty( "eclipse.workspaceToConnect", rad7.workspaceLocation.getCanonicalPath() );
+ testProject( "project-41", properties, "clean", "eclipse" );
+
+ }
+
+ public void testProject42()
+ throws Exception
+ {
+ TempEclipseWorkspace rad7 = new TempEclipseWorkspace( "rad7WithDefault14", false );
+ Properties properties = new Properties();
+ properties.setProperty( "eclipse.workspaceToConnect", rad7.workspaceLocation.getCanonicalPath() );
+ testProject( "project-42", properties, "clean", "eclipse" );
+
+ }
+
public void testJeeSimple()
throws Exception
{
@@ -489,21 +552,46 @@
}
}
}
- /**
- * MECLIPSE-287 : dependencies with and without classifiers MECLIPSE-151 : test jar source attachments
- *
- * @throws Exception any exception thrown during test
- */
- /*
- * @TODO temporarily disabled, since it randomly fails due to a different order for dependencies in classpath and
- * wtpmodules. This is not a problem, since order could be ignored in this test, but we should rewrite the
- * file-comparing step which at the moment just does line by line comparison project 7 is affected by this as well.
- * public void testProject33() throws Exception { testProject( "project-33" ); }
- */
+
+ private void checkJRESettingsWithEclipseWorkspace( String project, TempEclipseWorkspace workspace,
+ String expectedJRE, String jreExec )
+ throws Exception
+ {
+ Properties properties = new Properties();
+ properties.setProperty( "eclipse.workspaceToConnect", workspace.workspaceLocation.getCanonicalPath() );
+ if ( jreExec != null )
+ {
+ properties.setProperty( "maven.compiler.executable", jreExec );
+ }
+ testProject( project, properties, "clean", "eclipse" );
+
+ Xpp3Dom classpath =
+ Xpp3DomBuilder.build( new FileReader( getTestFile( "target/test-classes/projects/" + project +
+ "/.classpath" ) ) );
+
+ boolean foundDirectCompileAsProject = false;
+ String foundJRE = "";
+
+ Xpp3Dom[] classpathentries = classpath.getChildren( "classpathentry" );
+ for ( int index = 0; index < classpathentries.length; index++ )
+ {
+ if ( "/direct-compile".equals( classpathentries[index].getAttribute( "path" ) ) )
+ {
+ foundDirectCompileAsProject = true;
+ }
+ String path = classpathentries[index].getAttribute( "path" );
+ if ( "con".equals( classpathentries[index].getAttribute( "kind" ) ) && path.lastIndexOf( '/' ) > 0 )
+ {
+ foundJRE = path.substring( path.lastIndexOf( '/' ) + 1 );
+ }
+ }
+ assertTrue( foundDirectCompileAsProject );
+ assertEquals( expectedJRE, foundJRE );
+ }
/*
* TODO: Add a test for downloadJavadocs. Currently, eclipse doesn't support having variables in the javadoc path.
* This means that the expected .classpath can't match the final result as the result will have the absolute path to
* the user's local repo.
*/
-}
\ No newline at end of file
+}
Added: maven/plugins/branches/MECLIPSE-344/src/test/java/org/apache/maven/plugin/eclipse/TempEclipseWorkspace.java
URL: http://svn.apache.org/viewvc/maven/plugins/branches/MECLIPSE-344/src/test/java/org/apache/maven/plugin/eclipse/TempEclipseWorkspace.java?rev=615684&view=auto
==============================================================================
--- maven/plugins/branches/MECLIPSE-344/src/test/java/org/apache/maven/plugin/eclipse/TempEclipseWorkspace.java (added)
+++ maven/plugins/branches/MECLIPSE-344/src/test/java/org/apache/maven/plugin/eclipse/TempEclipseWorkspace.java Sun Jan 27 16:47:47 2008
@@ -0,0 +1,78 @@
+package org.apache.maven.plugin.eclipse;
+
+import java.io.DataOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.util.Properties;
+
+import org.eclipse.core.internal.localstore.ILocalStoreConstants;
+
+public class TempEclipseWorkspace
+{
+
+ File workspaceLocation;
+
+ public TempEclipseWorkspace( String testWorkspaceName, boolean usePathToProject )
+ throws Exception
+ {
+
+ File eclipseLocation = new java.io.File( "target/test-classes/eclipse" ).getCanonicalFile();
+
+ File jdkLocation = new File( eclipseLocation, "dummyJDK" );
+
+ workspaceLocation = new File( eclipseLocation, testWorkspaceName + "/workspace" ).getCanonicalFile();
+
+ File localizedIndicator = new File( workspaceLocation, ".localized" );
+ if ( !localizedIndicator.exists() )
+ {
+ File propertyfile =
+ new File( workspaceLocation,
+ ".metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.launching.prefs" );
+
+ preparePropertyFile( jdkLocation, propertyfile );
+
+ String projectLocation;
+ if ( usePathToProject )
+ {
+ projectLocation = "URI//file:" + ( new File( workspaceLocation, "direct-compile" ).getCanonicalPath() );
+ }
+ else
+ {
+ projectLocation = "";
+ }
+ FileOutputStream location =
+ new FileOutputStream(
+ new File( workspaceLocation,
+ ".metadata/.plugins/org.eclipse.core.resources/.projects/direct-compile/.location" ) );
+ DataOutputStream dataOutputStream = new DataOutputStream( location );
+ dataOutputStream.write( ILocalStoreConstants.BEGIN_CHUNK );
+ dataOutputStream.writeUTF( projectLocation );
+ dataOutputStream.write( ILocalStoreConstants.END_CHUNK );
+ dataOutputStream.close();
+ location.close();
+ localizedIndicator.createNewFile();
+ }
+
+ }
+
+ private static void preparePropertyFile( File jdkLocation, File propertyfile )
+ throws IOException, FileNotFoundException
+ {
+ Properties properties = new Properties();
+ properties.load( new FileInputStream( propertyfile ) );
+ properties.setProperty(
+ "org.eclipse.jdt.launching.PREF_VM_XML",
+ properties.getProperty( "org.eclipse.jdt.launching.PREF_VM_XML" ).replaceAll(
+ "__replace_with_test_dir__",
+ jdkLocation.getCanonicalPath() ) );
+ properties.store( new FileOutputStream( propertyfile ), "" );
+ }
+
+ public File getWorkspaceLocation()
+ {
+ return workspaceLocation;
+ }
+}
Propchange: maven/plugins/branches/MECLIPSE-344/src/test/java/org/apache/maven/plugin/eclipse/TempEclipseWorkspace.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/plugins/branches/MECLIPSE-344/src/test/java/org/apache/maven/plugin/eclipse/TempEclipseWorkspace.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: maven/plugins/branches/MECLIPSE-344/src/test/resources/eclipse/dummyJDK/1.3.1/jre/lib/rt.jar
URL: http://svn.apache.org/viewvc/maven/plugins/branches/MECLIPSE-344/src/test/resources/eclipse/dummyJDK/1.3.1/jre/lib/rt.jar?rev=615684&view=auto
==============================================================================
Binary file - no diff available.
Propchange: maven/plugins/branches/MECLIPSE-344/src/test/resources/eclipse/dummyJDK/1.3.1/jre/lib/rt.jar
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: maven/plugins/branches/MECLIPSE-344/src/test/resources/eclipse/dummyJDK/1.3/jre/lib/rt.jar
URL: http://svn.apache.org/viewvc/maven/plugins/branches/MECLIPSE-344/src/test/resources/eclipse/dummyJDK/1.3/jre/lib/rt.jar?rev=615684&view=auto
==============================================================================
Binary file - no diff available.
Propchange: maven/plugins/branches/MECLIPSE-344/src/test/resources/eclipse/dummyJDK/1.3/jre/lib/rt.jar
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: maven/plugins/branches/MECLIPSE-344/src/test/resources/eclipse/dummyJDK/1.4.2/jre/lib/rt.jar
URL: http://svn.apache.org/viewvc/maven/plugins/branches/MECLIPSE-344/src/test/resources/eclipse/dummyJDK/1.4.2/jre/lib/rt.jar?rev=615684&view=auto
==============================================================================
Binary file - no diff available.
Propchange: maven/plugins/branches/MECLIPSE-344/src/test/resources/eclipse/dummyJDK/1.4.2/jre/lib/rt.jar
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: maven/plugins/branches/MECLIPSE-344/src/test/resources/eclipse/dummyJDK/1.4/jre/lib/rt.jar
URL: http://svn.apache.org/viewvc/maven/plugins/branches/MECLIPSE-344/src/test/resources/eclipse/dummyJDK/1.4/jre/lib/rt.jar?rev=615684&view=auto
==============================================================================
Binary file - no diff available.
Propchange: maven/plugins/branches/MECLIPSE-344/src/test/resources/eclipse/dummyJDK/1.4/jre/lib/rt.jar
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: maven/plugins/branches/MECLIPSE-344/src/test/resources/eclipse/dummyJDK/1.5.0/jre/lib/rt.jar
URL: http://svn.apache.org/viewvc/maven/plugins/branches/MECLIPSE-344/src/test/resources/eclipse/dummyJDK/1.5.0/jre/lib/rt.jar?rev=615684&view=auto
==============================================================================
Binary file - no diff available.
Propchange: maven/plugins/branches/MECLIPSE-344/src/test/resources/eclipse/dummyJDK/1.5.0/jre/lib/rt.jar
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: maven/plugins/branches/MECLIPSE-344/src/test/resources/eclipse/dummyJDK/1.5/jre/lib/rt.jar
URL: http://svn.apache.org/viewvc/maven/plugins/branches/MECLIPSE-344/src/test/resources/eclipse/dummyJDK/1.5/jre/lib/rt.jar?rev=615684&view=auto
==============================================================================
Binary file - no diff available.
Propchange: maven/plugins/branches/MECLIPSE-344/src/test/resources/eclipse/dummyJDK/1.5/jre/lib/rt.jar
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: maven/plugins/branches/MECLIPSE-344/src/test/resources/eclipse/eclipseWithDefault13/workspace/.metadata/.plugins/org.eclipse.core.resources/.projects/direct-compile/.location
URL: http://svn.apache.org/viewvc/maven/plugins/branches/MECLIPSE-344/src/test/resources/eclipse/eclipseWithDefault13/workspace/.metadata/.plugins/org.eclipse.core.resources/.projects/direct-compile/.location?rev=615684&view=auto
==============================================================================
Binary file - no diff available.
Propchange: maven/plugins/branches/MECLIPSE-344/src/test/resources/eclipse/eclipseWithDefault13/workspace/.metadata/.plugins/org.eclipse.core.resources/.projects/direct-compile/.location
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: maven/plugins/branches/MECLIPSE-344/src/test/resources/eclipse/eclipseWithDefault15/workspace/.metadata/.plugins/org.eclipse.core.resources/.projects/direct-compile/.location
URL: http://svn.apache.org/viewvc/maven/plugins/branches/MECLIPSE-344/src/test/resources/eclipse/eclipseWithDefault15/workspace/.metadata/.plugins/org.eclipse.core.resources/.projects/direct-compile/.location?rev=615684&view=auto
==============================================================================
Binary file - no diff available.
Propchange: maven/plugins/branches/MECLIPSE-344/src/test/resources/eclipse/eclipseWithDefault15/workspace/.metadata/.plugins/org.eclipse.core.resources/.projects/direct-compile/.location
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: maven/plugins/branches/MECLIPSE-344/src/test/resources/eclipse/rad7WithDefault14/workspace/.metadata/.plugins/org.eclipse.core.resources/.projects/direct-compile/.location
URL: http://svn.apache.org/viewvc/maven/plugins/branches/MECLIPSE-344/src/test/resources/eclipse/rad7WithDefault14/workspace/.metadata/.plugins/org.eclipse.core.resources/.projects/direct-compile/.location?rev=615684&view=auto
==============================================================================
Binary file - no diff available.
Propchange: maven/plugins/branches/MECLIPSE-344/src/test/resources/eclipse/rad7WithDefault14/workspace/.metadata/.plugins/org.eclipse.core.resources/.projects/direct-compile/.location
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream