You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Howard <ho...@renci.org> on 2015/02/02 14:53:56 UTC

Re: Question about execution code with maven

Will do.  Thanks for the response.

Howard

On 1/30/15 6:32 PM, Dan Tran wrote:
> additionalClasspathElements is a list and it does not accept arguments via
> system properties
>
> [1]
> http://mojo.codehaus.org/exec-maven-plugin/java-mojo.html#additionalClasspathElements
>
> There is a feature request to allow list arguments using an external system
> property string. Dont have the JIRA with me
>
> For now, you need to call java exe directy
>
> -Dan
>
> On Fri, Jan 30, 2015 at 9:50 AM, Howard <ho...@renci.org> wrote:
>
>> Hi all
>>
>> We are having trouble adding jars to the CLASSPATH using mvn exec:java.
>> Here's the story:
>>
>> We have a project that is basically a platform for executing contributed
>> code.  There's more to it of course, but that's the part of it we are
>> having trouble with. Basically, users send our servers messages (RabbitMQ)
>> that include the names of classes to instantiate and methods to execute.
>> The code is in jar files that do live in our maven repository.  We have
>> been trying to run our code using mvn exec, for example
>>
>>   mvn -X-e exec:java -Dexec.mainClass=org.renci.
>> databridge.engines.relevance.RelevanceEngine -Dexec.
>> additionalClasspathElements="/projects/databridge/howard/
>> repository/org/renci/databridge/contrib/similarity/
>> mocksimilarity/1.0-BETA/mocksimilarity-1.0-BETA.jar"
>> -Dexec.classpathScope=runtime
>>
>> but we can't instantiate the class.  Here's an example trace:
>>
>> Jan 30, 2015 11:03:44 AM org.renci.databridge.engines.relevance.RelevanceEngineMessageHandler
>> processCreateSimilarityMessage
>> SEVERE: Can't instantiate class org.renci.databridge.contrib.
>> similarity.mocksimilarity.MockSimilarity
>> java.lang.ClassNotFoundException: org.renci.databridge.contrib.
>> similarity.mocksimilarity.MockSimilarity
>>      at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
>>      at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
>>      at java.security.AccessController.doPrivileged(Native Method)
>>      at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
>>      at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
>>      at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
>>      at org.renci.databridge.engines.relevance.
>> RelevanceEngineMessageHandler.processCreateSimilarityMessage(
>> RelevanceEngineMessageHandler.java:76)
>>      at org.renci.databridge.engines.relevance.
>> RelevanceEngineMessageHandler.handle(RelevanceEngineMessageHandler.
>> java:56)
>>      at org.renci.databridge.engines.relevance.
>> RelevanceEngineMessageListener.run(RelevanceEngineMessageListener
>> .java:119)
>>
>> I don't think it's the code, because if I put a dependency in the pom it
>> does work, but we don't want to do that.  Maybe it's a bad idea to try to
>> run this through mvn, but it does seem like there should be some way to add
>> jars to the maven runtime class path without adding to the pom. Of course,
>> it's also possible the problem isn't in maven.
>>
>> Any suggestions (other than RTFM!) would be helpful.
>>
>> Thanks
>> Howard
>> --
>> Howard Lander <ma...@renci.org>
>> Senior Research Software Developer
>> Renaissance Computing Institute (RENCI) <http://www.renci.org>
>> The University of North Carolina at Chapel Hill
>> Duke University
>> North Carolina State University
>> 100 Europa Drive
>> Suite 540
>> Chapel Hill, NC 27517
>> 919-445-9651
>>


-- 
Howard Lander <ma...@renci.org>
Senior Research Software Developer
Renaissance Computing Institute (RENCI) <http://www.renci.org>
The University of North Carolina at Chapel Hill
Duke University
North Carolina State University
100 Europa Drive
Suite 540
Chapel Hill, NC 27517
919-445-9651