I wanted to follow up with an example of this.  If you wanted to add  
all of the jars for the PDFBox API, this would do it:

(let ((deps (list (jde-maven-dependency nil
                                        :groupid "org.apache.pdfbox"
                                        :artifactid "pdfbox"
                                        :version "1.0.0"
                                        :scope "compile"))))
   (dolist (jar (jde-maven-util-classpath deps))
     (add-to-list 'jde-global-classpath (expand-file-name jar))))))

This does it through beanshell.  Add a `t' after the `deps' to do it  
via the command line with the script I gave below.



On May 9, 2010, at 7:17 PM, Paul Landes wrote:

> I've added new maven dependency support that expands on this idea.
>
> Ideally, I'd like to access the code maven uses for this right from
> beanshell, but I don't have time to find it.  Can someone help out
> with this?
>
> Until we do, I've added a lisp file and a Java file to invoke the
> maven ant task code to build dependencies from:
> - artifact
> - group
> - version
> - scope (i.e. compile)
>
> However, it seems like when there's a POM that doesn't create a .jar
> file, it breaks because it expects this jar file.  Again, this code
> you have seems to get around that.  However, I don't like the length
> of time it takes to invoke (directly by forking a JVM for maven) and I
> don't like how it creates (2) temp files.  In addition, the deletion
> of these files should be in an `unwind-protect' but aren't.
>
> I've added these files to the trunk:
> - java/src/jde/util/MavenUtils.java
> - lisp/jde-maven-util.el
>
> The function jde-maven-util-classpath takes the pom info (as a list of
> container eieio objects) and a boolean as to whether to fork or not
> using the program (in my case script) pomcp, which in turns just
> invokes MavenUtils from the command line.  I don't know a good place
> to put this script in the repository (suggestions?) so I'll just add
> it below:
>
> --------snip
>
> LIB_LOCS="${HOME}/opt/lib /usr/local/lib"
> MVN_REPO=${HOME}/opt/var/maven/repo
> ANT_VERSION="1.7.0"
> JAVA_HOME="/System/Library/Frameworks/JavaVM.framework/Versions/1.6"
>
> uname | grep CYGWIN > /dev/null
> if [ $? = 0 ] ; then
>    home=`cygpath -m ${HOME}`
> else
>    home=${HOME}
> fi
>
> [ -f ${home}/.antrc ] && . ${home}/.antrc
>
> unset LIB
> for i in $LIB_LOCS ; do
>    [ "$DEBUG" = "1" ] && echo "looking for ant version ${ANT_VERSION}"
>    dir="$i/java/ant-${ANT_VERSION}"
>    if [ -d $dir ] ; then
>       [ "$DEBUG" = "1" ] && echo "found library in $dir"
>       LIB=$i
>       break
>    fi
> done
>
> if [ -z "$LIB" ] ; then
>    echo "can't find library directory in any of $LIB_LOCS"
>    exit 1
> fi
>
> CLASSPATH=${LIB}/java/ant-${ANT_VERSION}/lib/ant.jar:\
> ${HOME}/opt/app/jdee/java/lib/jde.jar:\
> ${MVN_REPO}/org/apache/maven/maven-ant-tasks/2.1.0/maven-ant-
> tasks-2.1.0.jar
>
> ${JAVA_HOME}/bin/java -cp $CLASSPATH jde.util.MavenUtils "$@"
>
> ----------snip
>
>
>
> On Apr 21, 2010, at 11:08 PM, James Ahlborn wrote:
>
>> alright, think this will work, although it's a bit of an ugly hack.
>> couldn't figure out a better way to get push and xml-node-attributes
>> to play nice together.
>>
>>> -----Original Message-----
>>> From: Paul Landes [mailto:paullan...@airpost.net]
>>> Sent: Thursday, April 15, 2010 9:33 AM
>>> To: James Ahlborn
>>> Subject: Re: jdee-users Digest, Vol 24, Issue 5
>>>
>>>
>>> Emacs 22.
>>>
>>> On Apr 15, 2010, at 7:37 AM, "James Ahlborn" <jtahlb...@yahoo.com>
>>> wrote:
>>>
>>>> what version of emacs are you using?
>>>>
>>>>> -----Original Message-----
>>>>> From: Paul Landes [mailto:lan...@mailc.net]
>>>>> Sent: Wednesday, April 14, 2010 11:13 AM
>>>>> To: James Ahlborn
>>>>> Subject: Re: jdee-users Digest, Vol 24, Issue 5
>>>>>
>>>>>
>>>>> Hi James,
>>>>>
>>>>> I'm using the elisp file you are using.  With this code:
>>>>>
>>>>> (with-pom
>>>>>  "/Users/landes/opt/var/maven/repo/org/apache/pdfbox/pdfbox/1.0.0/
>>>>> pdfbox-1.0.0.pom"
>>>>> (list* target-directory test-target-directory
>>>>>  (pom-compile-classpath pom-node)))
>>>>>
>>>>> It takes a good 10 seconds to come back, and then I get this:
>>>>>
>>>>> Debugger entered--Lisp error: (error "No setf-method known for  
>>>>> xml-
>>>>> node-attributes")
>>>>> signal(error ("No setf-method known for xml-node-attributes"))
>>>>> error("No setf-method known for %s" xml-node-attributes)
>>>>> get-setf-method((xml-node-attributes pom) nil)
>>>>> cl-setf-do-modify((xml-node-attributes pom) (list))
>>>>> #[(func arg1 place &rest args) "Æ!ƒ
>>>>
>>> No virus found in this incoming message.
>>> Checked by AVG - www.avg.com
>>> Version: 8.5.437 / Virus Database: 271.1.1/2811 - Release Date:
>>> 04/14/10 18:31:00
>>>
>>>
>> <pom-parser.el>
>
>
> ------------------------------------------------------------------------------
>
> _______________________________________________
> jdee-devel mailing list
> jdee-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jdee-devel


------------------------------------------------------------------------------

_______________________________________________
jdee-devel mailing list
jdee-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jdee-devel

Reply via email to