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: <project> [...] <build> <sourceDirectory>relative/source/dir</sourceDirectory> </build> </project> 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. <jdk_dir>/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]