Re: Newbie question on MOJOs
Hi Ritu, I'm not sure what your goal is, but if you're just trying to do a simple compilation of source code, you might want to simply point your POM at the source directory, and try calling `mvn compile`. By default, Maven will compile the source files for you...it's part of the default lifecycle for jar projects. POM syntax for source directory: [...] relative/source/dir HTH, john On 8/14/06, franz see <[EMAIL PROTECTED]> wrote: Good day to you, Ritu > Hi, > > I am new to Maven2. I am trying to develop plugins in Maven2 using the > Java Plugins approach. I have seen the getting started guide on MOJOs > ( http://maven.apache.org/guides/plugin/guide-java-plugin-development.html). > But this is too elementary. Could someone please point me to some more > advanced guide to building MOJOs, one which contains integration with Ant > Java APIs? I have taken a look at the AntExternal guide as well: > http://ant.apache.org/manual/antexternal.html. Sorry, I don't know of any advance guides which integrates Ant Java APIs with MOJOs. But you may want to look at the source code of maven-antrun-plugin to see how it used the Ant Java APIs (see [1]). Who names, maybe it can already do what you're trying to accomplish ^_^ > At this point, I am simply trying to use Ant's Javac.java API to compile > my source code using a MOJO. I had the following questiions: > 1. How do I get access to maven's dependency classpath (i.e. path > containing all the dependencies defined in project's pom.xml)? In Maven > 1.x this was accessible using maven.dependency.classpath reference in > plugin.jelly. code wise, you can use the following to get those classpaths * for maven.dependency.classpath and maven.compile.classpath, use mavenProject.getCompileClasspathElements() * for maven.runtime.classpath, use mavenProject.getRuntimeClasspathElements() * for maven.test.classpath, use mavenProject.getTestClasspathElements() then add reference to your Ant Project (i.e. antProject.addReference( "maven.compile.classpath", p) where p is of type org.apache.tools.ant.types.Path) Better if you take a look at executeTasks( ... ) of AbstractAntMojo (see [2]) > 2. How does Maven set the java.home System Property? I have set the > environment var "Java_Home" to the jdk directory but Maven is setting the > java.home System property to the jre directory (i.e. /jre). Why > is that so? Maven's System properites simply comes from java.lang.System.getProperties () > Has anyone used Ant's Javac API to do the compilation from inside a MOJO. > If yes, could you please send me the code snippet to set the classpath and > any other system properties? java compilation? try [3] Btw, [4] contains a list of plugins supported by Apache. Maybe what you're trying to do has already been done. [1] http://svn.apache.org/repos/asf/maven/plugins/trunk/maven-antrun-plugin/ [2] http://svn.apache.org/repos/asf/maven/plugins/trunk/maven-antrun-plugin/src/main/java/org/apache/maven/plugin/antrun/AbstractAntMojo.java [3] http://svn.apache.org/repos/asf/maven/plugins/trunk/maven-compiler-plugin/ [4] Cheers, Franz -- View this message in context: http://www.nabble.com/Newbie-question-on-MOJOs-tf2101911.html#a5793568 Sent from the Maven - Users forum at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Ad: Newbie question on MOJOs
ritu.x.kedia wrote: > > Hi Stefan, > > Thanks for that quick response. > > I took a look at the compiler plugin. It uses quite a lot of current build > context references, for e.g. project.compileClasspathElements. > > Would you know if there is any single source of document on all the > available Maven2 properties/references? In Maven 1.x there was a reference > page available for all the default Maven properties. I didn't find similar > documentation in Maven2. Any pointers will be very much appreciated. > > Thanks again, > Ritu > > > > > > Stefan Magnus Landrø <[EMAIL PROTECTED]> > 08/14/2006 01:18 PM > Please respond to "Maven Users List" > > To: "Maven Users List" > cc: > Subject:Ad: Newbie question on MOJOs > > > Hi there, > > Have a look at the maven-compiler-plugin plugin. It should provide you > with lots of ingormation. > > Stefan > [EMAIL PROTECTED] skrev 14.08.2006 09:31:13: > >> Hi, >> >> I am new to Maven2. I am trying to develop plugins in Maven2 using the >> Java Plugins approach. I have seen the getting started guide on MOJOs >> > (http://maven.apache.org/guides/plugin/guide-java-plugin-development.html > ). > >> But this is too elementary. Could someone please point me to some more >> advanced guide to building MOJOs, one which contains integration with > Ant >> Java APIs? I have taken a look at the AntExternal guide as well: >> http://ant.apache.org/manual/antexternal.html. >> >> At this point, I am simply trying to use Ant's Javac.java API to compile > > >> my source code using a MOJO. I had the following questiions: >> 1. How do I get access to maven's dependency classpath (i.e. path >> containing all the dependencies defined in project's pom.xml)? In Maven >> 1.x this was accessible using maven.dependency.classpath reference in >> plugin.jelly. >> 2. How does Maven set the java.home System Property? I have set the >> environment var "Java_Home" to the jdk directory but Maven is setting > the >> java.home System property to the jre directory (i.e. /jre). Why > > >> is that so? >> >> Has anyone used Ant's Javac API to do the compilation from inside a > MOJO. >> If yes, could you please send me the code snippet to set the classpath > and >> any other system properties? >> >> Thanks in advance, >> Ritu >> >> >> >> >> >> >> >> - >> This transmission may contain information that is privileged, >> confidential, legally privileged, and/or exempt from disclosure >> under applicable law. If you are not the intended recipient, you >> are hereby notified that any disclosure, copying, distribution, or >> use of the information contained herein (including any reliance >> thereon) is STRICTLY PROHIBITED. Although this transmission and >> any attachments are believed to be free of any virus or other >> defect that might affect any computer system into which it is >> received and opened, it is the responsibility of the recipient to >> ensure that it is virus free and no responsibility is accepted by >> JPMorgan Chase & Co., its subsidiaries and affiliates, as >> applicable, for any loss or damage arising in any way from its use. >> If you received this transmission in error, please immediately >> contact the sender and destroy the material in its entirety, >> whether in electronic or hard copy format. Thank you. > > > Good day to you, Ritu, I'm not sure if there is a documented list of maven expressions. But you can try reading the following: http://svn.apache.org/repos/asf/maven/components/trunk/maven-core/src/main/java/org/apache/maven/usability/plugin/ExpressionDocumenter.java http://svn.apache.org/repos/asf/maven/components/trunk/maven-core/src/main/resources/META-INF/maven/plugin-expressions/project.paramdoc.xml http://svn.apache.org/repos/asf/maven/components/trunk/maven-core/src/main/resources/META-INF/maven/plugin-expressions/rootless.paramdoc.xml http://svn.apache.org/repos/asf/maven/components/trunk/maven-core/src/main/resources/META-INF/maven/plugin-expressions/settings.paramdoc.xml ^_^ Cheers, - Franz -- View this message in context: http://www.nabble.com/Ad%3A-Newbie-question-on-MOJOs-tf2101966.html#a5794107 Sent from the Maven - Users forum at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Newbie question on MOJOs
Good day to you, Ritu > Hi, > > I am new to Maven2. I am trying to develop plugins in Maven2 using the > Java Plugins approach. I have seen the getting started guide on MOJOs > (http://maven.apache.org/guides/plugin/guide-java-plugin-development.html). > But this is too elementary. Could someone please point me to some more > advanced guide to building MOJOs, one which contains integration with Ant > Java APIs? I have taken a look at the AntExternal guide as well: > http://ant.apache.org/manual/antexternal.html. Sorry, I don't know of any advance guides which integrates Ant Java APIs with MOJOs. But you may want to look at the source code of maven-antrun-plugin to see how it used the Ant Java APIs (see [1]). Who names, maybe it can already do what you're trying to accomplish ^_^ > At this point, I am simply trying to use Ant's Javac.java API to compile > my source code using a MOJO. I had the following questiions: > 1. How do I get access to maven's dependency classpath (i.e. path > containing all the dependencies defined in project's pom.xml)? In Maven > 1.x this was accessible using maven.dependency.classpath reference in > plugin.jelly. code wise, you can use the following to get those classpaths * for maven.dependency.classpath and maven.compile.classpath, use mavenProject.getCompileClasspathElements() * for maven.runtime.classpath, use mavenProject.getRuntimeClasspathElements() * for maven.test.classpath, use mavenProject.getTestClasspathElements() then add reference to your Ant Project (i.e. antProject.addReference( "maven.compile.classpath", p) where p is of type org.apache.tools.ant.types.Path) Better if you take a look at executeTasks( ... ) of AbstractAntMojo (see [2]) > 2. How does Maven set the java.home System Property? I have set the > environment var "Java_Home" to the jdk directory but Maven is setting the > java.home System property to the jre directory (i.e. /jre). Why > is that so? Maven's System properites simply comes from java.lang.System.getProperties() > Has anyone used Ant's Javac API to do the compilation from inside a MOJO. > If yes, could you please send me the code snippet to set the classpath and > any other system properties? java compilation? try [3] Btw, [4] contains a list of plugins supported by Apache. Maybe what you're trying to do has already been done. [1] http://svn.apache.org/repos/asf/maven/plugins/trunk/maven-antrun-plugin/ [2] http://svn.apache.org/repos/asf/maven/plugins/trunk/maven-antrun-plugin/src/main/java/org/apache/maven/plugin/antrun/AbstractAntMojo.java [3] http://svn.apache.org/repos/asf/maven/plugins/trunk/maven-compiler-plugin/ [4] Cheers, Franz -- View this message in context: http://www.nabble.com/Newbie-question-on-MOJOs-tf2101911.html#a5793568 Sent from the Maven - Users forum at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Ad: Newbie question on MOJOs
Hi Stefan, Thanks for that quick response. I took a look at the compiler plugin. It uses quite a lot of current build context references, for e.g. project.compileClasspathElements. Would you know if there is any single source of document on all the available Maven2 properties/references? In Maven 1.x there was a reference page available for all the default Maven properties. I didn't find similar documentation in Maven2. Any pointers will be very much appreciated. Thanks again, Ritu Stefan Magnus Landrø <[EMAIL PROTECTED]> 08/14/2006 01:18 PM Please respond to "Maven Users List" To: "Maven Users List" cc: Subject: Ad: Newbie question on MOJOs Hi there, Have a look at the maven-compiler-plugin plugin. It should provide you with lots of ingormation. Stefan [EMAIL PROTECTED] skrev 14.08.2006 09:31:13: > Hi, > > I am new to Maven2. I am trying to develop plugins in Maven2 using the > Java Plugins approach. I have seen the getting started guide on MOJOs > (http://maven.apache.org/guides/plugin/guide-java-plugin-development.html ). > But this is too elementary. Could someone please point me to some more > advanced guide to building MOJOs, one which contains integration with Ant > Java APIs? I have taken a look at the AntExternal guide as well: > http://ant.apache.org/manual/antexternal.html. > > At this point, I am simply trying to use Ant's Javac.java API to compile > my source code using a MOJO. I had the following questiions: > 1. How do I get access to maven's dependency classpath (i.e. path > containing all the dependencies defined in project's pom.xml)? In Maven > 1.x this was accessible using maven.dependency.classpath reference in > plugin.jelly. > 2. How does Maven set the java.home System Property? I have set the > environment var "Java_Home" to the jdk directory but Maven is setting the > java.home System property to the jre directory (i.e. /jre). Why > is that so? > > Has anyone used Ant's Javac API to do the compilation from inside a MOJO. > If yes, could you please send me the code snippet to set the classpath and > any other system properties? > > Thanks in advance, > Ritu > > > > > > > > - > This transmission may contain information that is privileged, > confidential, legally privileged, and/or exempt from disclosure > under applicable law. If you are not the intended recipient, you > are hereby notified that any disclosure, copying, distribution, or > use of the information contained herein (including any reliance > thereon) is STRICTLY PROHIBITED. Although this transmission and > any attachments are believed to be free of any virus or other > defect that might affect any computer system into which it is > received and opened, it is the responsibility of the recipient to > ensure that it is virus free and no responsibility is accepted by > JPMorgan Chase & Co., its subsidiaries and affiliates, as > applicable, for any loss or damage arising in any way from its use. > If you received this transmission in error, please immediately > contact the sender and destroy the material in its entirety, > whether in electronic or hard copy format. Thank you.
Ad: Newbie question on MOJOs
Hi there, Have a look at the maven-compiler-plugin plugin. It should provide you with lots of ingormation. Stefan [EMAIL PROTECTED] skrev 14.08.2006 09:31:13: > Hi, > > I am new to Maven2. I am trying to develop plugins in Maven2 using the > Java Plugins approach. I have seen the getting started guide on MOJOs > (http://maven.apache.org/guides/plugin/guide-java-plugin-development.html). > But this is too elementary. Could someone please point me to some more > advanced guide to building MOJOs, one which contains integration with Ant > Java APIs? I have taken a look at the AntExternal guide as well: > http://ant.apache.org/manual/antexternal.html. > > At this point, I am simply trying to use Ant's Javac.java API to compile > my source code using a MOJO. I had the following questiions: > 1. How do I get access to maven's dependency classpath (i.e. path > containing all the dependencies defined in project's pom.xml)? In Maven > 1.x this was accessible using maven.dependency.classpath reference in > plugin.jelly. > 2. How does Maven set the java.home System Property? I have set the > environment var "Java_Home" to the jdk directory but Maven is setting the > java.home System property to the jre directory (i.e. /jre). Why > is that so? > > Has anyone used Ant's Javac API to do the compilation from inside a MOJO. > If yes, could you please send me the code snippet to set the classpath and > any other system properties? > > Thanks in advance, > Ritu > > > > > > > > - > This transmission may contain information that is privileged, > confidential, legally privileged, and/or exempt from disclosure > under applicable law. If you are not the intended recipient, you > are hereby notified that any disclosure, copying, distribution, or > use of the information contained herein (including any reliance > thereon) is STRICTLY PROHIBITED. Although this transmission and > any attachments are believed to be free of any virus or other > defect that might affect any computer system into which it is > received and opened, it is the responsibility of the recipient to > ensure that it is virus free and no responsibility is accepted by > JPMorgan Chase & Co., its subsidiaries and affiliates, as > applicable, for any loss or damage arising in any way from its use. > If you received this transmission in error, please immediately > contact the sender and destroy the material in its entirety, > whether in electronic or hard copy format. Thank you.
Newbie question on MOJOs
Hi, I am new to Maven2. I am trying to develop plugins in Maven2 using the Java Plugins approach. I have seen the getting started guide on MOJOs (http://maven.apache.org/guides/plugin/guide-java-plugin-development.html). But this is too elementary. Could someone please point me to some more advanced guide to building MOJOs, one which contains integration with Ant Java APIs? I have taken a look at the AntExternal guide as well: http://ant.apache.org/manual/antexternal.html. At this point, I am simply trying to use Ant's Javac.java API to compile my source code using a MOJO. I had the following questiions: 1. How do I get access to maven's dependency classpath (i.e. path containing all the dependencies defined in project's pom.xml)? In Maven 1.x this was accessible using maven.dependency.classpath reference in plugin.jelly. 2. How does Maven set the java.home System Property? I have set the environment var "Java_Home" to the jdk directory but Maven is setting the java.home System property to the jre directory (i.e. /jre). Why is that so? Has anyone used Ant's Javac API to do the compilation from inside a MOJO. If yes, could you please send me the code snippet to set the classpath and any other system properties? Thanks in advance, Ritu - This transmission may contain information that is privileged, confidential, legally privileged, and/or exempt from disclosure under applicable law. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution, or use of the information contained herein (including any reliance thereon) is STRICTLY PROHIBITED. Although this transmission and any attachments are believed to be free of any virus or other defect that might affect any computer system into which it is received and opened, it is the responsibility of the recipient to ensure that it is virus free and no responsibility is accepted by JPMorgan Chase & Co., its subsidiaries and affiliates, as applicable, for any loss or damage arising in any way from its use. If you received this transmission in error, please immediately contact the sender and destroy the material in its entirety, whether in electronic or hard copy format. Thank you.