Update to the latest maven-eclipse-plugin 2.6

git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@761364 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
rfeng 2009-04-02 18:16:21 +00:00
parent f7d2e6147b
commit be3f03e319
8 changed files with 951 additions and 528 deletions

View file

@ -156,7 +156,7 @@
<artifactId>maven-plugin-api</artifactId>
<version>2.0.8</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-project</artifactId>
@ -168,44 +168,44 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-settings</artifactId>
<version>2.0.8</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-artifact</artifactId>
<version>2.0.8</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-model</artifactId>
<version>2.0.8</version>
</dependency>
<dependency>
<groupId>org.apache.maven.shared</groupId>
<artifactId>maven-dependency-tree</artifactId>
<version>1.1</version>
</dependency>
</dependency>
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.5.1</version>
<version>2.6</version>
</dependency>
<dependency>
<groupId>org.eclipse</groupId>
<artifactId>osgi</artifactId>
<version>3.3.0-v20070530</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>

View file

@ -20,7 +20,6 @@ package org.apache.tuscany.maven.plugin.eclipse;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
@ -30,7 +29,6 @@ import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
import java.util.TreeSet;
import java.util.jar.Attributes;
@ -52,8 +50,10 @@ import org.apache.maven.artifact.resolver.ResolutionNode;
import org.apache.maven.artifact.resolver.WarningResolutionListener;
import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
import org.apache.maven.artifact.resolver.filter.ExcludesArtifactFilter;
import org.apache.maven.artifact.versioning.ArtifactVersion;
import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException;
import org.apache.maven.artifact.versioning.VersionRange;
import org.apache.maven.execution.RuntimeInformation;
import org.apache.maven.model.Dependency;
import org.apache.maven.model.DependencyManagement;
import org.apache.maven.model.Exclusion;
@ -61,18 +61,18 @@ import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugin.eclipse.Constants;
import org.apache.maven.plugin.eclipse.Messages;
import org.apache.maven.plugin.ide.IdeDependency;
import org.apache.maven.plugin.ide.IdeUtils;
import org.apache.maven.project.MavenProject;
import org.codehaus.plexus.logging.LogEnabled;
import org.codehaus.plexus.logging.Logger;
import org.codehaus.plexus.util.IOUtil;
/**
* Abstract base plugin which takes care of the common stuff usually needed by maven IDE plugins. A plugin extending
* AbstractIdeSupportMojo should implement the <code>setup()</code> and <code>writeConfiguration()</code> methods,
* plus the getters needed to get the various configuration flags and required components. The lifecycle:
*
* AbstractIdeSupportMojo should implement the <code>setup()</code> and <code>writeConfiguration()</code> methods, plus
* the getters needed to get the various configuration flags and required components. The lifecycle:
*
* <pre>
* *** calls setup() where you can configure your specific stuff and stop the mojo from execute if appropriate ***
* - manually resolve project dependencies, NOT failing if a dependency is missing
@ -81,9 +81,9 @@ import org.codehaus.plexus.util.IOUtil;
* *** calls writeConfiguration(), passing the list of resolved referenced dependencies ***
* - report the list of missing sources or just tell how to turn this feature on if the flag was disabled
* </pre>
*
*
* @author Fabrizio Giustina
* @version $Id: AbstractIdeSupportMojo.java 628794 2008-02-18 16:09:11Z aheritier $
* @version $Id: AbstractIdeSupportMojo.java 727620 2008-12-18 02:35:18Z baerrach $
*/
public abstract class AbstractIdeSupportMojo
extends AbstractMojo
@ -94,24 +94,23 @@ public abstract class AbstractIdeSupportMojo
* Additionally it copies all libraries to a project local directory and references them instead of referencing the
* files in the local Maven repository. It also ensured that the "Bundle-Classpath" in META-INF/MANIFEST.MF is
* synchronized.
*
*
* @parameter expression="${eclipse.pde}" default-value="true"
*/
protected boolean pde;
/**
* The project whose project files to create.
*
*
* @parameter expression="${project}"
* @required
* @readonly
*/
protected MavenProject project;
// [rfeng] Change it to use the current project
/**
* The currently executed project (can be a reactor project).
*
*
* @parameter expression="${executedProject}"
* @readonly
*/
@ -119,14 +118,14 @@ public abstract class AbstractIdeSupportMojo
/**
* The project packaging.
*
*
* @parameter expression="${project.packaging}"
*/
protected String packaging;
/**
* Artifact factory, needed to download source jars for inclusion in classpath.
*
*
* @component role="org.apache.maven.artifact.factory.ArtifactFactory"
* @required
* @readonly
@ -135,7 +134,7 @@ public abstract class AbstractIdeSupportMojo
/**
* Artifact resolver, needed to download source jars for inclusion in classpath.
*
*
* @component role="org.apache.maven.artifact.resolver.ArtifactResolver"
* @required
* @readonly
@ -144,7 +143,7 @@ public abstract class AbstractIdeSupportMojo
/**
* Artifact collector, needed to resolve dependencies.
*
*
* @component role="org.apache.maven.artifact.resolver.ArtifactCollector"
* @required
* @readonly
@ -156,9 +155,16 @@ public abstract class AbstractIdeSupportMojo
*/
protected ArtifactMetadataSource artifactMetadataSource;
/**
* The runtime information for Maven, used to retrieve Maven's version number.
*
* @component
*/
private RuntimeInformation runtimeInformation;
/**
* Remote repositories which will be searched for source attachments.
*
*
* @parameter expression="${project.remoteArtifactRepositories}"
* @required
* @readonly
@ -167,7 +173,7 @@ public abstract class AbstractIdeSupportMojo
/**
* Local maven repository.
*
*
* @parameter expression="${localRepository}"
* @required
* @readonly
@ -176,7 +182,7 @@ public abstract class AbstractIdeSupportMojo
/**
* If the executed project is a reactor project, this will contains the full list of projects in the reactor.
*
*
* @parameter expression="${reactorProjects}"
* @required
* @readonly
@ -185,7 +191,7 @@ public abstract class AbstractIdeSupportMojo
/**
* Skip the operation when true.
*
*
* @parameter expression="${eclipse.skip}" default-value="false"
*/
private boolean skip;
@ -193,9 +199,9 @@ public abstract class AbstractIdeSupportMojo
/**
* Enables/disables the downloading of source attachments. Defaults to false. When this flag is <code>true</code>
* remote repositories are checked for sources: in order to avoid repeated check for unavailable source archives, a
* status cache is mantained into the target dir of the root project. Run <code>mvn:clean</code> or delete the
* file <code>mvn-eclipse-cache.properties</code> in order to reset this cache.
*
* status cache is mantained. To reset this cache run <code>mvn eclipse:remove-cache</code>, or use the
* <code>forceRecheck</code> option.
*
* @parameter expression="${downloadSources}"
*/
protected boolean downloadSources;
@ -203,13 +209,23 @@ public abstract class AbstractIdeSupportMojo
/**
* Enables/disables the downloading of javadoc attachments. Defaults to false. When this flag is <code>true</code>
* remote repositories are checked for javadocs: in order to avoid repeated check for unavailable javadoc archives,
* a status cache is mantained into the target dir of the root project. Run <code>mvn:clean</code> or delete the
* file <code>mvn-eclipse-cache.properties</code> in order to reset this cache.
*
* a status cache is mantained. To reset this cache run <code>mvn eclipse:remove-cache</code>, or use the
* <code>forceRecheck</code> option.
*
* @parameter expression="${downloadJavadocs}"
*/
protected boolean downloadJavadocs;
/**
* Enables/disables the rechecking of the remote repository for downloading source/javadoc attachments. Defaults to
* false. When this flag is <code>true</code> and the source or javadoc attachment has a status cache to indicate
* that it is not available, then the remote repository will be rechecked for a source or javadoc attachment and the
* status cache updated to reflect the new state.
*
* @parameter expression="${forceRecheck}"
*/
protected boolean forceRecheck;
/**
* Plexus logger needed for debugging manual artifact resolution.
*/
@ -217,7 +233,7 @@ public abstract class AbstractIdeSupportMojo
/**
* Getter for <code>artifactMetadataSource</code>.
*
*
* @return Returns the artifactMetadataSource.
*/
public ArtifactMetadataSource getArtifactMetadataSource()
@ -227,7 +243,7 @@ public abstract class AbstractIdeSupportMojo
/**
* Setter for <code>artifactMetadataSource</code>.
*
*
* @param artifactMetadataSource The artifactMetadataSource to set.
*/
public void setArtifactMetadataSource( ArtifactMetadataSource artifactMetadataSource )
@ -237,7 +253,7 @@ public abstract class AbstractIdeSupportMojo
/**
* Getter for <code>project</code>.
*
*
* @return Returns the project.
*/
public MavenProject getProject()
@ -247,7 +263,7 @@ public abstract class AbstractIdeSupportMojo
/**
* Setter for <code>project</code>.
*
*
* @param project The project to set.
*/
public void setProject( MavenProject project )
@ -257,7 +273,7 @@ public abstract class AbstractIdeSupportMojo
/**
* Getter for <code>reactorProjects</code>.
*
*
* @return Returns the reactorProjects.
*/
public List getReactorProjects()
@ -267,7 +283,7 @@ public abstract class AbstractIdeSupportMojo
/**
* Setter for <code>reactorProjects</code>.
*
*
* @param reactorProjects The reactorProjects to set.
*/
public void setReactorProjects( List reactorProjects )
@ -277,7 +293,7 @@ public abstract class AbstractIdeSupportMojo
/**
* Getter for <code>remoteArtifactRepositories</code>.
*
*
* @return Returns the remoteArtifactRepositories.
*/
public List getRemoteArtifactRepositories()
@ -287,7 +303,7 @@ public abstract class AbstractIdeSupportMojo
/**
* Setter for <code>remoteArtifactRepositories</code>.
*
*
* @param remoteArtifactRepositories The remoteArtifactRepositories to set.
*/
public void setRemoteArtifactRepositories( List remoteArtifactRepositories )
@ -297,7 +313,7 @@ public abstract class AbstractIdeSupportMojo
/**
* Getter for <code>artifactFactory</code>.
*
*
* @return Returns the artifactFactory.
*/
public ArtifactFactory getArtifactFactory()
@ -307,7 +323,7 @@ public abstract class AbstractIdeSupportMojo
/**
* Setter for <code>artifactFactory</code>.
*
*
* @param artifactFactory The artifactFactory to set.
*/
public void setArtifactFactory( ArtifactFactory artifactFactory )
@ -317,7 +333,7 @@ public abstract class AbstractIdeSupportMojo
/**
* Getter for <code>artifactResolver</code>.
*
*
* @return Returns the artifactResolver.
*/
public ArtifactResolver getArtifactResolver()
@ -327,7 +343,7 @@ public abstract class AbstractIdeSupportMojo
/**
* Setter for <code>artifactResolver</code>.
*
*
* @param artifactResolver The artifactResolver to set.
*/
public void setArtifactResolver( ArtifactResolver artifactResolver )
@ -337,7 +353,7 @@ public abstract class AbstractIdeSupportMojo
/**
* Getter for <code>executedProject</code>.
*
*
* @return Returns the executedProject.
*/
public MavenProject getExecutedProject()
@ -347,7 +363,7 @@ public abstract class AbstractIdeSupportMojo
/**
* Setter for <code>executedProject</code>.
*
*
* @param executedProject The executedProject to set.
*/
public void setExecutedProject( MavenProject executedProject )
@ -357,7 +373,7 @@ public abstract class AbstractIdeSupportMojo
/**
* Getter for <code>localRepository</code>.
*
*
* @return Returns the localRepository.
*/
public ArtifactRepository getLocalRepository()
@ -367,7 +383,7 @@ public abstract class AbstractIdeSupportMojo
/**
* Setter for <code>localRepository</code>.
*
*
* @param localRepository The localRepository to set.
*/
public void setLocalRepository( ArtifactRepository localRepository )
@ -377,7 +393,7 @@ public abstract class AbstractIdeSupportMojo
/**
* Getter for <code>downloadJavadocs</code>.
*
*
* @return Returns the downloadJavadocs.
*/
public boolean getDownloadJavadocs()
@ -387,8 +403,8 @@ public abstract class AbstractIdeSupportMojo
/**
* Setter for <code>downloadJavadocs</code>.
*
* @param downloadJavadocs The downloadJavadocs to set.
*
* @param downloadJavadoc The downloadJavadocs to set.
*/
public void setDownloadJavadocs( boolean downloadJavadoc )
{
@ -397,7 +413,7 @@ public abstract class AbstractIdeSupportMojo
/**
* Getter for <code>downloadSources</code>.
*
*
* @return Returns the downloadSources.
*/
public boolean getDownloadSources()
@ -407,7 +423,7 @@ public abstract class AbstractIdeSupportMojo
/**
* Setter for <code>downloadSources</code>.
*
*
* @param downloadSources The downloadSources to set.
*/
public void setDownloadSources( boolean downloadSources )
@ -428,14 +444,14 @@ public abstract class AbstractIdeSupportMojo
/**
* return <code>false</code> if projects available in a reactor build should be considered normal dependencies,
* <code>true</code> if referenced project will be linked and not need artifact resolution.
*
*
* @return <code>true</code> if referenced project will be linked and not need artifact resolution
*/
protected abstract boolean getUseProjectReferences();
/**
* Hook for preparation steps before the actual plugin execution.
*
*
* @return <code>true</code> if execution should continue or <code>false</code> if not.
* @throws MojoExecutionException generic mojo exception
*/
@ -444,7 +460,7 @@ public abstract class AbstractIdeSupportMojo
/**
* Main plugin method where dependencies should be processed in order to generate IDE configuration files.
*
*
* @param deps list of <code>IdeDependency</code> objects, with artifacts, sources and javadocs already resolved
* @throws MojoExecutionException generic mojo exception
*/
@ -513,7 +529,7 @@ public abstract class AbstractIdeSupportMojo
* Resolve project dependencies. Manual resolution is needed in order to avoid resolution of multiproject artifacts
* (if projects will be linked each other an installed jar is not needed) and to avoid a failure when a jar is
* missing.
*
*
* @throws MojoExecutionException if dependencies can't be resolved
* @return resolved IDE dependencies, with attached jars for non-reactor dependencies
*/
@ -561,7 +577,7 @@ public abstract class AbstractIdeSupportMojo
{
getLog().debug( e.getMessage(), e );
getLog().error(
Messages.getString( "artifactresolution", new Object[] { //$NON-NLS-1$
Messages.getString( "AbstractIdeSupportMojo.artifactresolution", new Object[] { //$NON-NLS-1$
e.getGroupId(), e.getArtifactId(), e.getVersion(),
e.getMessage() } ) );
@ -592,7 +608,7 @@ public abstract class AbstractIdeSupportMojo
{
getLog().debug( e.getMessage(), e );
getLog().warn(
Messages.getString( "artifactdownload", new Object[] { //$NON-NLS-1$
Messages.getString( "AbstractIdeSupportMojo.artifactdownload", new Object[] { //$NON-NLS-1$
e.getGroupId(), e.getArtifactId(), e.getVersion(),
e.getMessage() } ) );
}
@ -600,7 +616,7 @@ public abstract class AbstractIdeSupportMojo
{
getLog().debug( e.getMessage(), e );
getLog().warn(
Messages.getString( "artifactresolution", new Object[] { //$NON-NLS-1$
Messages.getString( "AbstractIdeSupportMojo.artifactresolution", new Object[] { //$NON-NLS-1$
e.getGroupId(), e.getArtifactId(), e.getVersion(),
e.getMessage() } ) );
}
@ -617,9 +633,9 @@ public abstract class AbstractIdeSupportMojo
}
}
if ( includeArtifact &&
( !( getUseProjectReferences() && isAvailableAsAReactorProject( art ) ) || emittedReactorProjectId.add( art.getGroupId() +
'-' + art.getArtifactId() ) ) )
if ( includeArtifact
&& ( !( getUseProjectReferences() && isAvailableAsAReactorProject( art ) ) || emittedReactorProjectId.add( art.getGroupId()
+ '-' + art.getArtifactId() ) ) )
{
// the following doesn't work: art.getArtifactHandler().getPackaging() always returns "jar"
@ -715,7 +731,7 @@ public abstract class AbstractIdeSupportMojo
/**
* Find the name of the project as used in eclipse.
*
*
* @param artifact The artifact to find the eclipse name for.
* @return The name os the eclipse project.
*/
@ -724,7 +740,7 @@ public abstract class AbstractIdeSupportMojo
/**
* Returns the list of project artifacts. Also artifacts generated from referenced projects will be added, but with
* the <code>resolved</code> property set to true.
*
*
* @return list of projects artifacts
* @throws MojoExecutionException if unable to parse dependency versions
*/
@ -749,7 +765,7 @@ public abstract class AbstractIdeSupportMojo
{
throw new MojoExecutionException(
Messages.getString(
"unabletoparseversion", new Object[] { //$NON-NLS-1$
"AbstractIdeSupportMojo.unabletoparseversion", new Object[] { //$NON-NLS-1$
dependency.getArtifactId(),
dependency.getVersion(),
dependency.getManagementKey(), e.getMessage() } ),
@ -797,37 +813,47 @@ public abstract class AbstractIdeSupportMojo
/**
* Utility method that locates a project producing the given artifact.
*
*
* @param artifact the artifact a project should produce.
* @return <code>true</code> if the artifact is produced by a reactor projectart.
*/
protected boolean isAvailableAsAReactorProject( Artifact artifact )
{
return getReactorProject( artifact ) != null;
}
/**
* Checks the list of reactor projects to see if the artifact is included.
*
* @param artifact the artifact to check if it is in the reactor
* @return the reactor project or null if it is not in the reactor
*/
protected MavenProject getReactorProject( Artifact artifact ) {
if ( reactorProjects != null )
{
for ( Iterator iter = reactorProjects.iterator(); iter.hasNext(); )
{
MavenProject reactorProject = (MavenProject) iter.next();
if ( reactorProject.getGroupId().equals( artifact.getGroupId() ) &&
reactorProject.getArtifactId().equals( artifact.getArtifactId() ) )
if ( reactorProject.getGroupId().equals( artifact.getGroupId() )
&& reactorProject.getArtifactId().equals( artifact.getArtifactId() ) )
{
if ( reactorProject.getVersion().equals( artifact.getVersion() ) )
{
return true;
return reactorProject;
}
else
{
getLog().info(
"Artifact " +
artifact.getId() +
" already available as a reactor project, but with different version. Expected: " +
artifact.getVersion() + ", found: " + reactorProject.getVersion() );
"Artifact "
+ artifact.getId()
+ " already available as a reactor project, but with different version. Expected: "
+ artifact.getVersion() + ", found: " + reactorProject.getVersion() );
}
}
}
}
return false;
return null;
}
/**
@ -861,7 +887,7 @@ public abstract class AbstractIdeSupportMojo
}
catch ( InvalidVersionSpecificationException e )
{
throw new MojoExecutionException( Messages.getString( "unabletoparseversion", new Object[] { //$NON-NLS-1$
throw new MojoExecutionException( Messages.getString( "AbstractIdeSupportMojo.unabletoparseversion", new Object[] { //$NON-NLS-1$
projectId, d.getVersion(),
d.getManagementKey(), e.getMessage() } ),
e );
@ -875,105 +901,36 @@ public abstract class AbstractIdeSupportMojo
return map;
}
/**
* Find the reactor target dir. executedProject doesn't have the multiproject root dir set, and the only way to
* extract it is iterating on parent projects.
*
* @param prj current project
* @return the parent target dir.
*/
private File getReactorTargetDir( MavenProject prj )
{
if ( prj.getParent() != null )
{
if ( prj.getParent().getBasedir() != null && prj.getParent().getBasedir().exists() )
{
return getReactorTargetDir( prj.getParent() );
}
}
return new File( prj.getBuild().getDirectory() );
}
/**
* Resolve source artifacts and download them if <code>downloadSources</code> is <code>true</code>. Source and
* javadocs artifacts will be attached to the <code>IdeDependency</code> Resolve source and javadoc artifacts. The
* resolved artifacts will be downloaded based on the <code>downloadSources</code> and
* <code>downloadJavadocs</code> attributes. Source and
*
* resolved artifacts will be downloaded based on the <code>downloadSources</code> and <code>downloadJavadocs</code>
* attributes. Source and
*
* @param deps resolved dependencies
*/
private void resolveSourceAndJavadocArtifacts( IdeDependency[] deps )
{
File reactorTargetDir = getReactorTargetDir( project );
File unavailableArtifactsTmpFile = new File( reactorTargetDir, "mvn-eclipse-cache.properties" );
getLog().info( "Using source status cache: " + unavailableArtifactsTmpFile.getAbsolutePath() );
// create target dir if missing
if ( !unavailableArtifactsTmpFile.getParentFile().exists() )
{
unavailableArtifactsTmpFile.getParentFile().mkdirs();
}
Properties unavailableArtifactsCache = new Properties();
if ( unavailableArtifactsTmpFile.exists() )
{
InputStream is = null;
try
{
is = new FileInputStream( unavailableArtifactsTmpFile );
unavailableArtifactsCache.load( is );
}
catch ( IOException e )
{
getLog().warn( "Unable to read source status for reactor projects" );
}
finally
{
IOUtil.close( is );
}
}
final List missingSources =
resolveDependenciesWithClassifier( deps, "sources", getDownloadSources(), unavailableArtifactsCache );
resolveDependenciesWithClassifier( deps, "sources", getDownloadSources() );
missingSourceDependencies.addAll( missingSources );
final List missingJavadocs =
resolveDependenciesWithClassifier( deps, "javadoc", getDownloadJavadocs(), unavailableArtifactsCache );
resolveDependenciesWithClassifier( deps, "javadoc", getDownloadJavadocs() );
missingJavadocDependencies.addAll( missingJavadocs );
FileOutputStream fos = null;
try
{
fos = new FileOutputStream( unavailableArtifactsTmpFile );
unavailableArtifactsCache.store( fos, "Temporary index for unavailable sources and javadocs" );
}
catch ( IOException e )
{
getLog().warn( "Unable to cache source status for reactor projects" );
}
finally
{
IOUtil.close( fos );
}
}
/**
* Resolve the required artifacts for each of the dependency. <code>sources</code> or <code>javadoc</code>
* artifacts (depending on the <code>classifier</code>) are attached to the dependency.
*
* Resolve the required artifacts for each of the dependency. <code>sources</code> or <code>javadoc</code> artifacts
* (depending on the <code>classifier</code>) are attached to the dependency.
*
* @param deps resolved dependencies
* @param inClassifier the classifier we are looking for (either <code>sources</code> or <code>javadoc</code>)
* @param includeRemoteRepositories flag whether we should search remote repositories for the artifacts or not
* @param unavailableArtifactsCache cache of unavailable artifacts
* @return the list of dependencies for which the required artifact was not found
*/
private List resolveDependenciesWithClassifier( IdeDependency[] deps, String inClassifier,
boolean includeRemoteRepositories,
Properties unavailableArtifactsCache )
boolean includeRemoteRepositories )
{
List missingClassifierDependencies = new ArrayList();
@ -994,21 +951,37 @@ public abstract class AbstractIdeSupportMojo
if ( getLog().isDebugEnabled() )
{
getLog().debug(
"Searching for sources for " + dependency.getId() + ":" + dependency.getClassifier() +
" at " + dependency.getId() + ":" + inClassifier );
"Searching for sources for " + dependency.getId() + ":" + dependency.getClassifier()
+ " at " + dependency.getId() + ":" + inClassifier );
}
String key =
dependency.getClassifier() == null ? dependency.getId() + ":" + inClassifier : dependency.getId() +
":" + inClassifier + ":" + dependency.getClassifier();
Artifact baseArtifact =
artifactFactory.createArtifactWithClassifier( dependency.getGroupId(), dependency.getArtifactId(),
dependency.getVersion(), dependency.getType(),
dependency.getClassifier() );
baseArtifact =
IdeUtils.resolveArtifact( artifactResolver, baseArtifact, remoteRepos, localRepository, getLog() );
if (!baseArtifact.isResolved()) {
// base artifact does not exist - no point checking for javadoc/sources
continue;
}
if ( !unavailableArtifactsCache.containsKey( key ) )
Artifact artifact =
IdeUtils.createArtifactWithClassifier( dependency.getGroupId(), dependency.getArtifactId(),
dependency.getVersion(), dependency.getClassifier(),
inClassifier, artifactFactory );
File notAvailableMarkerFile = IdeUtils.getNotAvailableMarkerFile( localRepository, artifact );
if (forceRecheck && notAvailableMarkerFile.exists()) {
if (!notAvailableMarkerFile.delete()) {
getLog().warn( Messages.getString( "AbstractIdeSupportMojo.unabletodeletenotavailablemarkerfile", notAvailableMarkerFile ) );
}
}
if ( !notAvailableMarkerFile.exists() )
{
Artifact artifact =
IdeUtils.resolveArtifactWithClassifier( dependency.getGroupId(), dependency.getArtifactId(),
dependency.getVersion(), dependency.getClassifier(),
inClassifier, localRepository, artifactResolver,
artifactFactory, remoteRepos, getLog() );
artifact =
IdeUtils.resolveArtifact( artifactResolver, artifact, remoteRepos, localRepository, getLog() );
if ( artifact.isResolved() )
{
if ( "sources".equals( inClassifier ) )
@ -1022,7 +995,19 @@ public abstract class AbstractIdeSupportMojo
}
else
{
unavailableArtifactsCache.put( key, Boolean.TRUE.toString() );
if ( includeRemoteRepositories )
{
try
{
notAvailableMarkerFile.createNewFile();
getLog().debug( Messages.getString( "AbstractIdeSupportMojo.creatednotavailablemarkerfile", notAvailableMarkerFile ) );
}
catch ( IOException e )
{
getLog().warn( Messages.getString( "AbstractIdeSupportMojo.failedtocreatenotavailablemarkerfile",
notAvailableMarkerFile ) );
}
}
// add the dependencies to the list
// of those lacking the required
// artifact
@ -1048,17 +1033,17 @@ public abstract class AbstractIdeSupportMojo
{
if ( getDownloadSources() )
{
msg.append( Messages.getString( "sourcesnotavailable" ) ); //$NON-NLS-1$
msg.append( Messages.getString( "AbstractIdeSupportMojo.sourcesnotavailable" ) ); //$NON-NLS-1$
}
else
{
msg.append( Messages.getString( "sourcesnotdownloaded" ) ); //$NON-NLS-1$
msg.append( Messages.getString( "AbstractIdeSupportMojo.sourcesnotdownloaded" ) ); //$NON-NLS-1$
}
for ( Iterator it = missingSourceDependencies.iterator(); it.hasNext(); )
{
IdeDependency art = (IdeDependency) it.next();
msg.append( Messages.getString( "sourcesmissingitem", art.getId() ) ); //$NON-NLS-1$
msg.append( Messages.getString( "AbstractIdeSupportMojo.sourcesmissingitem", art.getId() ) ); //$NON-NLS-1$
}
msg.append( "\n" ); //$NON-NLS-1$
}
@ -1067,17 +1052,17 @@ public abstract class AbstractIdeSupportMojo
{
if ( getDownloadJavadocs() )
{
msg.append( Messages.getString( "javadocnotavailable" ) ); //$NON-NLS-1$
msg.append( Messages.getString( "AbstractIdeSupportMojo.javadocnotavailable" ) ); //$NON-NLS-1$
}
else
{
msg.append( Messages.getString( "javadocnotdownloaded" ) ); //$NON-NLS-1$
msg.append( Messages.getString( "AbstractIdeSupportMojo.javadocnotdownloaded" ) ); //$NON-NLS-1$
}
for ( Iterator it = missingJavadocDependencies.iterator(); it.hasNext(); )
{
IdeDependency art = (IdeDependency) it.next();
msg.append( Messages.getString( "javadocmissingitem", art.getId() ) ); //$NON-NLS-1$
msg.append( Messages.getString( "AbstractIdeSupportMojo.javadocmissingitem", art.getId() ) ); //$NON-NLS-1$
}
msg.append( "\n" ); //$NON-NLS-1$
}
@ -1092,7 +1077,7 @@ public abstract class AbstractIdeSupportMojo
/**
* Checks if jar has to be resolved for the given artifact
*
*
* @param art the artifact to check
* @return true if resolution should happen
*/
@ -1103,7 +1088,7 @@ public abstract class AbstractIdeSupportMojo
/**
* Checks if a projects reference has to be used for the given artifact
*
*
* @param art the artifact to check
* @return true if a project reference has to be used.
*/
@ -1111,7 +1096,29 @@ public abstract class AbstractIdeSupportMojo
{
return getUseProjectReferences() && isAvailableAsAReactorProject( art );
}
/**
* Checks whether the currently running Maven satisfies the specified version (range).
*
* @param version The version range to test for, must not be <code>null</code>.
* @return <code>true</code> if the current Maven version matches the specified version range, <code>false</code>
* otherwise.
*/
protected boolean isMavenVersion( String version )
{
try
{
VersionRange versionRange = VersionRange.createFromVersionSpec( version );
ArtifactVersion mavenVersion = runtimeInformation.getApplicationVersion();
return versionRange.containsVersion( mavenVersion );
}
catch ( InvalidVersionSpecificationException e )
{
throw new IllegalArgumentException( e.getMessage() );
}
}
// [rfeng]
protected boolean isOSGiBundle() {
File base = project.getBasedir();
File mf = new File(base, "META-INF/MANIFEST.MF");
@ -1133,4 +1140,5 @@ public abstract class AbstractIdeSupportMojo
}
return false;
}
}

View file

@ -32,9 +32,13 @@ import java.util.Map;
import java.util.Set;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.eclipse.BuildCommand;
import org.apache.maven.plugin.eclipse.Constants;
import org.apache.maven.plugin.eclipse.EclipseSourceDir;
import org.apache.maven.plugin.eclipse.Messages;
import org.apache.maven.plugin.eclipse.writers.AbstractEclipseWriter;
import org.apache.maven.plugin.eclipse.writers.EclipseAntExternalLaunchConfigurationWriter;
import org.apache.maven.plugin.eclipse.writers.EclipseLaunchConfigurationWriter;
import org.apache.maven.plugin.ide.IdeDependency;
import org.apache.maven.plugin.ide.IdeUtils;
import org.codehaus.plexus.util.IOUtil;
@ -44,20 +48,50 @@ import org.codehaus.plexus.util.xml.XMLWriter;
/**
* Writes eclipse .classpath file.
*
*
* @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
* @author <a href="mailto:kenney@neonics.com">Kenney Westerhof</a>
* @author <a href="mailto:fgiust@apache.org">Fabrizio Giustina</a>
* @version $Id: EclipseClasspathWriter.java 636955 2008-03-14 02:10:42Z aheritier $
* @version $Id: EclipseClasspathWriter.java 750073 2009-03-04 16:55:01Z aheritier $
*/
public class EclipseClasspathWriter
extends AbstractEclipseWriter
{
/**
*
*/
private static final String ORG_ECLIPSE_AJDT_INPATH = "org.eclipse.ajdt.inpath";
/**
*
*/
private static final String ORG_ECLIPSE_AJDT_ASPECTPATH = "org.eclipse.ajdt.aspectpath";
/**
*
*/
private static final String NAME = "name";
/**
*
*/
private static final String VALUE = "value";
/**
*
*/
private static final String ATTRIBUTE = "attribute";
/**
*
*/
private static final String ATTRIBUTES = "attributes";
/**
* Eclipse build path variable M2_REPO
*/
private static final String M2_REPO = "M2_REPO"; //$NON-NLS-1$
protected static final String M2_REPO = "M2_REPO"; //$NON-NLS-1$
/**
* Attribute for sourcepath.
@ -120,7 +154,7 @@ public class EclipseClasspathWriter
private static final String FILE_DOT_CLASSPATH = ".classpath"; //$NON-NLS-1$
/**
* @see org.apache.tuscany.sca.maven.plugin.eclipse.writers.EclipseWriter#write()
* @see org.apache.maven.plugin.eclipse.writers.EclipseWriter#write()
*/
public void write()
throws MojoExecutionException
@ -175,8 +209,8 @@ public class EclipseClasspathWriter
{
EclipseSourceDir dir = config.getSourceDirs()[j];
log.debug( "Processing " + ( dir.isResource() ? "re" : "" ) + "source " + dir.getPath() + ": output=" +
dir.getOutput() + "; default output=" + defaultOutput );
log.debug( "Processing " + ( dir.isResource() ? "re" : "" ) + "source " + dir.getPath() + ": output="
+ dir.getOutput() + "; default output=" + defaultOutput );
boolean isSpecial = false;
@ -187,8 +221,7 @@ public class EclipseClasspathWriter
// and if the default output has any sources that copy there.
if ( dir.getOutput() != null // resource output dir is set
&&
!dir.getOutput().equals( defaultOutput ) // output dir is not default target/classes
&& !dir.getOutput().equals( defaultOutput ) // output dir is not default target/classes
&& dir.getOutput().startsWith( defaultOutput ) // ... but is nested
&& byOutputDir.get( defaultOutput ) != null // ???
&& !( (List) byOutputDir.get( defaultOutput ) ).isEmpty() // ???
@ -197,8 +230,8 @@ public class EclipseClasspathWriter
// do not specify as source since the output will be nested. Instead, mark
// it as a todo, and handle it with a custom build.xml file later.
log.debug( "Marking as special to prevent output folder nesting: " + dir.getPath() + " (output=" +
dir.getOutput() + ")" );
log.debug( "Marking as special to prevent output folder nesting: " + dir.getPath() + " (output="
+ dir.getOutput() + ")" );
isSpecial = true;
specialSources.add( dir );
@ -215,9 +248,18 @@ public class EclipseClasspathWriter
writer.addAttribute( ATTR_OUTPUT, dir.getOutput() );
}
if ( StringUtils.isNotEmpty( dir.getInclude() ) )
String includes = dir.getInclude();
if ( !dir.isResource() )
{
writer.addAttribute( ATTR_INCLUDING, dir.getInclude() );
// automatically include java files only: eclipse doesn't have the concept of a source only directory so it
// will try to include non-java files found in maven source dirs
includes = StringUtils.isEmpty( includes ) ? "**/*.java" : includes + "|**/*.java";
}
if ( StringUtils.isNotEmpty( includes ) )
{
writer.addAttribute( ATTR_INCLUDING, includes );
}
String excludes = dir.getExclude();
@ -255,12 +297,12 @@ public class EclipseClasspathWriter
buildXmlPrinter.addAttribute( "default", "copy-resources" );
buildXmlPrinter.startElement( "target" );
buildXmlPrinter.addAttribute( "name", "init" );
buildXmlPrinter.addAttribute( NAME, "init" );
// initialize filtering tokens here
buildXmlPrinter.endElement();
buildXmlPrinter.startElement( "target" );
buildXmlPrinter.addAttribute( "name", "copy-resources" );
buildXmlPrinter.addAttribute( NAME, "copy-resources" );
buildXmlPrinter.addAttribute( "depends", "init" );
for ( Iterator it = specialSources.iterator(); it.hasNext(); )
@ -295,8 +337,8 @@ public class EclipseClasspathWriter
}
catch ( IOException e )
{
throw new MojoExecutionException( "Cannot create " + config.getEclipseProjectDirectory() +
"/maven-eclipse.xml", e );
throw new MojoExecutionException( "Cannot create " + config.getEclipseProjectDirectory()
+ "/maven-eclipse.xml", e );
}
log.info( "Creating external launcher file" );
@ -310,9 +352,9 @@ public class EclipseClasspathWriter
new BuildCommand(
"org.eclipse.ui.externaltools.ExternalToolBuilder",
"LaunchConfigHandle",
"<project>/" +
EclipseLaunchConfigurationWriter.FILE_DOT_EXTERNAL_TOOL_BUILDERS +
"Maven_Ant_Builder.launch" ) );
"<project>/"
+ EclipseLaunchConfigurationWriter.FILE_DOT_EXTERNAL_TOOL_BUILDERS
+ "Maven_Ant_Builder.launch" ) );
}
*/
@ -325,6 +367,47 @@ public class EclipseClasspathWriter
writer.addAttribute( ATTR_PATH, defaultOutput );
writer.endElement();
Set addedDependencies = new HashSet();
// TODO if (..magic property equals orderDependencies..)
// ----------------------------------------------------------------------
// Java API dependencies that may complete the classpath container so must
// be declared BEFORE so that container access rules don't fail
// ----------------------------------------------------------------------
IdeDependency[] depsToWrite = config.getDepsOrdered();
for ( int j = 0; j < depsToWrite.length; j++ )
{
IdeDependency dep = depsToWrite[j];
if ( dep.isJavaApi() )
{
String depId = getDependencyId( dep );
if ( !addedDependencies.contains( depId ) )
{
addDependency( writer, dep );
addedDependencies.add( depId );
}
}
}
// ----------------------------------------------------------------------
// The dependencies
// ----------------------------------------------------------------------
for ( int j = 0; j < depsToWrite.length; j++ )
{
IdeDependency dep = depsToWrite[j];
if ( dep.isAddedToClasspath() )
{
String depId = getDependencyId( dep );
/* avoid duplicates in the classpath for artifacts with different types (like ejbs or test-jars) */
if ( !addedDependencies.contains( depId ) )
{
addDependency( writer, dep );
addedDependencies.add( depId );
}
}
}
// ----------------------------------------------------------------------
// Container classpath entries
// ----------------------------------------------------------------------
@ -337,35 +420,25 @@ public class EclipseClasspathWriter
writer.endElement(); // name
}
// ----------------------------------------------------------------------
// The dependencies
// ----------------------------------------------------------------------
Set addedDependencies = new HashSet();
// TODO if (..magic property equals orderDependencies..)
IdeDependency[] depsToWrite = config.getDepsOrdered();
for ( int j = 0; j < depsToWrite.length; j++ )
{
IdeDependency dep = depsToWrite[j];
if ( dep.isAddedToClasspath() )
{
String depId =
dep.getGroupId() + ":" + dep.getArtifactId() + ":" + dep.getClassifier() + ":" + dep.getVersion();
/* avoid duplicates in the classpath for artifacts with different types (like ejbs) */
if ( !addedDependencies.contains( depId ) )
{
addDependency( writer, dep );
addedDependencies.add( depId );
}
}
}
writer.endElement();
IOUtil.close( w );
}
private String getDependencyId( IdeDependency dep )
{
String depId =
dep.getGroupId() + ":" + dep.getArtifactId() + ":" + dep.getClassifier() + ":" + dep.getVersion();
if ( dep.isReferencedProject() )
{
// This dependency will be refered as an eclipse project
depId = dep.getEclipseProjectName();
}
return depId;
}
protected void addDependency( XMLWriter writer, IdeDependency dep )
throws MojoExecutionException
{
@ -452,11 +525,10 @@ public class EclipseClasspathWriter
if ( ATTR_VAR.equals( kind ) )
{
sourcepath =
M2_REPO +
"/" //$NON-NLS-1$
+
IdeUtils.toRelativeAndFixSeparator( localRepositoryFile, dep.getSourceAttachment(),
false );
M2_REPO
+ "/" //$NON-NLS-1$
+ IdeUtils.toRelativeAndFixSeparator( localRepositoryFile, dep.getSourceAttachment(),
false );
}
else
{
@ -477,6 +549,12 @@ public class EclipseClasspathWriter
}
// Skip aspectj libraries since they are in the container.
if ( ( config.getAjdtVersion() != 0 ) && dep.getArtifactId().toLowerCase().startsWith( "aspectj" ) )
{
return;
}
writer.startElement( ELT_CLASSPATHENTRY );
writer.addAttribute( ATTR_KIND, kind );
writer.addAttribute( ATTR_PATH, path );
@ -492,30 +570,60 @@ public class EclipseClasspathWriter
{
if ( !attributeElemOpen )
{
writer.startElement( "attributes" ); //$NON-NLS-1$
writer.startElement( ATTRIBUTES ); //$NON-NLS-1$
attributeElemOpen = true;
}
writer.startElement( "attribute" ); //$NON-NLS-1$
writer.addAttribute( "value", "jar:" + new File( javadocpath ).toURI() + "!/" ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
writer.addAttribute( "name", "javadoc_location" ); //$NON-NLS-1$ //$NON-NLS-2$
writer.startElement( ATTRIBUTE ); //$NON-NLS-1$
writer.addAttribute( VALUE, "jar:" + new File( javadocpath ).toURI() + "!/" ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
writer.addAttribute( NAME, "javadoc_location" ); //$NON-NLS-1$ //$NON-NLS-2$
writer.endElement();
}
if ( Constants.PROJECT_PACKAGING_WAR.equals( this.config.getPackaging() ) && config.getWtpapplicationxml() &&
kind.equals( ATTR_VAR ) && !dep.isTestDependency() && !dep.isProvided() &&
!dep.isSystemScopedOutsideProject( this.config.getProject() ) )
if ( Constants.PROJECT_PACKAGING_WAR.equals( this.config.getPackaging() ) && config.getWtpapplicationxml()
&& kind.equals( ATTR_VAR ) && !dep.isTestDependency() && !dep.isProvided()
&& !dep.isSystemScopedOutsideProject( this.config.getProject() ) )
{
if ( !attributeElemOpen )
{
writer.startElement( "attributes" ); //$NON-NLS-1$
writer.startElement( ATTRIBUTES ); //$NON-NLS-1$
attributeElemOpen = true;
}
writer.startElement( "attribute" ); //$NON-NLS-1$
writer.addAttribute( "value", "/WEB-INF/lib" ); //$NON-NLS-1$ //$NON-NLS-2$
writer.addAttribute( "name", "org.eclipse.jst.component.dependency" ); //$NON-NLS-1$ //$NON-NLS-2$
writer.startElement( ATTRIBUTE ); //$NON-NLS-1$
writer.addAttribute( VALUE, "/WEB-INF/lib" ); //$NON-NLS-1$ //$NON-NLS-2$
writer.addAttribute( NAME, "org.eclipse.jst.component.dependency" ); //$NON-NLS-1$ //$NON-NLS-2$
writer.endElement();
}
if ( dep.isAjdtDependency() && ( config.getAjdtVersion() >= 1.5 ) )
{
if ( !attributeElemOpen )
{
writer.startElement( ATTRIBUTES ); //$NON-NLS-1$
attributeElemOpen = true;
}
writer.startElement( ATTRIBUTE ); //$NON-NLS-1$
writer.addAttribute( NAME, ORG_ECLIPSE_AJDT_ASPECTPATH ); //$NON-NLS-1$ //$NON-NLS-2$
writer.addAttribute( VALUE, Boolean.TRUE.toString() ); //$NON-NLS-1$ //$NON-NLS-2$
writer.endElement();
}
if ( dep.isAjdtWeaveDependency() && ( config.getAjdtVersion() >= 1.5 ) )
{
if ( !attributeElemOpen )
{
writer.startElement( ATTRIBUTES ); //$NON-NLS-1$
attributeElemOpen = true;
}
writer.startElement( ATTRIBUTE ); //$NON-NLS-1$
writer.addAttribute( NAME, ORG_ECLIPSE_AJDT_INPATH ); //$NON-NLS-1$ //$NON-NLS-2$
writer.addAttribute( VALUE, Boolean.TRUE.toString() ); //$NON-NLS-1$ //$NON-NLS-2$
writer.endElement();
}

View file

@ -19,17 +19,16 @@
package org.apache.tuscany.maven.plugin.eclipse;
import java.io.File;
import java.io.IOException;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.eclipse.Constants;
import org.apache.maven.plugin.eclipse.EclipseConfigFile;
import org.codehaus.plexus.util.FileUtils;
import org.apache.maven.plugin.ide.IdeUtils;
/**
* Deletes the .project, .classpath, .wtpmodules files and .settings folder used by Eclipse.
*
*
* @goal clean
*/
public class EclipseCleanMojo
@ -76,30 +75,35 @@ public class EclipseCleanMojo
*/
private static final String FILE_ECLIPSE_JDT_CORE_PREFS = ".settings/org.eclipse.jdt.core.prefs"; //$NON-NLS-1$
/**
* AJDT preferences.
*/
private static final String FILE_AJDT_PREFS = ".settings/org.eclipse.ajdt.ui.prefs"; //$NON-NLS-1$
/**
* Packaging for the current project.
*
*
* @parameter expression="${project.packaging}"
*/
private String packaging;
/**
* The root directory of the project
*
*
* @parameter expression="${basedir}"
*/
private File basedir;
/**
* Skip the operation when true.
*
*
* @parameter expression="${eclipse.skip}" default-value="false"
*/
private boolean skip;
/**
* additional generic configuration files for eclipse
*
*
* @parameter
*/
private EclipseConfigFile[] additionalConfig;
@ -128,6 +132,7 @@ public class EclipseCleanMojo
delete( new File( basedir, FILE_DOT_COMPONENT_15 ) );
delete( new File( basedir, FILE_FACET_CORE_XML ) );
delete( new File( basedir, FILE_ECLIPSE_JDT_CORE_PREFS ) );
delete( new File( basedir, FILE_AJDT_PREFS ) );
File settingsDir = new File( basedir, DIR_DOT_SETTINGS );
if ( settingsDir.exists() && settingsDir.isDirectory() && settingsDir.list().length == 0 )
@ -154,47 +159,19 @@ public class EclipseCleanMojo
/**
* Delete a file, handling log messages and exceptions
*
*
* @param f File to be deleted
* @throws MojoExecutionException only if a file exists and can't be deleted
*/
protected void delete( File f )
throws MojoExecutionException
{
if ( f.isDirectory() )
{
getLog().info( Messages.getString( "EclipseCleanMojo.deletingDirectory", f.getName() ) ); //$NON-NLS-1$
}
else
{
getLog().info( Messages.getString( "EclipseCleanMojo.deletingFile", f.getName() ) ); //$NON-NLS-1$
}
if ( f.exists() )
{
if ( !f.delete() )
{
try
{
FileUtils.forceDelete( f );
}
catch ( IOException e )
{
throw new MojoExecutionException( Messages.getString( "EclipseCleanMojo.failedtodelete", //$NON-NLS-1$
new Object[] { f.getName(),
f.getAbsolutePath() } ) );
}
}
}
else
{
getLog().debug( Messages.getString( "EclipseCleanMojo.nofilefound", f.getName() ) ); //$NON-NLS-1$
}
IdeUtils.delete( f, getLog() );
}
/**
* Getter for <code>basedir</code>.
*
*
* @return Returns the basedir.
*/
public File getBasedir()
@ -204,7 +181,7 @@ public class EclipseCleanMojo
/**
* Setter for <code>basedir</code>.
*
*
* @param basedir The basedir to set.
*/
public void setBasedir( File basedir )

View file

@ -26,6 +26,7 @@ import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.Reader;
import java.io.Writer;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.List;
@ -34,6 +35,7 @@ import java.util.Set;
import org.apache.maven.model.Resource;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.eclipse.BuildCommand;
import org.apache.maven.plugin.eclipse.Messages;
import org.apache.maven.plugin.eclipse.writers.AbstractEclipseWriter;
import org.apache.maven.plugin.ide.IdeDependency;
import org.apache.maven.plugin.ide.IdeUtils;
@ -46,11 +48,11 @@ import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
/**
* Writes eclipse .project file.
*
*
* @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
* @author <a href="mailto:kenney@neonics.com">Kenney Westerhof</a>
* @author <a href="mailto:fgiust@apache.org">Fabrizio Giustina</a>
* @version $Id: EclipseProjectWriter.java 616816 2008-01-30 17:23:08Z aheritier $
* @version $Id: EclipseProjectWriter.java 728546 2008-12-21 22:56:51Z bentmann $
*/
public class EclipseProjectWriter
extends AbstractEclipseWriter
@ -187,14 +189,18 @@ public class EclipseProjectWriter
// referenced projects should not be added for plugins
if ( !config.isPde() )
{
List duplicates = new ArrayList();
for ( int j = 0; j < config.getDepsOrdered().length; j++ )
{
IdeDependency dep = config.getDepsOrdered()[j];
if ( dep.isReferencedProject() )
// Avoid duplicates entries when same project is refered using multiple types
// (ejb, test-jar ...)
if ( dep.isReferencedProject() && !duplicates.contains( dep.getEclipseProjectName() ) )
{
writer.startElement( "project" ); //$NON-NLS-1$
writer.writeText( dep.getEclipseProjectName() );
writer.endElement();
duplicates.add( dep.getEclipseProjectName() );
}
}
}

View file

@ -24,7 +24,7 @@ import java.util.ResourceBundle;
/**
* @author <a href="mailto:fgiust@users.sourceforge.net">Fabrizio Giustina</a>
* @version $Id: Messages.java 485864 2006-12-11 20:41:36Z fgiust $
* @version $Id: Messages.java 728546 2008-12-21 22:56:51Z bentmann $
*/
public class Messages
{

View file

@ -1,55 +1,32 @@
#
#
# 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.
#
#
EclipsePlugin.missingpom=There must be a POM in the current working directory for the Eclipse plugin to work.
EclipsePlugin.pompackaging=Not running eclipse plugin goal for pom project
EclipsePlugin.notadir=Not a directory: "{0}"
EclipsePlugin.cantcreatedir=Can''t create directory "{0}"
EclipsePlugin.cantcreatedir=Can't create directory "{0}"
EclipsePlugin.erroropeningfile=Exception while opening file.
EclipsePlugin.cantwritetofile=Unable to write to file: {0}
EclipsePlugin.cantfindresource=Unable to resolve resource location: {0}
EclipsePlugin.cantreadfile=Unable to read file: {0}
EclipsePlugin.keepexisting=File {0} already exists.\n Additional settings will be preserved, run mvn eclipse:clean if you want old settings to be removed.
EclipsePlugin.cantparseexisting=Unable to parse existing file: {0}. Settings will not be preserved.
EclipsePlugin.cantresolvesources=Cannot resolve source artifact. Artifact id: {0} (Message: {1})
EclipsePlugin.wrote=Wrote Eclipse project for "{0}" to {1}.
EclipsePlugin.missingelement=Missing element from the project descriptor: "{0}"
EclipsePlugin.includenotsupported=This plugin currently doesn't support include patterns for resources. Adding the entire directory.
EclipsePlugin.excludenotsupported=This plugin currently doesn't support exclude patterns for resources. Adding the entire directory.
EclipsePlugin.artifactpathisnull=The artifact path was null. Artifact id: {0}
EclipsePlugin.artifactissystemscoped=The artifact has scope ''system''. Artifact id: {0}. System path: {1}
EclipsePlugin.artifactissystemscoped=The artifact has scope 'system'. Artifact id: {0}. System path: {1}
EclipsePlugin.unsupportedwtp=Unsupported WTP version: {0}. This plugin currently supports only the following versions: {1}.
EclipsePlugin.wtpversion=Adding support for WTP version {0}.
EclipsePlugin.missingjrecontainer=You did specify a list of classpath containers without the base org.eclipse.jdt.launching.JRE_CONTAINER.\n If you specify custom classpath containers you should also add org.eclipse.jdt.launching.JRE_CONTAINER to the list
EclipsePlugin.deprecatedpar=Plugin parameter "{0}" is deprecated, please use "{1}"
EclipsePlugin.cantcopyartifact=Can''t copy artifact "{0}".
EclipsePlugin.foundadir={0} is a directory, ignoring.
EclipsePlugin.workspace=Using Eclipse Workspace: {0}
EclipsePlugin.cantcanonicalize=Can't canonicalize system path: {0}
EclipsePlugin.unchangedmanifest=Not writing Manifest file as it is unchanged: {0}
EclipsePlugin.invalidvminworkspace=Workspace defines a VM that does not contain a valid jre/lib/rt.jar: {0}
EclipseSettingsWriter.wrotesettings=Wrote settings to {0}
EclipseSettingsWriter.cannotcreatesettings=Cannot create settings file
EclipseSettingsWriter.errorwritingsettings=Error writing settings file
EclipseSettingsWriter.usingdefaults=Not writing settings - defaults suffice
EclipseClasspathWriter.lookingforsources=Looking for source archive for artifact {0}
EclipseClasspathWriter.sourcesavailable=Sources attachment for artifact {0} set to {1}
EclipseProjectWriter.notafile=Not adding a file link to {0}; it is not a file
EclipseCleanMojo.failedtodelete=Failed to delete {0} file: {0}
@ -57,22 +34,48 @@ EclipseCleanMojo.nofilefound=No {0} file found
EclipseCleanMojo.deletingFile=Deleting file: {0}
EclipseCleanMojo.deletingDirectory=Deleting directory: {0}
EclipseOSGiManifestWriter.nomanifestfile=The references manifest file doesn''t exist, plugin dependencies will not be updated: {0}
IdeDependency.cantreadfile=Unable to read file: {0}
EclipseOSGiManifestWriter.nomanifestfile=The references manifest file doesn't exist, plugin dependencies will not be updated: {0}
Rad6LibCopier.cantdeletefile=Failed to delete file: {0}
MyEclipseSpringBeansWriter.springVersionNotFound=Spring must be declared in the project's dependencies to generate .springBeans file.
MyEclipseSpringBeansWriter.baseDirDoesNotExist=The (basedir) path declared in the project's dependencies doesn't exist: {0}
sourcesnotavailable=\n Sources for some artifacts are not available.\n List of artifacts without a source archive:
sourcesnotdownloaded=\n Sources for some artifacts are not available.\n Please run the same goal with the -DdownloadSources=true parameter in order to check remote repositories for sources.\n List of artifacts without a source archive:
sourcesmissingitem=\n o {0}
javadocnotavailable=\n Javadoc for some artifacts is not available.\n List of artifacts without a javadoc archive:
javadocnotdownloaded=\n Javadoc for some artifacts is not available.\n Please run the same goal with the -DdownloadJavadocs=true parameter in order to check remote repositories for javadoc.\n List of artifacts without a javadoc archive:
javadocmissingitem=\n o {0}
errorresolving=Error resolving {0} artifact. Artifact id: {1} (Message: {2})
artifactresolution=An error occurred during dependency resolution of the following artifact:\n {0}:{1}:{2}\nCaused by: {3}
artifactdownload=An error occurred during dependency resolution.\n Failed to retrieve {0}:{1}-{2}\nCaused by: {3}
cantcanonicalize=Can''t canonicalize system path: {0}
unabletoparseversion={0}: unable to parse version ''{1}'' for dependency ''{2}'': {3}
EclipseToMavenMojo.eclipseDirectoryPrompt=Eclipse directory?
EclipseToMavenMojo.errorreadingfromstandardinput=Unable to read from standard input
EclipseToMavenMojo.directoydoesnotexist=Directory {0} doesn't exists
EclipseToMavenMojo.plugindirectorydoesnotexist=Plugin directory {0} doesn't exists
EclipseToMavenMojo.remoterepositorydeployto=Will deploy artifacts to remote repository {0}
EclipseToMavenMojo.processingfile=Processing file {0}
EclipseToMavenMojo.processingplugin=Processing {0} of {1}
EclipseToMavenMojo.skippingfile=Skipping file {0}
EclipseToMavenMojo.unabletoresolveversionrange=Unable to resolve version range for dependency {0} in project {1}
EclipseToMavenMojo.unabletoaccessjar=Unable to access jar {0}
EclipseToMavenMojo.plugindoesnothavemanifest=Plugin {0} does not have a manifest; skipping..
EclipseToMavenMojo.unabletoreadbundlefrommanifest=Unable to read bundle name/version from manifest, skipping...
EclipseToMavenMojo.errorprocessingplugin=Error processing plugin {0}
EclipseToMavenMojo.errorwritingtemporarypom=Error writing temporary pom file: {0}
EclipseToMavenMojo.errordeployartifacttorepository=Unable to deploy artifact to repository.
EclipseToMavenMojo.errorinstallartifacttorepository=Unable to install artifact to repository.
EclipseToMavenMojo.errorgettingjarfileforplugin=Error getting the jar file for plugin {0}
EclipseToMavenMojo.invalidsyntaxforrepository=Invalid syntax for repository.
EclipseToMavenMojo.invalidremoterepositorysyntax=Invalid syntax for remote repository. Use "id::layout::url".
EclipseToMavenMojo.cannotfindrepositorylayout=Cannot find repository layout: {0}
EclipseToMavenMojo.missingversionforbundle=Missing version for bundle {0}, assuming any version > 0
AbstractIdeSupportMojo.sourcesnotavailable=\n Sources for some artifacts are not available.\n List of artifacts without a source archive:
AbstractIdeSupportMojo.sourcesnotdownloaded=\n Sources for some artifacts are not available.\n Please run the same goal with the -DdownloadSources=true parameter in order to check remote repositories for sources.\n List of artifacts without a source archive:
AbstractIdeSupportMojo.sourcesmissingitem=\n o {0}
AbstractIdeSupportMojo.javadocnotavailable=\n Javadoc for some artifacts is not available.\n List of artifacts without a javadoc archive:
AbstractIdeSupportMojo.javadocnotdownloaded=\n Javadoc for some artifacts is not available.\n Please run the same goal with the -DdownloadJavadocs=true parameter in order to check remote repositories for javadoc.\n List of artifacts without a javadoc archive:
AbstractIdeSupportMojo.javadocmissingitem=\n o {0}
AbstractIdeSupportMojo.artifactresolution=An error occurred during dependency resolution of the following artifact:\n {0}:{1}:{2}\nCaused by: {3}
AbstractIdeSupportMojo.artifactdownload=An error occurred during dependency resolution.\n Failed to retrieve {0}:{1}-{2}\nCaused by: {3}
AbstractIdeSupportMojo.unabletoparseversion={0}: unable to parse version '{1}' for dependency '{2}': {3}
AbstractIdeSupportMojo.failedtocreatenotavailablemarkerfile=Error creating not available file {0}
AbstractIdeSupportMojo.creatednotavailablemarkerfile=Not available marker file created: {0}
AbstractIdeSupportMojo.unabletodeletenotavailablemarkerfile=Unable to delete marker file: {0}
IdeUtils.errorresolving=Error resolving {0} artifact. Artifact id: {1} (Message: {2})
RemoveCacheMojo.checking=Checking cache for not available markers
RemoveCacheMojo.complete=Done