You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by ji...@codehaus.org on 2005/01/10 10:28:31 UTC
[jira] Commented: (MPECLIPSE-60) Downloading source zips
The following comment has been added to this issue:
Author: Krystian Nowak
Created: Mon, 10 Jan 2005 4:26 AM
Body:
to http://jira.codehaus.org/browse/MPECLIPSE-60#action_28273 (by Stephane Nicoll)
OK. EJB could be included. In my project I just didn't use any EJB dependencies. Conclusion - GOOD IDEA.
---------------------------------------------------------------------
View this comment:
http://jira.codehaus.org/browse/MPECLIPSE-60?page=comments#action_28797
---------------------------------------------------------------------
View the issue:
http://jira.codehaus.org/browse/MPECLIPSE-60
Here is an overview of the issue:
---------------------------------------------------------------------
Key: MPECLIPSE-60
Summary: Downloading source zips
Type: New Feature
Status: Unassigned
Priority: Major
Original Estimate: 30 minutes
Time Spent: Unknown
Remaining: 30 minutes
Project: maven-eclipse-plugin
Fix Fors:
1.9
Versions:
1.9
Assignee:
Reporter: Krystian Nowak
Created: Mon, 6 Dec 2004 3:18 AM
Updated: Mon, 10 Jan 2005 4:26 AM
Description:
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>
---------------------------------------------------------------------
JIRA INFORMATION:
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
If you want more information on JIRA, or have a bug to report 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