[MPECLIPSE-123] Javadocs archives are now downloaded from the configured remote repositories, when no source archive is available.
Submitted by: Nicolas de Loof git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@432959 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
1 parent
b24de9b74a
commit
af66f640a5
7 files changed
+368
-267
No files matched your search
+36
-27
@@ -23,7 +23,11 @@
|
||||
<define:jellybean
|
||||
name="download-sources"
|
||||
className="org.apache.maven.plugin.eclipse.JavaSourcesDownloader"
|
||||
method="downloadJavaSources"/>
|
||||
method="downloadSources"/>
|
||||
<define:jellybean
|
||||
name="download-javadocs"
|
||||
className="org.apache.maven.plugin.eclipse.JavadocsDownloader"
|
||||
method="downloadSources"/>
|
||||
|
||||
<define:tag name="write-classpath-entry">
|
||||
<maven:param-check value="${groupId}" fail="true" message="'groupId' must be specified" />
|
||||
@@ -66,37 +70,42 @@
|
||||
<j:otherwise>
|
||||
<j:set var="mappedsrc" value="${groupId}/java-sources/${artifactId}-${version}-sources.jar" />
|
||||
<util:file var="srcFile" name="${maven.repo.local}/${mappedsrc}" />
|
||||
<j:if test="${!srcFile.exists()}">
|
||||
<j:set var="msg" trim="true">
|
||||
Place java sources for ${artifactId} at ${srcFile} for javadoc and debugging support in Eclipse
|
||||
</j:set>
|
||||
<ant:echo>${msg}</ant:echo>
|
||||
</j:if>
|
||||
</j:otherwise>
|
||||
</j:choose>
|
||||
<j:set var="jdocs" value="${groupId}/javadoc.jars/${artifactId}-${version}.javadoc.jar" />
|
||||
<util:file var="testFile" name="${maven.repo.local}/${mappedsrc}" />
|
||||
|
||||
<!-- If the source file exists, add it to the project, otherwise attempt to
|
||||
download the Javadocs if maven.eclipse.javadoc.download is true -->
|
||||
<j:choose>
|
||||
<j:when test="${testFile.exists()}">
|
||||
<classpathentry kind="var" path="MAVEN_REPO/${relativePath}" sourcepath="MAVEN_REPO/${mappedsrc}"/>
|
||||
</j:when>
|
||||
|
||||
<!-- Dont define sourcepath unless it actually exists -->
|
||||
<!-- otherwise will cause errors in Eclipse (3.2 in my case) when clicking on Class/line numbers in stack traces in console -->
|
||||
|
||||
<j:otherwise>
|
||||
<classpathentry kind="var" path="MAVEN_REPO/${relativePath}"/>
|
||||
</j:otherwise>
|
||||
<j:when test="${srcFile.exists()}">
|
||||
<classpathentry kind="var" path="MAVEN_REPO/${relativePath}" sourcepath="MAVEN_REPO/${mappedsrc}"/>
|
||||
<j:set var="msg" trim="true">
|
||||
Java sources for ${artifactId} at ${srcFile} configured for javadoc and debugging support in Eclipse
|
||||
</j:set>
|
||||
<ant:echo>${msg}</ant:echo>
|
||||
</j:when>
|
||||
<j:otherwise>
|
||||
<classpathentry kind="var" path="MAVEN_REPO/${relativePath}">
|
||||
<j:set var="jdocs" value="${groupId}/javadoc.jars/${artifactId}-${version}-javadoc.jar" />
|
||||
<j:if test="${maven.eclipse.javadoc.download}">
|
||||
<eclipse:download-javadocs
|
||||
project="${pom}"
|
||||
groupId="${groupId}"
|
||||
artifactId="${artifactId}"
|
||||
version="${version}"/>
|
||||
</j:if>
|
||||
<util:file var="jdocsFile" name="${maven.repo.local}/${jdocs}" />
|
||||
<j:if test="${jdocsFile.exists()}">
|
||||
<j:set var="msg" trim="true">
|
||||
Javadoc for ${artifactId} at ${jdocsFile} configured in Eclipse
|
||||
</j:set>
|
||||
<ant:echo>${msg}</ant:echo>
|
||||
<attributes>
|
||||
<attribute value="jar:file:/${maven.repo.local}/${jdocs}!/" name="javadoc_location"/>
|
||||
</attributes>
|
||||
</j:if>
|
||||
</classpathentry>
|
||||
</j:otherwise>
|
||||
</j:choose>
|
||||
|
||||
<!-- javadoc need to be an absolute path in eclipse 3.1, the MAVEN_REPO var will not work
|
||||
<attributes>
|
||||
<attribute value="jar:file:/${maven.repo.local}/${jdocs}!/" name="javadoc_location"/>
|
||||
</attributes>
|
||||
-->
|
||||
|
||||
|
||||
</define:tag>
|
||||
</define:taglib>
|
||||
|
||||
|
||||
@@ -28,5 +28,6 @@ maven.eclipse.project.name=${pom.artifactId}
|
||||
maven.gen.src=${maven.build.dir}/generated-sources
|
||||
maven.eclipse.src.extension = zip
|
||||
maven.eclipse.src.download = true
|
||||
maven.eclipse.javadoc.download = true
|
||||
maven.eclipse.resources.addtoclasspath=false
|
||||
maven.eclipse.servletapilist=javax.servlet:servlet-api,servletapi:servletapi,geronimo-spec:geronimo-spec-servlet
|
||||
@@ -0,0 +1,274 @@
|
||||
package org.apache.maven.plugin.eclipse;
|
||||
|
||||
/* ====================================================================
|
||||
* Copyright 2001-2004 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed 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.
|
||||
* ====================================================================
|
||||
*/
|
||||
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.maven.AbstractMavenComponent;
|
||||
import org.apache.maven.project.Dependency;
|
||||
import org.apache.maven.project.Project;
|
||||
import org.apache.maven.util.HttpUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.util.Iterator;
|
||||
|
||||
/**
|
||||
* A base class to download sources achives.
|
||||
*
|
||||
* @author <a href="snicoll@apache.org">Stephane Nicoll</a>
|
||||
*/
|
||||
public abstract class AbstractSourcesDownloader
|
||||
extends AbstractMavenComponent
|
||||
{
|
||||
|
||||
protected static final String PROXY_LOGINHOST = "maven.proxy.ntlm.host";
|
||||
|
||||
protected static final String PROXY_LOGINDOMAIN = "maven.proxy.ntlm.domain";
|
||||
|
||||
private static final Log log = LogFactory.getLog( AbstractSourcesDownloader.class );
|
||||
|
||||
private Project project;
|
||||
|
||||
private String groupId;
|
||||
|
||||
private String artifactId;
|
||||
|
||||
private String version;
|
||||
|
||||
public void downloadSources()
|
||||
throws Exception
|
||||
{
|
||||
if ( project == null )
|
||||
{
|
||||
throw new NullPointerException( "project should be set." );
|
||||
}
|
||||
|
||||
if ( groupId == null )
|
||||
{
|
||||
throw new NullPointerException( "groupId should be set." );
|
||||
}
|
||||
|
||||
if ( artifactId == null )
|
||||
{
|
||||
throw new NullPointerException( "artifactId should be set." );
|
||||
}
|
||||
|
||||
if ( version == null )
|
||||
{
|
||||
throw new NullPointerException( "version should be set." );
|
||||
}
|
||||
|
||||
final String dependencyId = groupId + ":" + artifactId;
|
||||
Dependency dependency = project.getDependency( dependencyId );
|
||||
if ( dependency == null )
|
||||
{
|
||||
log.warn( "Could not retrieve dependency object for[" + dependencyId + "] - skipping" );
|
||||
return;
|
||||
}
|
||||
|
||||
String relativePath = buildRelativePath();
|
||||
File localFile = new File( project.getContext().getMavenRepoLocal(), relativePath );
|
||||
if ( isSnapshot() )
|
||||
{
|
||||
getRemoteArtifact( localFile, relativePath, dependency );
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( localFile.exists() )
|
||||
{
|
||||
log.debug( getSourceName() + " for[" + groupId + ":" + artifactId + ":" + version +
|
||||
"] is available in the local repository." );
|
||||
}
|
||||
else
|
||||
{
|
||||
// download it
|
||||
getRemoteArtifact( localFile, relativePath, dependency );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract String buildRelativePath();
|
||||
|
||||
protected abstract String getSourceName();
|
||||
|
||||
// Getters & Setters
|
||||
|
||||
|
||||
public Project getProject()
|
||||
{
|
||||
return project;
|
||||
}
|
||||
|
||||
public void setProject( final Project project )
|
||||
{
|
||||
this.project = project;
|
||||
}
|
||||
|
||||
public String getGroupId()
|
||||
{
|
||||
return groupId;
|
||||
}
|
||||
|
||||
public void setGroupId( final String groupId )
|
||||
{
|
||||
this.groupId = groupId;
|
||||
}
|
||||
|
||||
public String getArtifactId()
|
||||
{
|
||||
return artifactId;
|
||||
}
|
||||
|
||||
public void setArtifactId( final String artifactId )
|
||||
{
|
||||
this.artifactId = artifactId;
|
||||
}
|
||||
|
||||
public String getVersion()
|
||||
{
|
||||
return version;
|
||||
}
|
||||
|
||||
public void setVersion( final String version )
|
||||
{
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
protected boolean isSnapshot()
|
||||
{
|
||||
return version.endsWith( "SNAPSHOT" );
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve a <code>remoteFile</code> from the maven remote repositories
|
||||
* and store it at <code>destinationFile</code>
|
||||
*
|
||||
* @param destinationFile the destination file in the local repository
|
||||
* @param relativePath the relative path to the dependency
|
||||
* @return true if the retrieval succeeds, false otherwise.
|
||||
*/
|
||||
protected boolean getRemoteArtifact( File destinationFile, String relativePath, Dependency relatedDependency )
|
||||
{
|
||||
|
||||
// The directory structure for the project this dependency belongs to
|
||||
// may not exists so attempt to create the project directory structure
|
||||
// before attempting to download the dependency.
|
||||
File directory = destinationFile.getParentFile();
|
||||
|
||||
if ( !directory.exists() )
|
||||
{
|
||||
directory.mkdirs();
|
||||
}
|
||||
|
||||
log.info( "Attempting to download " + getSourceName() + " for " + relatedDependency.getArtifact() );
|
||||
|
||||
boolean artifactFound = false;
|
||||
|
||||
for ( Iterator i = getProject().getContext().getMavenRepoRemote().iterator(); i.hasNext(); )
|
||||
{
|
||||
String remoteRepo = (String) i.next();
|
||||
|
||||
if ( remoteRepo.endsWith( "/" ) )
|
||||
{
|
||||
remoteRepo = remoteRepo.substring( 0, remoteRepo.length() - 1 );
|
||||
}
|
||||
|
||||
// The username and password parameters are not being
|
||||
// used here. Those are the "" parameters you see below.
|
||||
String url = remoteRepo + "/" + relativePath;
|
||||
url = StringUtils.replace( url, "//", "/" );
|
||||
|
||||
if ( !url.startsWith( "file" ) )
|
||||
{
|
||||
if ( url.startsWith( "https" ) )
|
||||
{
|
||||
url = StringUtils.replace( url, "https:/", "https://" );
|
||||
}
|
||||
else
|
||||
{
|
||||
url = StringUtils.replace( url, "http:/", "http://" );
|
||||
}
|
||||
}
|
||||
log.debug( "Trying to download " + getSourceName() + " at " + url );
|
||||
|
||||
// Attempt to retrieve the artifact and set the checksum if retrieval
|
||||
// of the checksum file was successful.
|
||||
try
|
||||
{
|
||||
String loginHost = (String) getProject().getContext().getVariable( PROXY_LOGINHOST );
|
||||
String loginDomain = (String) getProject().getContext().getVariable( PROXY_LOGINDOMAIN );
|
||||
HttpUtils.getFile( url, destinationFile, false, true, getProject().getContext().getProxyHost(),
|
||||
getProject().getContext().getProxyPort(),
|
||||
getProject().getContext().getProxyUserName(),
|
||||
getProject().getContext().getProxyPassword(), loginHost, loginDomain, true );
|
||||
|
||||
// Artifact was found, continue checking additional remote repos (if any)
|
||||
// in case there is a newer version (i.e. snapshots) in another repo
|
||||
artifactFound = true;
|
||||
|
||||
if ( !isSnapshot() )
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch ( FileNotFoundException e )
|
||||
{
|
||||
// Multiple repositories may exist, and if the file is not found
|
||||
// in just one of them, it's no problem, and we don't want to
|
||||
// even print out an error.
|
||||
// if it's not found at all, artifactFound will be false, and the
|
||||
// build _will_ break, and the user will get an error message
|
||||
log.debug( "File not found on one of the repos", e );
|
||||
}
|
||||
catch ( Exception e )
|
||||
{
|
||||
// If there are additional remote repos, then ignore exception
|
||||
// as artifact may be found in another remote repo. If there
|
||||
// are no more remote repos to check and the artifact wasn't found in
|
||||
// a previous remote repo, then artifactFound is false indicating
|
||||
// that the artifact could not be found in any of the remote repos
|
||||
//
|
||||
// arguably, we need to give the user better control (another command-
|
||||
// line switch perhaps) of what to do in this case? Maven already has
|
||||
// a command-line switch to work in offline mode, but what about when
|
||||
// one of two or more remote repos is unavailable? There may be multiple
|
||||
// remote repos for redundancy, in which case you probably want the build
|
||||
// to continue. There may however be multiple remote repos because some
|
||||
// artifacts are on one, and some are on another. In this case, you may
|
||||
// want the build to break.
|
||||
//
|
||||
// print a warning, in any case, so user catches on to mistyped
|
||||
// hostnames, or other snafus
|
||||
// FIXME: localize this message
|
||||
String[] parsedUrl = HttpUtils.parseUrl( url );
|
||||
log.warn( "Error retrieving artifact from [" + parsedUrl[2] + "]: " + e );
|
||||
if ( parsedUrl[0] != null )
|
||||
{
|
||||
log.debug( "Username was '" + parsedUrl[0] + "', password hidden" );
|
||||
}
|
||||
log.debug( "Error details", e );
|
||||
}
|
||||
}
|
||||
|
||||
return artifactFound;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,18 +1,5 @@
|
||||
package org.apache.maven.plugin.eclipse;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.maven.AbstractMavenComponent;
|
||||
import org.apache.maven.MavenConstants;
|
||||
import org.apache.maven.project.Dependency;
|
||||
import org.apache.maven.project.Project;
|
||||
import org.apache.maven.util.HttpUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.util.Iterator;
|
||||
|
||||
/* ====================================================================
|
||||
* Copyright 2001-2004 The Apache Software Foundation.
|
||||
*
|
||||
@@ -37,241 +24,20 @@ import java.util.Iterator;
|
||||
* @version $Id$
|
||||
*/
|
||||
public class JavaSourcesDownloader
|
||||
extends AbstractMavenComponent
|
||||
extends AbstractSourcesDownloader
|
||||
{
|
||||
private static final String PROXY_LOGINHOST = "maven.proxy.ntlm.host";
|
||||
private static final String PROXY_LOGINDOMAIN = "maven.proxy.ntlm.domain";
|
||||
|
||||
private static final Log log = LogFactory.getLog( JavaSourcesDownloader.class );
|
||||
|
||||
private Project project;
|
||||
|
||||
private String groupId;
|
||||
|
||||
private String artifactId;
|
||||
|
||||
private String version;
|
||||
|
||||
|
||||
public void downloadJavaSources()
|
||||
throws Exception
|
||||
{
|
||||
if (project == null) {
|
||||
throw new NullPointerException("project should be set.");
|
||||
}
|
||||
|
||||
if (groupId == null) {
|
||||
throw new NullPointerException("groupId should be set.");
|
||||
}
|
||||
|
||||
if (artifactId == null) {
|
||||
throw new NullPointerException("artifactId should be set.");
|
||||
}
|
||||
|
||||
if (version == null) {
|
||||
throw new NullPointerException("version should be set.");
|
||||
}
|
||||
|
||||
final String dependencyId = groupId + ":" + artifactId;
|
||||
Dependency dependency = project.getDependency( dependencyId );
|
||||
if ( dependency == null )
|
||||
{
|
||||
log.warn("Could not retrieve dependency object for[" + dependencyId + "] - skipping" );
|
||||
return;
|
||||
}
|
||||
|
||||
String relativePath = buildRelativePath();
|
||||
File localFile = new File( project.getContext().getMavenRepoLocal(), relativePath );
|
||||
if ( isSnapshot() )
|
||||
{
|
||||
getRemoteArtifact( localFile, relativePath, dependency );
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( localFile.exists() )
|
||||
{
|
||||
log.debug( "source for[" + groupId + ":" + artifactId + ":" + version +
|
||||
"] is available in the local repository." );
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
// download it
|
||||
getRemoteArtifact( localFile, relativePath, dependency );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private String buildRelativePath()
|
||||
protected String buildRelativePath()
|
||||
{
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append( groupId ).append( "/java-sources/" ).append( artifactId ).append( "-" ).append( version ).append(
|
||||
"-sources.jar" );
|
||||
sb.append( getGroupId() ).append( "/java-sources/" ).append( getArtifactId() ).append( "-" ).append(
|
||||
getVersion() ).append( "-sources.jar" );
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
private boolean isSnapshot()
|
||||
protected String getSourceName()
|
||||
{
|
||||
return version.endsWith( "SNAPSHOT" );
|
||||
return "sources";
|
||||
}
|
||||
|
||||
// Getters & Setters
|
||||
|
||||
|
||||
public Project getProject()
|
||||
{
|
||||
return project;
|
||||
}
|
||||
|
||||
public void setProject( final Project project )
|
||||
{
|
||||
this.project = project;
|
||||
}
|
||||
|
||||
public String getGroupId()
|
||||
{
|
||||
return groupId;
|
||||
}
|
||||
|
||||
public void setGroupId( final String groupId )
|
||||
{
|
||||
this.groupId = groupId;
|
||||
}
|
||||
|
||||
public String getArtifactId()
|
||||
{
|
||||
return artifactId;
|
||||
}
|
||||
|
||||
public void setArtifactId( final String artifactId )
|
||||
{
|
||||
this.artifactId = artifactId;
|
||||
}
|
||||
|
||||
public String getVersion()
|
||||
{
|
||||
return version;
|
||||
}
|
||||
|
||||
public void setVersion( final String version )
|
||||
{
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
// Taken from maven core code in order to mimic the current behavior
|
||||
|
||||
/**
|
||||
* Retrieve a <code>remoteFile</code> from the maven remote repositories
|
||||
* and store it at <code>destinationFile</code>
|
||||
*
|
||||
* @param destinationFile the destination file in the local repository
|
||||
* @param relativePath the relative path to the dependency
|
||||
* @return true if the retrieval succeeds, false otherwise.
|
||||
*/
|
||||
private boolean getRemoteArtifact( File destinationFile, String relativePath, Dependency relatedDependency )
|
||||
{
|
||||
|
||||
// The directory structure for the project this dependency belongs to
|
||||
// may not exists so attempt to create the project directory structure
|
||||
// before attempting to download the dependency.
|
||||
File directory = destinationFile.getParentFile();
|
||||
|
||||
if ( !directory.exists() )
|
||||
{
|
||||
directory.mkdirs();
|
||||
}
|
||||
|
||||
log.info( "Attempting to download sources for " + relatedDependency.getArtifact());
|
||||
|
||||
boolean artifactFound = false;
|
||||
|
||||
for ( Iterator i = getProject().getContext().getMavenRepoRemote().iterator(); i.hasNext(); )
|
||||
{
|
||||
String remoteRepo = (String) i.next();
|
||||
|
||||
if ( remoteRepo.endsWith( "/" ) )
|
||||
{
|
||||
remoteRepo = remoteRepo.substring( 0, remoteRepo.length() - 1 );
|
||||
}
|
||||
|
||||
// The username and password parameters are not being
|
||||
// used here. Those are the "" parameters you see below.
|
||||
String url = remoteRepo + "/" + relativePath;
|
||||
url = StringUtils.replace( url, "//", "/" );
|
||||
|
||||
if ( !url.startsWith( "file" ) )
|
||||
{
|
||||
if ( url.startsWith( "https" ) )
|
||||
{
|
||||
url = StringUtils.replace( url, "https:/", "https://" );
|
||||
}
|
||||
else
|
||||
{
|
||||
url = StringUtils.replace( url, "http:/", "http://" );
|
||||
}
|
||||
}
|
||||
log.debug("Trying to download source at " + url);
|
||||
|
||||
// Attempt to retrieve the artifact and set the checksum if retrieval
|
||||
// of the checksum file was successful.
|
||||
try
|
||||
{
|
||||
String loginHost = (String) getProject().getContext().getVariable( PROXY_LOGINHOST );
|
||||
String loginDomain = (String) getProject().getContext().getVariable( PROXY_LOGINDOMAIN );
|
||||
HttpUtils.getFile( url, destinationFile, false, true, getProject().getContext().getProxyHost(),
|
||||
getProject().getContext().getProxyPort(),
|
||||
getProject().getContext().getProxyUserName(),
|
||||
getProject().getContext().getProxyPassword(), loginHost, loginDomain, true );
|
||||
|
||||
// Artifact was found, continue checking additional remote repos (if any)
|
||||
// in case there is a newer version (i.e. snapshots) in another repo
|
||||
artifactFound = true;
|
||||
|
||||
if ( !isSnapshot() )
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch ( FileNotFoundException e )
|
||||
{
|
||||
// Multiple repositories may exist, and if the file is not found
|
||||
// in just one of them, it's no problem, and we don't want to
|
||||
// even print out an error.
|
||||
// if it's not found at all, artifactFound will be false, and the
|
||||
// build _will_ break, and the user will get an error message
|
||||
log.debug( "File not found on one of the repos", e );
|
||||
}
|
||||
catch ( Exception e )
|
||||
{
|
||||
// If there are additional remote repos, then ignore exception
|
||||
// as artifact may be found in another remote repo. If there
|
||||
// are no more remote repos to check and the artifact wasn't found in
|
||||
// a previous remote repo, then artifactFound is false indicating
|
||||
// that the artifact could not be found in any of the remote repos
|
||||
//
|
||||
// arguably, we need to give the user better control (another command-
|
||||
// line switch perhaps) of what to do in this case? Maven already has
|
||||
// a command-line switch to work in offline mode, but what about when
|
||||
// one of two or more remote repos is unavailable? There may be multiple
|
||||
// remote repos for redundancy, in which case you probably want the build
|
||||
// to continue. There may however be multiple remote repos because some
|
||||
// artifacts are on one, and some are on another. In this case, you may
|
||||
// want the build to break.
|
||||
//
|
||||
// print a warning, in any case, so user catches on to mistyped
|
||||
// hostnames, or other snafus
|
||||
// FIXME: localize this message
|
||||
String[] parsedUrl = HttpUtils.parseUrl( url );
|
||||
log.warn( "Error retrieving artifact from [" + parsedUrl[2] + "]: " + e );
|
||||
if ( parsedUrl[0] != null )
|
||||
{
|
||||
log.debug( "Username was '" + parsedUrl[0] + "', password hidden" );
|
||||
}
|
||||
log.debug( "Error details", e );
|
||||
}
|
||||
}
|
||||
|
||||
return artifactFound;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package org.apache.maven.plugin.eclipse;
|
||||
|
||||
/* ====================================================================
|
||||
* Copyright 2001-2004 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed 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.
|
||||
* ====================================================================
|
||||
*/
|
||||
|
||||
/**
|
||||
* An helper class used to download javadocs archives.
|
||||
*
|
||||
* @author <a href="ndeloof@free.fr">Nicolas De Loof</a>
|
||||
* @author <a href="snicoll@apache.org">Stephane Nicoll</a>
|
||||
*/
|
||||
public class JavadocsDownloader
|
||||
extends AbstractSourcesDownloader
|
||||
{
|
||||
|
||||
protected String buildRelativePath()
|
||||
{
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append( getGroupId() ).append( "/javadoc.jars/" ).append( getArtifactId() ).append( "-" ).append(
|
||||
getVersion() ).append( "-javadoc.jar" );
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
protected String getSourceName()
|
||||
{
|
||||
return "javadocs";
|
||||
}
|
||||
}
|
||||
@@ -26,6 +26,7 @@
|
||||
<release version="1.11.1-SNAPSHOT" date="In SVN">
|
||||
<action dev="ltheussl" type="update">Update jelly dependency to match the ones in maven 1.1 core.</action>
|
||||
<action dev="aheritier" type="fix" issue="MPECLIPSE-118" due-to="Jon Christiansen">Don't attach sourcepath in .classpath when file doesn't exist.</action>
|
||||
<action dev="snicoll" type="fix" issue="MPECLIPSE-123" due-to="Nicolas De Loof">Download and attach javadoc archives to .classpath when no source archive is available.</action>
|
||||
</release>
|
||||
<release version="1.11" date="2006-06-18">
|
||||
<action dev="snicoll" type="fix" issue="MPECLIPSE-111">Made output and testOutput directory configuration consistent.</action>
|
||||
|
||||
@@ -151,6 +151,14 @@
|
||||
remote repositories. Defaults to true.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>maven.eclipse.javadoc.download</td>
|
||||
<td>Yes (default=<code>true</code>)</td>
|
||||
<td>
|
||||
Specify if javadocs archives need to be downloaded from the configured
|
||||
remote repositories, when no source archive is available. Defaults to true.
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<p>
|
||||
Note that you will need to defined a <code>MAVEN_REPO</code> Java
|
||||
|
||||
Reference in new issue
Block a user