Define a special JDK for compilation
Hi Guys Do you know where do i adjust the JDK for maven specially ? I know that maven takes the JAVA_HOME as a default, but i have a problem with that , i want it to take a special javac from some other JDK. Thanks Roman
Re: Define a special JDK for compilation
Thanks!! I forgot the compilation-plugin !! On Wed, Jul 22, 2009 at 4:42 PM, Jonathan Woods jonathan.wo...@scintillance.com wrote: Assuming you mean you want to specify a particular javac for Maven to use when compiling code... compilation is carried out (by default) by the Maven compiler plugin, so it's this you need to configure. Details on configuring it to use a specific JDK are given here: http://maven.apache.org/plugins/maven-compiler-plugin/examples/compile-using -different-jdk.htmlhttp://maven.apache.org/plugins/maven-compiler-plugin/examples/compile-using%0A-different-jdk.html Jon -Original Message- From: Roman Kournjaev [mailto:kournj...@gmail.com] Sent: 22 July 2009 14:18 To: Maven Users List Subject: Define a special JDK for compilation Hi Guys Do you know where do i adjust the JDK for maven specially ? I know that maven takes the JAVA_HOME as a default, but i have a problem with that , i want it to take a special javac from some other JDK. Thanks Roman - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: Examples of multi-module site generation?
Hi Dave I dont think you are the only person that does not want to know the absolute URL of your pages, I think that absolutely OK. :-) Here is what i have that actually works sometimes and generates a parent link from the child projects. What you will have to do is to point the maven site plugin relatively to the following site.xml file ?xml version=1.0 encoding=UTF-8? project name=DBWC bannerLeft nameMaven/name srchttp://maven.apache.org/images/apache-maven-project.png/src hrefhttp://maven.apache.org//href /bannerLeft bannerRight srchttp://www.quest.com/images/common/quest_logo.gif/src hrefhttp://www.quest.com//href /bannerRight body links item name=Apache href=http://www.apache.org/; / item name=Maven 1.x href=http://maven.apache.org/maven-1.x// item name=Maven 2 href=http://maven.apache.org// /links menu ref=parent / menu ref=modules / menu ref=reports / /body /project The important thing there is the yellow colored link to the parent project. If you cant create a realive link to the that file , then just create a src/main/site directory in each of your projects and place this xml there too. Dont forget put the link to the site-plugin plugin groupIdorg.apache.maven.plugins/groupId artifactIdmaven-site-plugin/artifactId version2.0/version configuration port9000/port tempWebappDirectory${site.dir}/tempdir/tempWebappDirectory stagingSiteURL${url.site}/stagingSiteURL siteDirectory{relative_link}/siteDirectory /configuration /plugin Frankly i still have sometimes problems with that configuration, I didn't figure it out when it does not work well, but there are some cases that it doesnt. Good Luck with that.. :-) On Mon, Jul 13, 2009 at 5:54 AM, David C. Hicks dhi...@i-hicks.org wrote: Can anyone point me to anything that actually works? I've tried every example I can find via Google (what few there are), and I cannot get the modules to generate a link back to the parent project. Breadcrumbs don't seem to behave, either. Maybe I'm an oddball and the only person who doesn't know the absolute URL where my pages will reside, but I would think that relative URLs would work. Any help? Thanks, Dave - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: Using UmlGraphDoc with Maven
Hi I have made a similar effort to make the graphitz work a year ago. Took me a day or so. Since then not only the build takes longer , but also no one has ever looked at these uml diagrams at all. :-) From my point of view its just a waste of time. Roman On Thu, Jul 9, 2009 at 12:11 PM, Jeff Mutonho ejbeng...@gmail.com wrote: Thanks for all your responses. I've made progress. It now looks like my problem is with Graphviz's dot.exe program. It crashes even from the command like when I do something as simple as dot -V . Says it failed to initialize properly..blah blah ...the usual Windows stuff :) Will let you know what happens. On Thu, Jul 9, 2009 at 9:47 AM, Jason Chaffee jason.chaf...@zilliontv.tv wrote: see http://repo2.maven.org/maven2/org/umlgraph/ Jason From: Jason Chaffee [jason.chaf...@zilliontv.tv]hanks Sent: Thursday, July 09, 2009 12:45 AM To: Maven Users List Subject: RE: Using UmlGraphDoc with Maven UmlGraph is in the central repo: docletorg.umlgraph.doclet.UmlGraphDoc/doclet docletArtifact groupIdorg.umlgraph/groupId artifactIddoclet/artifactId version5.1/version /docletArtifact Jason From: Mohan KR [kmoh@gmail.com] Sent: Thursday, July 09, 2009 12:27 AM To: 'Maven Users List' Subject: RE: Using UmlGraphDoc with Maven I have using both UMLGraph and Apiviz, at least with APIViz you don't need to 'install' the UMLgraph, it is available from jboss repo. Of course, both of them require the dot.exe to be available in the classpath. http://code.google.com/p/apiviz/ Thanks, mohan kr -Original Message- From: Jeff Mutonho [mailto:ejbeng...@gmail.com] Sent: Thursday, July 09, 2009 2:00 AM To: Maven Users List Subject: Re: Using UmlGraphDoc with Maven Thanks Paul , but I still seem out of luck. I downloaded UmlGraph version 4.8 and installed it as mvn install:install-file -Dpackaging=jar -DartifactId=UmlGraph -Dversion=4.8 -Dfile=C:/devenv/UMLGraph-4.8/lib/UmlGraph.jar -DgroupId=gr.spinellis -DgeneratePom=true then reconfigured the javadoc plugin to match the working example : plugin groupIdorg.apache.maven.plugins/groupId artifactIdmaven-javadoc-plugin/artifactId configuration aggregatetrue/aggregate docletgr.spinellis.umlgraph.doclet.UmlGraphDoc/doclet docletArtifact groupIdgr.spinellis/groupId artifactIdUmlGraph/artifactId version4.8/version /docletArtifact additionalparam -inferrel -inferdep -quiet -hide java.* -collpackages java.util.* -qualify -postfixpackage -nodefontsize 9 -nodefontpackagesize 7 /additionalparam /configuration /plugin I still am not getting any .dot generated. I noticed the following in from my mvn -X javadoc:javadoc output : [DEBUG] (f) docletArtifact = groupId = 'null' artifactId = 'null' version = 'null' [DEBUG] (f) docletArtifacts = [] Does this mean maven-javadoc-plugin isn't recognizing the UmlGraphDoc doclet? Or is that output normal? On Thu, Jul 9, 2009 at 7:50 AM, Paul Benedict pbened...@apache.org wrote: Here is a real working example: http://svn.apache.org/viewvc/tiles/framework/trunk/pom.xml?revision=790631c ontent-type=text%2Fplain http://svn.apache.org/viewvc/tiles/framework/trunk/pom.xml?revision=790631c%0Aontent-type=text%2Fplain Paul On Thu, Jul 9, 2009 at 12:44 AM, Jeff Mutonhoejbeng...@gmail.com wrote: Hi After reading the article on this DZone article - Reverse Engineer Source Code http://java.dzone.com/articles/reverse-engineer-source-code-u I configured my pom as follows: plugin groupIdorg.apache.maven.plugins/groupId artifactIdmaven-javadoc-plugin/artifactId configuration aggregatetrue/aggregate docletorg.umlgraph.doclet.UmlGraphDoc/doclet docletArtifact groupIdorg.umlgraph/groupId artifactIdumlGraph/artifactId version5.0/version /docletArtifact additionalparam -inferrel -inferdep -quiet -hide java.* -collpackages java.util.* -qualify -postfixpackage -nodefontsize 9 -nodefontpackagesize 7 /additionalparam destDirtarget/uml/destDir showprivate/show /configuration /plugin I installed Graphviz and C:\Graphviz2.24\bin is in my PATH. However when I run mvn javadoc:javadoc or even better still mvn site:deploy , there aren't any UML image files(i.e .dot) files being generated. Any clues on how I can get this to work? Thanx -- Don't take the name of root in vain. Jeff Mutonho
Re: Using UmlGraphDoc with Maven
I googeled for it right now. Is it worth reading ? On Thu, Jul 9, 2009 at 5:10 PM, Jeff Mutonho ejbeng...@gmail.com wrote: On Thu, Jul 9, 2009 at 2:41 PM, Roman Kournjaev kournj...@gmail.com wrote: Hi I have made a similar effort to make the graphitz work a year ago. Took me a day or so. Since then not only the build takes longer , but also no one has ever looked at these uml diagrams at all. :-) :) Have you read the book Fake Work ? -- Don't take the name of root in vain. Jeff Mutonho Cape Town South Africa GoogleTalk : ejbengine Skype: ejbengine Registered Linux user number 366042
Re: tools.jar
Hi You ll probably will get rid of this error if you run will have the JDK , instaead of the JRE in your PATH. Check your JAVA_HOME , it should always point to a JDK when working with maven. The tools.jar is already inside the jdk in its the lib folder. Roman On Mon, Jun 29, 2009 at 6:29 PM, McElroy Sean sean.mcel...@uk.fujitsu.comwrote: Hello, I'm getting this error: java.lang.ClassNotFoundException: com.sun.mirror.apt.AnnotationProcessorFactory, when I try to compile a web-service project using jaxws-maven-plugin. I understand that this problem relates to tools.jar. So having read the FAQ on the Maven site I added this to my pom: dependency groupIdcom.sun/groupId artifactIdtools/artifactId version1.6/version scopesystem/scope systemPath${java.home}/../lib/tools.jar/systemPath /dependency but this didn't fix the problem. I have read a few posts about this but none have provided the answer. Has anyone solved this? Thanks, Seam
Re: tools.jar
Hi I had this problem a few times. Its definitely a jdk problem. check your mvn -version , verify it takes the right java home. C:\Documents and Settings\rkournjamvn -version Maven version: 2.0.9 Java version: 1.5.0_18 OS name: windows xp version: 5.1 arch: x86 Family: windows C:\Documents and Settings\rkournjaECHO %JAVA_HOME% C:\Program Files\Java\jdk1.5.0_18 Roman On Mon, Jun 29, 2009 at 6:46 PM, McElroy Sean sean.mcel...@uk.fujitsu.comwrote: Hello, My JAVA_HOME variable points to: C:\Program Files\Java\jdk1.6.0_06 Regards, Seam -Original Message- From: Roman Kournjaev [mailto:kournj...@gmail.com] Sent: 29 June 2009 16:36 To: Maven Users List Subject: Re: tools.jar Hi You ll probably will get rid of this error if you run will have the JDK , instaead of the JRE in your PATH. Check your JAVA_HOME , it should always point to a JDK when working with maven. The tools.jar is already inside the jdk in its the lib folder. Roman On Mon, Jun 29, 2009 at 6:29 PM, McElroy Sean sean.mcel...@uk.fujitsu.comwrote: Hello, I'm getting this error: java.lang.ClassNotFoundException: com.sun.mirror.apt.AnnotationProcessorFactory, when I try to compile a web-service project using jaxws-maven-plugin. I understand that this problem relates to tools.jar. So having read the FAQ on the Maven site I added this to my pom: dependency groupIdcom.sun/groupId artifactIdtools/artifactId version1.6/version scopesystem/scope systemPath${java.home}/../lib/tools.jar/systemPath /dependency but this didn't fix the problem. I have read a few posts about this but none have provided the answer. Has anyone solved this? Thanks, Seam - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: Maven JAXB
We have this one working really good : plugin groupIdcom.sun.tools.jxc.maven2/groupId artifactIdmaven-jaxb-schemagen-plugin/artifactId version1.1/version configuration schemas schema file../../src/main/resources/xsds/${artifactId}-${version}-xsd.xsd/file namespace http://www.quest.com/qsi/xml/${artifactId}-${version}/namespace /schema /schemas verbosetrue/verbose includes include**/com/quest/qsi/dbwc/xml/configuration/jaxb/beans/**/*.java/include /includes /configuration executions execution phasegenerate-resources/phase goals goalgenerate/goal /goals /execution /executions /plugin On Thu, Jun 11, 2009 at 9:12 PM, Don Hosek d...@dream-in-color.net wrote: I'm getting: [INFO] The plugin 'com.sun.tools.xjc.maven2:maven-jaxb2-plugin' does not exist or And yes, I looked at the page (I've spent a bunch of time fruitlessly going through the google results of maven jaxb). -dh On 11 Jun 2009, at 10.55, Mick Knutson wrote: What error do you get? --- Thank You… Mick Knutson, President BASE Logic, Inc. Enterprise Architecture, Design, Mentoring Agile Consulting p. (866) BLiNC-411: (254-6241-1) f. (415) 685-4233 Website: http://baselogic.com Linked IN: http://linkedin.com/in/mickknutson Vacation Rental: http://tahoe.baselogic.com --- On Thu, Jun 11, 2009 at 1:46 PM, Don Hosek d...@dream-in-color.net wrote: OK, I've been totally flummoxed by this. Does anyone have a working pom to generate class files from a schema? This is what I'm using, but not having any luck getting it to work. I suspect that I have an issue with my repository declaration or somesuch. Any help would be greatly appreciated. -dh project xmlns=http://maven.apache.org/POM/4.0.0; xmlns:xsi= http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation=http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd; modelVersion4.0.0/modelVersion groupIdTrueCar/groupId artifactIdcurvedata/artifactId packagingjar/packaging version0.0.1-SNAPSHOT/version namecurvedata/name urlhttp://maven.apache.org/url repositories repository idmaven2-repository.dev.java.net/id nameJava.net Maven 2 Repository/name urlhttp://download.java.net/maven/2/url /repository repository idmaven-repository.dev.java.net/id nameJava.net Maven 1 Repository (legacy)/name urlhttp://download.java.net/maven/1/url layoutlegacy/layout /repository /repositories pluginRepositories pluginRepository idmaven-repository.dev.java.net/id nameJava.net Maven 2 Repository/name urlhttp://download.java.net/maven/2/url /pluginRepository !-- pluginRepository id maven-repository.dev.java.net/id nameJava.net Maven 1 Repository (legacy)/name urlhttp://download.java.net/maven/1/url layoutlegacy/layout /pluginRepository -- /pluginRepositories dependencies dependency groupIdjunit/groupId artifactIdjunit/artifactId version3.8.1/version scopetest/scope /dependency /dependencies build plugins plugin groupIdjaxb/groupId artifactIdmaven-jaxb2-plugin/artifactId configuration schemaDirectorysrc/main/resources/schema/schemaDirectory schemaIncludes include*.xsd/include /schemaIncludes generatePackagecom.truecar.curvedata.jaxb/generatePackage removeOldOutputtrue/removeOldOutput /configuration executions execution goals goalgenerate/goal /goals /execution /executions /plugin plugin inheritedtrue/inherited
Re: maven, ant, antrun:run
I am sure you ll get a lot of feedback on that one. It has so much details about our problem. On Tue, May 26, 2009 at 2:09 PM, vpalle vpa...@daimi.au.dk wrote: When executing 'mvn antrun:run' my tasks are not run.. I have an echo task, but no output is shown.. When running the phases that the tasks are bound to, they do get executed.. -- View this message in context: http://www.nabble.com/maven%2C-ant%2C-antrun%3Arun-tp23720986p23720986.html Sent from the Maven - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
maven eclipse plugin
HI All Any idea how do i add additional line to the generated .classpath. The line is an additional source directory , classpathentry kind=src path=src/main/java-gen/ I have looked a little in the plugin page and didnt find anything that fits my needs. Thanks in advance. Roman
Providing multiply source directories ..
Hi Folks .. This one is supposed to be an easy one . build defaultGoalinstall/defaultGoal directorytarget/directory outputDirectorytarget/classes/outputDirectory finalName${project.artifactId}-${project.version} /finalName testOutputDirectorytarget/test-classes /testOutputDirectory sourceDirectorysrc/main/java/sourceDirectory scriptSourceDirectorysrc/main/scripts /scriptSourceDirectory testSourceDirectorysrc/test/java/testSourceDirectory /build Any idea how do i provide multiply source folders ? I have some code also under src/main/java-gen ... Thanks in advance. Roman
Re: Providing multiply source directories ..
Thanks for the fast answer I do care about it and i want to do it the standart way. The sources i generate are created by my maven plugin, and i need them to be generated before compiling the project itself, since i refer to them from my code. I would like also to see the gen sources in eclipse , so i have just added the src/main/java-gen to the sources folders in eclipse. i think if i will put them in to target/genereated-sources eclipse will get nuts and wont recognize that i have them att all. Any idea how to do this the best way ? Thanks On Wed, Mar 25, 2009 at 11:41 AM, clovis.seragio...@raibau.at wrote: The easy answer is the maven-helper-plugin: http://mojo.codehaus.org/build-helper-maven-plugin/add-source-mojo.html. src/main/java-gen probably means that your sources are generated by someone. If this someone is a Maven plugin, then it probably does the job of adding the source directory to your POM (which may not be what you want, but that is not point now). If you generate the sources using the AntRun plugin, you can add *one* extra source directory. And if you care (this is a convention): generated sources are placed under target/generated-sources, and never under src. __ Diese E-Mail kann vertrauliche und geschuetzte Informationen enthalten. Wenn diese E-Mail nicht für Sie bestimmt ist, bitten wir Sie, uns unverzueglich zu informieren und sie zu loeschen. This e-mail message may contain information, which is confidential and protected. If you are not the intended recipient of this message, we ask you to inform us immediately and delete the message afterwards. - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: Extracting classpath for an application from maven
Thanks , i think thats the best and proper way to get it .! On Wed, Mar 18, 2009 at 1:18 PM, Nicolas R. nromane...@jaxio.com wrote: Hello, Try to run 'mvn dependency:build-classpath' Here is the doc: http://maven.apache.org/plugins/maven-dependency-plugin/plugin-info.html Nicolas -- http://www.springfuse.com www.springfuse.com Roman Kournjaev wrote: Hi All I have a maven based application, well now i want to run it in cmd mode, it means just executing the compiled class. How do i extract the classpath for this application from my pom easilly ? Thanks in advance. Roman -- View this message in context: http://www.nabble.com/Extracting-classpath-for-an-application-from-maven-tp22386575p22576977.html Sent from the Maven - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
maven compiler plugin problem (probably)
Hi Folks I just wanted to be sure that im not somekind of stuipid or so I have the following lines of code private static final ArrayListClass? extends SchemaElement tabItems = new ArrayListClass? extends SchemaElement(); static{ tabItems.addAll((Collection? extends Class? extends SchemaElement) Arrays.asList(new Class[]{BuildProfile.class})); } Well it seems to compile ok with the regular java 1.6 compiler. I am trying the same trough maven with the following compiler conifguration plugin groupIdorg.apache.maven.plugins/groupId artifactIdmaven-compiler-plugin/artifactId version2.0.2/version configuration source1.6/source target1.6/target /configuration /plugin well the error is that it is of a *inconvertible types* i had to change it to private static final ArrayListClass tabItems = new ArrayListClass(); static{ tabItems.addAll((CollectionClass) Arrays.asList(new Class[]{BuildProfile.class})); } to make it compile. Any ideas why that ? Thanks in advance. Roman
Profile Inheritance
Hi All I have done a little search on the net , and understood from it that a profile defined in the parent pom cant be explicitly invoked from when running the child pom. It just sound so unbelivable to me! So I just wanted to hear it from you guys too. Thanks in Advance. Roman
Extracting classpath for an application from maven
Hi All I have a maven based application, well now i want to run it in cmd mode, it means just executing the compiled class. How do i extract the classpath for this application from my pom easilly ? Thanks in advance. Roman
Re: Extracting classpath for an application from maven
Thanks , that's a nice plugin. But i see it places the jars into some assembled repository, but it would be really nice to get the classpath to the jars that are in my local maven repository. Thanks in advance On Sat, Mar 7, 2009 at 1:23 PM, Wim Deblauwe wim.debla...@gmail.com wrote: This might be handy for this: http://mojo.codehaus.org/appassembler/appassembler-maven-plugin/ 2009/3/7 Roman Kournjaev kournj...@gmail.com Hi All I have a maven based application, well now i want to run it in cmd mode, it means just executing the compiled class. How do i extract the classpath for this application from my pom easilly ? Thanks in advance. Roman
Re: Executing another process from maven plugin
Hi Justin You saved me a lot of headache ! Thanks a lot ! On Tue, Mar 3, 2009 at 10:02 PM, Edelson, Justin justin.edel...@mtvstaff.com wrote: It looks like I was wrong about there not being an easy way to get the plugin classpath. From the Cobertura plugin: /** * iMaven Internal/i: List of artifacts for the plugin. * * @parameter expression=${plugin.artifacts} * @required * @readonly */ protected List pluginClasspathList; This contains a list of org.apache.maven.artifact.Artifact objects. The Cobertura uses the pattern you are describing, so I would suggest you take a look at it. Justin -Original Message- From: Roman Kournjaev [mailto:kournj...@gmail.com] Sent: Tuesday, March 03, 2009 10:30 AM To: Maven Users List Subject: Re: Executing another process from maven plugin Justin , just one more small question. The project.getCompileClasspathElements() , gets me the elements of the classpath of the project that the plugin is actually running , but not of the plugin itself , so i had to add plugin dependencies also to the pom.xml where the plugin is configured. Is there a way to get the plugin classpath too ? Thanks in advnace Roman On Tue, Mar 3, 2009 at 4:59 PM, Edelson, Justin justin.edel...@mtvstaff.com wrote: The project variable (which doesn't need to be named project) should be injected by Plexus. Here's an example: /** * @parameter expression=${project} * @required * @readonly */ private MavenProject project; From: Roman Kournjaev [mailto:kournj...@gmail.com] Sent: Tue 3/3/2009 9:55 AM To: Maven Users List Subject: Re: Executing another process from maven plugin Thanks Justin If that works , then this is the solution for my problem , but i just cant find the *project.getCompileClasspathElements()* , where do i get the *project *variable from ? I didnt see it in the AbstractMojo class? Thanks On Tue, Mar 3, 2009 at 4:40 PM, Edelson, Justin justin.edel...@mtvstaff.com wrote: I believe that will give you the class path of the current process, which is why you're getting Maven stuff. If you're trying to get project dependencies, what you want to do is include this annotation in your class comments: @requiresDependencyResolution compile And then, use project.getCompileClasspathElements() to get the list of compile-scoped classpath elements. Justin From: Roman Kournjaev [mailto:kournj...@gmail.com] Sent: Tue 3/3/2009 9:29 AM To: Maven Users List Subject: Re: Executing another process from maven plugin Ohh, Sorry Just the regular thing .. : private static String getClassPath() { return prop.getProperty(java.class.path, null); } Roman On Tue, Mar 3, 2009 at 4:26 PM, Edelson, Justin justin.edel...@mtvstaff.com wrote: What is inside the getClassPath() method? On Mar 3, 2009, at 8:58 AM, Roman Kournjaev kournj...@gmail.com wrote: Hi Folks I am a little bit stuck here with the following problem. I have written some custom compiler plugin that invokes the actual compiler, the problem is that i have to do it in a separate process Runtime.exec() It goes like that : Process process = null; String command = java -cp \ + getClassPath() + \ + AgentCompiler.class.getCanonicalName() + + cmd; getLog().info(executing : + command); process = Runtime.getRuntime().exec(command); Well, when i run it from plain java , it works fine ... :-) When i run it as a plugin actually , then i get crappy stuff in my classpath ,everything from maven , but nothing that i actually defined in my pom.xml inside the plugin. I also tried to add these dependecies (plugin dependencies) inside the plugindependencies tag , inside the pom.xml that makes use of that plugin , but also in vain , i still get the same classpath. So long story short .. How to the the needed classpath for running a process outside a maven plugin ??? Thanks in advance. Roman --- -- To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h
Executing another process from maven plugin
Hi Folks I am a little bit stuck here with the following problem. I have written some custom compiler plugin that invokes the actual compiler, the problem is that i have to do it in a separate process Runtime.exec() It goes like that : Process process = null; String command = java -cp \ + getClassPath() + \ + AgentCompiler.class.getCanonicalName() + + cmd; getLog().info(executing : + command); process = Runtime.getRuntime().exec(command); Well, when i run it from plain java , it works fine ... :-) When i run it as a plugin actually , then i get crappy stuff in my classpath ,everything from maven , but nothing that i actually defined in my pom.xml inside the plugin. I also tried to add these dependecies (plugin dependencies) inside the plugindependencies tag , inside the pom.xml that makes use of that plugin , but also in vain , i still get the same classpath. So long story short .. How to the the needed classpath for running a process outside a maven plugin ??? Thanks in advance. Roman
Re: Executing another process from maven plugin
Ohh, Sorry Just the regular thing .. : private static String getClassPath() { return prop.getProperty(java.class.path, null); } Roman On Tue, Mar 3, 2009 at 4:26 PM, Edelson, Justin justin.edel...@mtvstaff.com wrote: What is inside the getClassPath() method? On Mar 3, 2009, at 8:58 AM, Roman Kournjaev kournj...@gmail.com wrote: Hi Folks I am a little bit stuck here with the following problem. I have written some custom compiler plugin that invokes the actual compiler, the problem is that i have to do it in a separate process Runtime.exec() It goes like that : Process process = null; String command = java -cp \ + getClassPath() + \ + AgentCompiler.class.getCanonicalName() + + cmd; getLog().info(executing : + command); process = Runtime.getRuntime().exec(command); Well, when i run it from plain java , it works fine ... :-) When i run it as a plugin actually , then i get crappy stuff in my classpath ,everything from maven , but nothing that i actually defined in my pom.xml inside the plugin. I also tried to add these dependecies (plugin dependencies) inside the plugindependencies tag , inside the pom.xml that makes use of that plugin , but also in vain , i still get the same classpath. So long story short .. How to the the needed classpath for running a process outside a maven plugin ??? Thanks in advance. Roman - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: Executing another process from maven plugin
Thanks Justin If that works , then this is the solution for my problem , but i just cant find the *project.getCompileClasspathElements()* , where do i get the *project *variable from ? I didnt see it in the AbstractMojo class? Thanks On Tue, Mar 3, 2009 at 4:40 PM, Edelson, Justin justin.edel...@mtvstaff.com wrote: I believe that will give you the class path of the current process, which is why you're getting Maven stuff. If you're trying to get project dependencies, what you want to do is include this annotation in your class comments: @requiresDependencyResolution compile And then, use project.getCompileClasspathElements() to get the list of compile-scoped classpath elements. Justin From: Roman Kournjaev [mailto:kournj...@gmail.com] Sent: Tue 3/3/2009 9:29 AM To: Maven Users List Subject: Re: Executing another process from maven plugin Ohh, Sorry Just the regular thing .. : private static String getClassPath() { return prop.getProperty(java.class.path, null); } Roman On Tue, Mar 3, 2009 at 4:26 PM, Edelson, Justin justin.edel...@mtvstaff.com wrote: What is inside the getClassPath() method? On Mar 3, 2009, at 8:58 AM, Roman Kournjaev kournj...@gmail.com wrote: Hi Folks I am a little bit stuck here with the following problem. I have written some custom compiler plugin that invokes the actual compiler, the problem is that i have to do it in a separate process Runtime.exec() It goes like that : Process process = null; String command = java -cp \ + getClassPath() + \ + AgentCompiler.class.getCanonicalName() + + cmd; getLog().info(executing : + command); process = Runtime.getRuntime().exec(command); Well, when i run it from plain java , it works fine ... :-) When i run it as a plugin actually , then i get crappy stuff in my classpath ,everything from maven , but nothing that i actually defined in my pom.xml inside the plugin. I also tried to add these dependecies (plugin dependencies) inside the plugindependencies tag , inside the pom.xml that makes use of that plugin , but also in vain , i still get the same classpath. So long story short .. How to the the needed classpath for running a process outside a maven plugin ??? Thanks in advance. Roman - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: Executing another process from maven plugin
Justin , you're the Man .. .! Thanks a lot! On Tue, Mar 3, 2009 at 4:59 PM, Edelson, Justin justin.edel...@mtvstaff.com wrote: The project variable (which doesn't need to be named project) should be injected by Plexus. Here's an example: /** * @parameter expression=${project} * @required * @readonly */ private MavenProject project; From: Roman Kournjaev [mailto:kournj...@gmail.com] Sent: Tue 3/3/2009 9:55 AM To: Maven Users List Subject: Re: Executing another process from maven plugin Thanks Justin If that works , then this is the solution for my problem , but i just cant find the *project.getCompileClasspathElements()* , where do i get the *project *variable from ? I didnt see it in the AbstractMojo class? Thanks On Tue, Mar 3, 2009 at 4:40 PM, Edelson, Justin justin.edel...@mtvstaff.com wrote: I believe that will give you the class path of the current process, which is why you're getting Maven stuff. If you're trying to get project dependencies, what you want to do is include this annotation in your class comments: @requiresDependencyResolution compile And then, use project.getCompileClasspathElements() to get the list of compile-scoped classpath elements. Justin From: Roman Kournjaev [mailto:kournj...@gmail.com] Sent: Tue 3/3/2009 9:29 AM To: Maven Users List Subject: Re: Executing another process from maven plugin Ohh, Sorry Just the regular thing .. : private static String getClassPath() { return prop.getProperty(java.class.path, null); } Roman On Tue, Mar 3, 2009 at 4:26 PM, Edelson, Justin justin.edel...@mtvstaff.com wrote: What is inside the getClassPath() method? On Mar 3, 2009, at 8:58 AM, Roman Kournjaev kournj...@gmail.com wrote: Hi Folks I am a little bit stuck here with the following problem. I have written some custom compiler plugin that invokes the actual compiler, the problem is that i have to do it in a separate process Runtime.exec() It goes like that : Process process = null; String command = java -cp \ + getClassPath() + \ + AgentCompiler.class.getCanonicalName() + + cmd; getLog().info(executing : + command); process = Runtime.getRuntime().exec(command); Well, when i run it from plain java , it works fine ... :-) When i run it as a plugin actually , then i get crappy stuff in my classpath ,everything from maven , but nothing that i actually defined in my pom.xml inside the plugin. I also tried to add these dependecies (plugin dependencies) inside the plugindependencies tag , inside the pom.xml that makes use of that plugin , but also in vain , i still get the same classpath. So long story short .. How to the the needed classpath for running a process outside a maven plugin ??? Thanks in advance. Roman - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: Executing another process from maven plugin
Justin , just one more small question. The project.getCompileClasspathElements() , gets me the elements of the classpath of the project that the plugin is actually running , but not of the plugin itself , so i had to add plugin dependencies also to the pom.xml where the plugin is configured. Is there a way to get the plugin classpath too ? Thanks in advnace Roman On Tue, Mar 3, 2009 at 4:59 PM, Edelson, Justin justin.edel...@mtvstaff.com wrote: The project variable (which doesn't need to be named project) should be injected by Plexus. Here's an example: /** * @parameter expression=${project} * @required * @readonly */ private MavenProject project; From: Roman Kournjaev [mailto:kournj...@gmail.com] Sent: Tue 3/3/2009 9:55 AM To: Maven Users List Subject: Re: Executing another process from maven plugin Thanks Justin If that works , then this is the solution for my problem , but i just cant find the *project.getCompileClasspathElements()* , where do i get the *project *variable from ? I didnt see it in the AbstractMojo class? Thanks On Tue, Mar 3, 2009 at 4:40 PM, Edelson, Justin justin.edel...@mtvstaff.com wrote: I believe that will give you the class path of the current process, which is why you're getting Maven stuff. If you're trying to get project dependencies, what you want to do is include this annotation in your class comments: @requiresDependencyResolution compile And then, use project.getCompileClasspathElements() to get the list of compile-scoped classpath elements. Justin From: Roman Kournjaev [mailto:kournj...@gmail.com] Sent: Tue 3/3/2009 9:29 AM To: Maven Users List Subject: Re: Executing another process from maven plugin Ohh, Sorry Just the regular thing .. : private static String getClassPath() { return prop.getProperty(java.class.path, null); } Roman On Tue, Mar 3, 2009 at 4:26 PM, Edelson, Justin justin.edel...@mtvstaff.com wrote: What is inside the getClassPath() method? On Mar 3, 2009, at 8:58 AM, Roman Kournjaev kournj...@gmail.com wrote: Hi Folks I am a little bit stuck here with the following problem. I have written some custom compiler plugin that invokes the actual compiler, the problem is that i have to do it in a separate process Runtime.exec() It goes like that : Process process = null; String command = java -cp \ + getClassPath() + \ + AgentCompiler.class.getCanonicalName() + + cmd; getLog().info(executing : + command); process = Runtime.getRuntime().exec(command); Well, when i run it from plain java , it works fine ... :-) When i run it as a plugin actually , then i get crappy stuff in my classpath ,everything from maven , but nothing that i actually defined in my pom.xml inside the plugin. I also tried to add these dependecies (plugin dependencies) inside the plugindependencies tag , inside the pom.xml that makes use of that plugin , but also in vain , i still get the same classpath. So long story short .. How to the the needed classpath for running a process outside a maven plugin ??? Thanks in advance. Roman - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org