You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by David Erickson <de...@cmcflex.com> on 2004/08/13 23:10:49 UTC

A Goal that can execute a class' main method?

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: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: A Goal that can execute a class' main method?

Posted by John Casey <jd...@commonjava.org>.
If you don't use fork, you've got to deal with the fact that maven has a 
copy of Xerces in its endorsed directory 
${maven.home}/lib/endorsed...this could cause classloader issues, I'd 
imagine.

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" <de...@cmcflex.com>
> To: "Maven Users List" <us...@maven.apache.org>
> 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" <jd...@commonjava.org>
>>To: "Maven Users List" <us...@maven.apache.org>
>>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" <jd...@commonjava.org>
>>>>To: "Maven Users List" <us...@maven.apache.org>
>>>>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" <jd...@commonjava.org>
>>>>>>To: "Maven Users List" <us...@maven.apache.org>
>>>>>>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: users-unsubscribe@maven.apache.org
>>>>>>>>For additional commands, e-mail: users-help@maven.apache.org
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>---------------------------------------------------------------------
>>>>>
>>>>>>>To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>>>>>>For additional commands, e-mail: users-help@maven.apache.org
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>---------------------------------------------------------------------
>>>>>>To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>>>>>For additional commands, e-mail: users-help@maven.apache.org
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>--------------------------------------------------------------------------
>>--
>>
>>>>----
>>>>
>>>>
>>>>
>>>>
>>>>>---------------------------------------------------------------------
>>>>>To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>>>>For additional commands, e-mail: users-help@maven.apache.org
>>>>
>>>>
>>>>
>>>>---------------------------------------------------------------------
>>>>To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>>>For additional commands, e-mail: users-help@maven.apache.org
>>>>
>>>>
>>>>
>>>
>>>
>>
>>--------------------------------------------------------------------------
> 
> --
> 
>>----
>>
>>
>>
>>>---------------------------------------------------------------------
>>>To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>>For additional commands, e-mail: users-help@maven.apache.org
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>For additional commands, e-mail: users-help@maven.apache.org
>>
>>
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
> 
> 


Re: A Goal that can execute a class' main method?

Posted by David Erickson <de...@cmcflex.com>.
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" <de...@cmcflex.com>
To: "Maven Users List" <us...@maven.apache.org>
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" <jd...@commonjava.org>
> To: "Maven Users List" <us...@maven.apache.org>
> 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" <jd...@commonjava.org>
> > > To: "Maven Users List" <us...@maven.apache.org>
> > > 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" <jd...@commonjava.org>
> > >>>To: "Maven Users List" <us...@maven.apache.org>
> > >>>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: users-unsubscribe@maven.apache.org
> > >>>>>For additional commands, e-mail: users-help@maven.apache.org
> > >>>>>
> > >>>>>
> > >>>>>
> > >>>>
> > >>>>
> >
>>>>---------------------------------------------------------------------
> > >>>>To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > >>>>For additional commands, e-mail: users-help@maven.apache.org
> > >>>>
> > >>>>
> > >>>
> > >>>
> > >>>
> > >>>---------------------------------------------------------------------
> > >>>To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > >>>For additional commands, e-mail: users-help@maven.apache.org
> > >>>
> > >>>
> > >>>
> > >>
> > >>
> > >
> > >
> >
>
> --------------------------------------------------------------------------
> --
> > > ----
> > >
> > >
> > >
> > >>---------------------------------------------------------------------
> > >>To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > >>For additional commands, e-mail: users-help@maven.apache.org
> > >
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > > For additional commands, e-mail: users-help@maven.apache.org
> > >
> > >
> > >
> >
> >
>
>
> --------------------------------------------------------------------------
--
> ----
>
>
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: A Goal that can execute a class' main method?

