Anyway, I think fork="true" is usually a good idea regardless.
-j
David Erickson wrote:
Ok I got it to work by having ant spawn my class in a different JVM.. using fork="true" spawn="true". I think there some 'issues' with running something that needs xml access from inprocess with maven.. i cant remember the circumstances I ran into last time but it was similar and drove me nuts.. fortunaetly this works great.
Thanks everyone for the help!! -David
----- Original Message ----- From: "David Erickson" <[EMAIL PROTECTED]>
To: "Maven Users List" <[EMAIL PROTECTED]>
Sent: Friday, August 13, 2004 4:52 PM
Subject: Re: A Goal that can execute a class' main method?
Thanks got everything working as its supposed to I *think* except I am having major XML issues.. it seems like I ran into something similar like this previously, I wasnt sure if its because maven has xml stuff loaded or what.. but heres the errors:
[echo] C:\projects\NADA/target/classes/NADA-.1.jar [echo] Additional Classpath: C:\projects\NADA\src\resources\dataSource-Example [java] JVM args ignored when same JVM is used. log4j:WARN No appenders could be found for logger (org.springframework.beans.factory.xml.XmlBeanDefinitionReader). log4j:WARN Please initialize the log4j system properly. [java] [ERROR] java.lang.NoClassDefFoundError: org/w3c/dom/Document BUILD SUCCESSFUL
and yet within my project I have: <dependency> <groupId>xerces</groupId> <artifactId>xerces</artifactId> <version>2.4.0</version> </dependency> <dependency> <groupId>xerces</groupId> <artifactId>xercesImpl</artifactId> <version>2.4.0</version> </dependency> <dependency> <groupId>xerces</groupId> <artifactId>xmlParserAPIs</artifactId> <version>2.2.1</version> </dependency>
Any ideas?
Thanks,
David
----- Original Message ----- From: "John Casey" <[EMAIL PROTECTED]>
To: "Maven Users List" <[EMAIL PROTECTED]>
Sent: Friday, August 13, 2004 4:12 PM
Subject: Re: A Goal that can execute a class' main method?
1) Is there a webpage somewhere that lists all the variables that
maven
makes available that can be accessed in maven.xml? I hate having to
ask
stupid questions about that even though I cant find a listing =/
No single page, I don't think...(maybe I'm not up to date on that, though). You might have some luck here:
http://maven.apache.org/reference/plugins/index.html
2) Here is what I've got in there now:
<snip/>
However I forgot that the actual files generated by the project arent
on
the
dependency list, is there a variable that holds the path to the target
jar
file that is generated? I need it for my classpath.
You might try adding a classpath refid to maven.build.dest
Also this line I used: <ant:jvmarg value="-DnadaPath=${nadaPath}"/> is that gonna fly? basically I just need to pass a variable from the current jvm system property into the spawned version from ant's java?
I think so, but I've never actually used it.
Thanks,
David
----- Original Message ----- From: "John Casey" <[EMAIL PROTECTED]>
To: "Maven Users List" <[EMAIL PROTECTED]>
Sent: Friday, August 13, 2004 3:49 PM
Subject: Re: A Goal that can execute a class' main method?
1) within the <ant:classpath> I need to somehow iterate through the
list
of
The short answer is to use ${maven.dependency.classpath}...see below:
From the aspectj-3.0 plugin:
<ant:iajc fork="${maven.aspectj.fork}" maxmem="${maven.aspectj.maxmem}" incremental="${maven.aspectj.incremental}" destDir="${maven.build.dest}"
sourceRootCopyFilter="${maven.aspectj.sourceRootCopyFilter}"
debug="${maven.aspectj.debug}" emacssym="${maven.aspectj.emacssym}" verbose="${maven.aspectj.verbose}">
. . .
<ant:classpath> <ant:path refid="maven.dependency.classpath"/>
. . .
</ant:classpath>
. . . </ant:iajc>
2) Secondly if the user specifies multiple classpath entries, like
maven -DadditionalClasspath="/path/to/something.jar;/path/to/anotherjar.jar"
is there someway for me to break that up into classpath entries?
Try this:
<util:tokenize xmlns:util="jelly:util" delim=";" trim="true" var="myPaths"> ${additionalClasspath} </util:tokenize>
<c:forEach xmlns:c="jelly:core" items="${myPaths}" var="path"> <ant:pathelement path="${path}"/> </c:forEach>
3) and i lied one more question, to access VM variables do I simply
do
{variableName} from maven.xml?
What types of args are you trying to gain access to? You might be able to access them as system properties (for example: ${java.vm.version}
or
something)...beyond that, I'm not sure.
Thanks, David
----- Original Message ----- From: "John Casey" <[EMAIL PROTECTED]>
To: "Maven Users List" <[EMAIL PROTECTED]>
Sent: Friday, August 13, 2004 3:21 PM
Subject: Re: A Goal that can execute a class' main method?
You might want to try Ant's <java> task for this. To use it, you
should
try embedding in a custom goal within your project's maven.xml file. I'll look something like this:
<project default="dbLoad" xmlns:ant="jelly:ant">
<goal name="dbLoad"> <ant:java [...options...] classname="com.myco.DbLoader"> <ant:arg value="${myData}"/>
<ant:classpath> <ant:pathelement path="${myPath}"/> </ant:classpath> </ant:java> </goal>
</project>
which you might then invoke using the following command:
maven -DmyData=/path/to/my/data -DmyPath=/path/to/my/classes dbLoad
You can find more info on the Ant java task at: http://ant.apache.org/manual/CoreTasks/java.html
HTH, john
David Erickson wrote:
Hi guys got a couple questions. Ive got a project that has a class
that
updates a database with information. What I was wondering is if it
would be
possible to make a maven goal that executes that class, thus making
it
easy
on the end user (since the majority of the dependencies are listed
within
the dep list). The requirements are these: 1) I'd need to be able to pass in a java environment variable (from
the
command line) for where the datafiles are at to be ported into the
db
2) I'd need to be able to add elements to the classpath of the
class
that
will be executed (From the command line) in addition to the
dependencies
that are listed within maven
Is something like this possible? And if so, if you could point me
in
the
direction on how to implement it I'd be greatly appreciative. Thanks, David
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
-------------------------------------------------------------------------- --
----
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------------
--
----
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
