You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by "Stephane Nicoll (JIRA)" <ji...@codehaus.org> on 2006/01/08 10:20:04 UTC
[jira] Updated: (MPECLIPSE-60) Downloading source zips
[ http://jira.codehaus.org/browse/MPECLIPSE-60?page=all ]
Stephane Nicoll updated MPECLIPSE-60:
-------------------------------------
Fix Version: 1.10
> Downloading source zips
> -----------------------
>
> Key: MPECLIPSE-60
> URL: http://jira.codehaus.org/browse/MPECLIPSE-60
> Project: maven-eclipse-plugin
> Type: New Feature
> Versions: 1.9
> Reporter: Krystian Nowak
> Assignee: Stephane Nicoll
> Fix For: 1.10
> Attachments: plugin.jelly.patch
>
> Original Estimate: 30 minutes
> Remaining: 30 minutes
>
> I've attached plugin.jelly for maven-eclipse-plugin downloading sources from ${repo}/${groupId}/src/${artifactId}-${version}.zip and installing it as ${maven.repo.local}/${groupId}/src/${artifactId}-${version}.zip.
> It does it for all jar dependencies having eclipse.source property set to true. Example project.xml:
> (...)
> <dependencies>
> <dependency>
> <groupId>junit</groupId>
> <artifactId>junit</artifactId>
> <version>3.8.1</version>
> <url>http://www.junit.org/</url>
> <properties>
> <eclipse.source>true</eclipse.source>
> </properties>
> </dependency>
> </dependencies>
> (...)
> What you have to do now is to call "maven eclipse" and refresh your project in Eclipse.
> And here is the code of plugin.jelly - a patch made in Eclipse:
> Index: plugin.jelly
> ===================================================================
> RCS file: /home/cvspublic/maven-plugins/eclipse/plugin.jelly,v
> retrieving revision 1.31
> diff -u -r1.31 plugin.jelly
> --- plugin.jelly 16 Nov 2004 10:48:15 -0000 1.31
> +++ plugin.jelly 6 Dec 2004 08:10:33 -0000
> @@ -78,7 +78,8 @@
> <!-- Generate Eclipse .classpath file -->
> <!--==================================================================-->
> <goal name="eclipse:generate-classpath"
> - description="Generate Eclipse .classpath file">
> + description="Generate Eclipse .classpath file"
> + prereqs="eclipse:sources:download">
>
> <ant:echo>Creating ${basedir}/.classpath ...</ant:echo>
> <j:file name="${basedir}/.classpath" prettyPrint="true" outputMode="xml" xmlns="dummy">
> @@ -263,5 +264,73 @@
>
> <ant:echo>Cleaned up eclipse generated files</ant:echo>
> </goal>
> +
> +
> +
> + <!--==================================================================-->
> + <!-- Download project dependency sources -->
> + <!--==================================================================-->
> +
> + <goal name="eclipse:sources:download">
> + <j:forEach var="depItem" items="${pom.getDependencies()}">
> + <j:if test="${depItem.getType().equalsIgnoreCase('jar')}">
> + <j:if test="${depItem.getProperty('eclipse.source') == 'true'}">
> + <j:set var="groupId" value="${depItem.getGroupId()}"/>
> + <j:set var="artifactId" value="${depItem.getArtifactId()}"/>
> + <j:set var="version" value="${depItem.getVersion()}"/>
> + <attainGoal name="eclipse:source:download"/>
> + <j:remove var="groupId"/>
> + <j:remove var="artifactId"/>
> + <j:remove var="version"/>
> + </j:if>
> + </j:if>
> + </j:forEach>
> + </goal>
> +
> +
> + <!--==================================================================-->
> + <!-- Download single source -->
> + <!--==================================================================-->
> +
> + <goal name="eclipse:source:download">
> + <!--
> + param: groupId
> + param: artifactId
> + param: version
> + -->
> + <echo>Checking sources for ${groupId}:${artifactId} ver.${version}</echo>
> + <util:file var="localSrcFile" name="${maven.repo.local}/${groupId}/src/${artifactId}-${version}.zip" />
> + <j:if test="${!localSrcFile.exists()}">
> + <mkdir dir="${maven.repo.local}/${groupId}/src" />
> + <j:set var="repoList">${maven.repo.remote}</j:set>
> + <util:tokenize var="repos" delim=",">${repoList.trim()}</util:tokenize>
> + <j:forEach var="repo" items="${repos}">
> + <echo>repo is '${repo}'</echo>
> + <j:set var="remoteFile" value="${repo}/${groupId}/src/${artifactId}-${version}.zip" />
> + <echo>trying to download ${remoteFile}</echo>
> + <j:catch var="ex">
> + <j:invokeStatic var="dummy" method="getFile" className="org.apache.maven.util.HttpUtils">
> + <j:arg type="java.lang.String" value="${remoteFile}" />
> + <j:arg type="java.io.File" value="${localSrcFile}"/>
> + <j:arg type="boolean" value="false"/>
> + <j:arg type="boolean" value="true"/>
> + <j:arg type="java.lang.String" value="${maven.proxy.host}" />
> + <j:arg type="java.lang.String" value="${maven.proxy.port}" />
> + <j:arg type="java.lang.String" value="${maven.proxy.username}" />
> + <j:arg type="java.lang.String" value="${maven.proxy.password}" />
> + <j:arg type="boolean" value="false"/>
> + </j:invokeStatic>
> + </j:catch>
> + <j:remove var="remoteFile"/>
> + <j:break test="${localSrcFile.exists()}"/>
> + </j:forEach>
> + <j:if test="${!localSrcFile.exists()}">
> + <echo>WARN: Could not download sources for ${groupId}:${artifactId} ver.${version}</echo>
> + </j:if>
> + <j:remove var="repoList"/>
> + </j:if>
> + <j:remove var="localSrcFile"/>
> + </goal>
> +
>
> </project>
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org