Posted by David Erickson <de...@cmcflex.com>.
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" <jd...@commonjava.org>
To: "Maven Users List" <us...@maven.apache.org>
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" <jd...@commonjava.org>
> > To: "Maven Users List" <us...@maven.apache.org>
> > 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" <jd...@commonjava.org>
> >>>To: "Maven Users List" <us...@maven.apache.org>
> >>>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: users-unsubscribe@maven.apache.org
> >>>>>For additional commands, e-mail: users-help@maven.apache.org
> >>>>>
> >>>>>
> >>>>>
> >>>>
> >>>>
> >>>>---------------------------------------------------------------------
> >>>>To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> >>>>For additional commands, e-mail: users-help@maven.apache.org
> >>>>
> >>>>
> >>>
> >>>
> >>>
> >>>---------------------------------------------------------------------
> >>>To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> >>>For additional commands, e-mail: users-help@maven.apache.org
> >>>
> >>>
> >>>
> >>
> >>
> >
> >
>
> --------------------------------------------------------------------------
--
> > ----
> >
> >
> >
> >>---------------------------------------------------------------------
> >>To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> >>For additional commands, e-mail: users-help@maven.apache.org
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
> >
> >
>
>


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


> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: A Goal that can execute a class' main method?

Posted by John Casey <jd...@commonjava.org>.

> 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" <jd...@commonjava.org>
> To: "Maven Users List" <us...@maven.apache.org>
> 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" <jd...@commonjava.org>
>>>To: "Maven Users List" <us...@maven.apache.org>
>>>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: users-unsubscribe@maven.apache.org
>>>>>For additional commands, e-mail: users-help@maven.apache.org
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>>---------------------------------------------------------------------
>>>>To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>>>For additional commands, e-mail: users-help@maven.apache.org
>>>>
>>>>
>>>
>>>
>>>
>>>---------------------------------------------------------------------
>>>To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>>For additional commands, e-mail: users-help@maven.apache.org
>>>
>>>
>>>
>>
>>
> 
> 
> ----------------------------------------------------------------------------
> ----
> 
> 
> 
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>For additional commands, e-mail: users-help@maven.apache.org
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
> 
> 


Re: A Goal that can execute a class' main method?

Posted by David Erickson <de...@cmcflex.com>.
Thanks a ton to John and Carlos you guys have been extremely helpful.
Couple more Q's
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 =/

2) Here is what I've got in there now:
  <goal name="updateDatabase">
    <attainGoal name="build:start"/>
    <attainGoal name="java:prepare-filesystem"/>
    <attainGoal name="java:compile"/>
    <attainGoal name="java:jar-resources"/>

    <ant:java classname="com.cmcflex.nada.util.UpdateDb">
      <ant:classpath>
        <ant:path refid="maven.dependency.classpath"/>
        <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>
      </ant:classpath>
      <ant:jvmarg value="-DnadaPath=${nadaPath}"/>
    </ant:java>

  </goal>

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.

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?

Thanks,
David
----- Original Message ----- 
From: "John Casey" <jd...@commonjava.org>
To: "Maven Users List" <us...@maven.apache.org>
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" <jd...@commonjava.org>
> > To: "Maven Users List" <us...@maven.apache.org>
> > 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: users-unsubscribe@maven.apache.org
> >>>For additional commands, e-mail: users-help@maven.apache.org
> >>>
> >>>
> >>>
> >>
> >>
> >>---------------------------------------------------------------------
> >>To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> >>For additional commands, e-mail: users-help@maven.apache.org
> >>
> >>
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
> >
> >
>
>


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


> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: A Goal that can execute a class' main method?

Posted by John Casey <jd...@commonjava.org>.
> 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" <jd...@commonjava.org>
> To: "Maven Users List" <us...@maven.apache.org>
> 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: users-unsubscribe@maven.apache.org
>>>For additional commands, e-mail: users-help@maven.apache.org
>>>
>>>
>>>
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>For additional commands, e-mail: users-help@maven.apache.org
>>
>>
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
> 
> 


Re: A Goal that can execute a class' main method?

Posted by David Erickson <de...@cmcflex.com>.
John,
Thanks that helps tremendously, my other 2 remaining questions would be
1) within the <ant:classpath> I need to somehow iterate through the list of
project dependencies, something like:
    <ant:classpath>
        <while mydeps.hasmore>
            <ant:classpath path=mydep>
        </while>
    </ant:classpath>
    Is there someway to do something similar to this?

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?

3) and i lied one more question, to access VM variables do I simply do
{variableName} from maven.xml?
Thanks,
David

----- Original Message ----- 
From: "John Casey" <jd...@commonjava.org>
To: "Maven Users List" <us...@maven.apache.org>
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: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: A Goal that can execute a class' main method?

Posted by John Casey <jd...@commonjava.org>.
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: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


RE: A Goal that can execute a class' main method?

Posted by Carlos Sanchez <ap...@carlos.cousas.net>.
 

> -----Original Message-----
> From: David Erickson [mailto:derickson@cmcflex.com] 
> Sent: Friday, August 13, 2004 11:30 PM
> To: Maven Users List
> Subject: Re: A Goal that can execute a class' main method?
> 
> 1) ok so when I call maven from the command line like "maven 
> mygoal" how do I specify these things?  like "maven mygoal 
> -Dmyoption=myvalue" ?

yes

> 2) how can I get a handle on that variable from within my 
> goal scripts?

<maven:get var="" property="" default""/>
For concrete syntax you can check the announcement plugin "plugin.jelly" for
example

> 3) how can I get a handle on the classpath from the 
> dependencies in my project.xml?

You can check the java plugin
          <ant:classpath>
            <ant:path refid="maven.dependency.classpath"/>
            <ant:pathelement path="other paths"/>
          </ant:classpath>

> Thanks,
> David
> 
> ----- Original Message -----
> From: "Carlos Sanchez" <ap...@carlos.cousas.net>
> To: "'Maven Users List'" <us...@maven.apache.org>
> Sent: Friday, August 13, 2004 3:19 PM
> Subject: RE: A Goal that can execute a class' main method?
> 
> 
> Hi,
> 
> You can implement it with ant tasks (<java> I think) in maven.xml
> 1) -Dvar=value
> 2) <java> can have nested classpath
> 
> Regards
> 
> Carlos Sanchez
> A Coruña, Spain
> 
> Oness Project
> http://oness.sourceforge.net
> 
> 
> > -----Original Message-----
> > From: David Erickson [mailto:derickson@cmcflex.com]
> > Sent: Friday, August 13, 2004 11:11 PM
> > To: Maven User List
> > Subject: A Goal that can execute a class' main method?
> >
> > 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: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
> >
> >
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
> 
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: A Goal that can execute a class' main method?

Posted by David Erickson <de...@cmcflex.com>.
1) ok so when I call maven from the command line like "maven mygoal" how do
I specify these things?  like "maven mygoal -Dmyoption=myvalue" ?
2) how can I get a handle on that variable from within my goal scripts?
3) how can I get a handle on the classpath from the dependencies in my
project.xml?
Thanks,
David

----- Original Message ----- 
From: "Carlos Sanchez" <ap...@carlos.cousas.net>
To: "'Maven Users List'" <us...@maven.apache.org>
Sent: Friday, August 13, 2004 3:19 PM
Subject: RE: A Goal that can execute a class' main method?


Hi,

You can implement it with ant tasks (<java> I think) in maven.xml
1) -Dvar=value
2) <java> can have nested classpath

Regards

Carlos Sanchez
A Coruña, Spain

Oness Project
http://oness.sourceforge.net


> -----Original Message-----
> From: David Erickson [mailto:derickson@cmcflex.com]
> Sent: Friday, August 13, 2004 11:11 PM
> To: Maven User List
> Subject: A Goal that can execute a class' main method?
>
> 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: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


RE: A Goal that can execute a class' main method?

Posted by Carlos Sanchez <ap...@carlos.cousas.net>.
Hi,

You can implement it with ant tasks (<java> I think) in maven.xml
1) -Dvar=value
2) <java> can have nested classpath

Regards

Carlos Sanchez
A Coruña, Spain

Oness Project
http://oness.sourceforge.net
 

> -----Original Message-----
> From: David Erickson [mailto:derickson@cmcflex.com] 
> Sent: Friday, August 13, 2004 11:11 PM
> To: Maven User List
> Subject: A Goal that can execute a class' main method?
> 
> 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: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
> 
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org