Re: Project dependencies vs plugin dependencies for a mojo looking at the project
Karl Heinz Marbaise-3 wrote >>I thought I could just enter it once as a plugin dependency in >> the user project pom - assuming it would be the only one. > > You can give this via the plugin configuration and which means your > plugin must resolve it's dependencies and make a required download for > it...which can be easily done by using a maven-artifact-transfer[3]. > > [3]: > https://maven.apache.org/shared/maven-artifact-transfer/install-project.html I wasn't able to get the maven-artifact-transfer to function in my mojo. I resorted to Aether's RepositorySystem.resolveArtifact() method. Karl Heinz Marbaise-3 wrote Presumably I call something like project.getPlugin(key).getDependencies()? If the 'key' required for project.getPlugin(key) is of the form myGroup:myPlugin:version e.g. com.megacorp:thing-plugin:1.0.2 can I get my mojo's own key programmatically in the mojo to avoid hard-coding it? This is the last issue I'm facing (famous last words.) I currently hard-code my plugin's key so I can obtain it while the mojo is in action: Plugin plugin = project.getPlugin("com.megacorp.stuff:my-plugin"); plugin.getDependencies().. but I'd like to avoid that in case my successor decides to rename it or something similar. How can I the key programmatically, by reaching deep into the mojo? Regards Adam -- Sent from: http://maven.40175.n5.nabble.com/Maven-Users-f40176.html - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: Project dependencies vs plugin dependencies for a mojo looking at the project
The users of my plugin define a dependency which the mojo unpacks and extracts certain files from. You know that such a plugin already exists? maven-dependency-plugin:unpack / unpack-dependencies ? https://maven.apache.org/plugins/maven-dependency-plugin/examples/unpacking-artifacts.html I knew one must exist, but I hadn't looked at the docs - interesting. The reason why I wrote it myself was to try to avoid the duplication of configuration items, to try to keep it succinct. Otherwise the user would have to enter the desired file names twice (or more) - once to extract it, and again to feed it into the next mojo where the file contents are used. Furthermore the question is why do you need only certain files from it ? It's a shared configuration file archive used by several projects. Not the greatest idea, I know. You can give this via the plugin configuration and which means your plugin must resolve it's dependencies and make a required download for it...which can be easily done by using a maven-artifact-transfer[3]. [3]: https://maven.apache.org/shared/maven-artifact-transfer/install-project.html Yes, true, but to try to keep it all succinct and intuitive, I figured it is best to make it a real dependency from the XML point-of-view. - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: Project dependencies vs plugin dependencies for a mojo looking at the project
Hi, On 13/09/17 23:29, Adam Hardy wrote: On 12/09/17 18:05, Adam Hardy wrote: when I'm coding a mojo, if I call MavenProject's getArtifacts(), I can only get artifacts from the project level dependencies. How do I obtain artifacts from a plugin's dependencies? The question which comes to my mind: Why do you need the dependencies of your own ? Aren't the defined in your plugin's pom ? Maybe I misunderstand a thing here? Presumably I call something like project.getPlugin(key).getDependencies()? If the 'key' required for project.getPlugin(key) is of the form myGroup:myPlugin:version e.g. com.megacorp:thing-plugin:1.0.2 can I get my mojo's own key programmatically in the mojo to avoid hard-coding it? Can you please explain what you are trying to accomplish ? The users of my plugin define a dependency which the mojo unpacks and extracts certain files from. You know that such a plugin already exists? maven-dependency-plugin:unpack / unpack-dependencies ? https://maven.apache.org/plugins/maven-dependency-plugin/examples/unpacking-artifacts.html Furthermore the question is why do you need only certain files from it ? At the moment, I have coded the plugin to take the groupId and artifactId of this dependency via the mojo config. Sounds good so far...so counting one place... something like this. ... .. .. .. Group to be unpacked artifact of being upackage ... This strikes me as doppel gemoppelt I assume you mean duplicated ? ( I understand that; But only a few people here on the list have german background). for the user to put that info in twice. >I thought I could just enter it once as a plugin dependency in the user project pom - assuming it would be the only one. What do you think will the usage as plugin depenency change ? You can give this via the plugin configuration and which means your plugin must resolve it's dependencies and make a required download for it...which can be easily done by using a maven-artifact-transfer[3]. But I don't see the requirement to define it in two place ? Kind regards Karl Heinz Marbaise [1]: https://maven.apache.org/plugins/maven-dependency-plugin/unpack-mojo.html [2]: https://maven.apache.org/plugins/maven-dependency-plugin/unpack-dependencies-mojo.html [3]: https://maven.apache.org/shared/maven-artifact-transfer/install-project.html - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: Project dependencies vs plugin dependencies for a mojo looking at the project
On 12/09/17 18:05, Adam Hardy wrote: when I'm coding a mojo, if I call MavenProject's getArtifacts(), I can only get artifacts from the project level dependencies. How do I obtain artifacts from a plugin's dependencies? The question which comes to my mind: Why do you need the dependencies of your own ? Aren't the defined in your plugin's pom ? Maybe I misunderstand a thing here? Presumably I call something like project.getPlugin(key).getDependencies()? If the 'key' required for project.getPlugin(key) is of the form myGroup:myPlugin:version e.g. com.megacorp:thing-plugin:1.0.2 can I get my mojo's own key programmatically in the mojo to avoid hard-coding it? Can you please explain what you are trying to accomplish ? The users of my plugin define a dependency which the mojo unpacks and extracts certain files from. At the moment, I have coded the plugin to take the groupId and artifactId of this dependency via the mojo config. This strikes me as doppel gemoppelt for the user to put that info in twice. I thought I could just enter it once as a plugin dependency in the user project pom - assuming it would be the only one. Regards Adam - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: Project dependencies vs plugin dependencies for a mojo looking at the project
Hi Adam, On 12/09/17 18:05, Adam Hardy wrote: Hi, when I'm coding a mojo, if I call MavenProject's getArtifacts(), I can only get artifacts from the project level dependencies. How do I obtain artifacts from a plugin's dependencies? The question which comes to my mind: Why do you need the dependencies of your own ? Aren't the defined in your plugin's pom ? Maybe I misunderstand a thing here? Presumably I call something like project.getPlugin(key).getDependencies()? If the 'key' required for project.getPlugin(key) is of the form myGroup:myPlugin:version e.g. com.megacorp:thing-plugin:1.0.2 can I get my mojo's own key programmatically in the mojo to avoid hard-coding it? Can you please explain what you are trying to accomplish ? Thanks Adam Kind regards Karl Heinz Marbaise - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Project dependencies vs plugin dependencies for a mojo looking at the project
Hi, when I'm coding a mojo, if I call MavenProject's getArtifacts(), I can only get artifacts from the project level dependencies. How do I obtain artifacts from a plugin's dependencies? Presumably I call something like project.getPlugin(key).getDependencies()? If the 'key' required for project.getPlugin(key) is of the form myGroup:myPlugin:version e.g. com.megacorp:thing-plugin:1.0.2 can I get my mojo's own key programmatically in the mojo to avoid hard-coding it? Thanks Adam
How to run dependency:unpack-dependencies for plugin dependencies?
Hi, I have an issue I am not able to find an answer to. How do I configure *dependency:unpack-dependencies* to process dependencies declared inside the section? There are three artifacts in this story: "product", "plugin" and "compiler". - "Plugin" depends on a "compiler" of a particular version. - In order to create "product", I need to download "plugin", its "compiler" and unpack them (they contain binaries I need to run) - The usage of "product" should not depend on "plugin", therefore I declared dependency on it inside the section. The plugin (and compiler) are only needed to build the artifact, not to use it. The problem is that it seems the *dependency:unpack-dependencies* Maven plugin only looks for project dependencies, not plugin dependencies. *dependency:unpack* is able to unpack a plugin dependency, but I need to explicitly state its GAVC, which I do not know (for the transitive dependency - compiler). Detailed question on SO is here: http://stackoverflow.com/questions/37304236/maven-unpack-dependencies-of-a-plugin-dependency Thank you all -- *Martin Melka *| *Junior Release Engineer* *AVAST Software s.r.o.* | Budějovická 1518/13a | 140 00 Praha 4 *M* +420 721 113 324 *E* me...@avast.com <em...@avast.com> | *W* www.avast.com
Re: Custom Plugin adding project dependencies to Plugin classpath
How do I enhance my plugin classpath with the project dependencies? I found some old posts none of them seem to work. Can you not specify them yourself manually? If the plugin needs them, it needs to declare that somewhere so Maven can provide them at the proper time. Wayne - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: How to set the dependencies of plugin?
Add a dependencies section to the plugin On 22 February 2012 05:48, zhaoyi youhaod...@gmail.com wrote: I am using a maven plugin which has some dependencies. How can I modify the plugin's dependencies in my pom.xml? -- View this message in context: http://maven.40175.n5.nabble.com/How-to-set-the-dependencies-of-plugin-tp5504204p5504204.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 - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
How to set the dependencies of plugin?
I am using a maven plugin which has some dependencies. How can I modify the plugin's dependencies in my pom.xml? -- View this message in context: http://maven.40175.n5.nabble.com/How-to-set-the-dependencies-of-plugin-tp5504204p5504204.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
How to access project dependencies inside plugin?!
Its possible to do that?! I tried: /** * The set of dependencies for the web application being run. * * @parameter default-value = ${project.artifacts} * @required * @readonly */ private Set dependencies; But doenst work, the set is empty. tkz. -- Paulo Cesar Silva Reis --- Powered by GMAIL
Re: How to access project dependencies inside plugin?!
done, closed, tkz! On 5/31/07, CasMeiron [EMAIL PROTECTED] wrote: Its possible to do that?! I tried: /** * The set of dependencies for the web application being run. * * @parameter default-value = ${project.artifacts} * @required * @readonly */ private Set dependencies; But doenst work, the set is empty. tkz. -- Paulo Cesar Silva Reis --- Powered by GMAIL -- Paulo Cesar Silva Reis --- Powered by GMAIL
Dependencies for plugin
Hello, is there a way to specify dependencies for project when running this plugin? I know there is a support for dependencies for plugin: plugin dependency /dependency /plugin But I think this is not what I need. I am developing Seam archetype. I want to have project without dependency on JBoss microcontainer. But when I run it with jetty:run I want it to be run with microcontainer (so it is in application classpath). Is there a way for that? I think it is not because some archetypes uses profiles for it: mvn jetty:run -PjettyConfig Thanks. -- Petr Ferschmann SoftEU s.r.o. --- Sady Petatricatniku 31 301 00 Plzen Czech Republic --- Phone: +420 373 729 300 Fax: +420 373 729 301 Cell: +420 775 638 008 E-mail: [EMAIL PROTECTED]
Re: [m2-book] maven dependencies graph plugin?
On 01.05.2006, at 10:43, Wim Deblauwe wrote: in the book there is talk of a maven dependencies graph plugin. Is the work on that already started? I know there is a page[1] on the wiki about it but I don't have a clue if someone started to work on that? It shouldn't be too hard to produce a dependency graph using Graphviz's Dot notation. LinguineMaps already uses Graphviz for visualizing Hibernate mappings, WSDL, Ant files, etc. The drawback is that the official Dot renderer isn't Java, which makes integration a bit more clumsy than it should be. Last time I looked, there was no pure Java implementation, but maybe that has changed in the meantime. Personally, I render dot files using OmniGraffle Pro (Mac OS X only), which produces the best looking output for simple stuff. Cheers, -Ralph. -- Graphviz http://www.graphviz.org Graphviz Dot http://www.graphviz.org/doc/info/lang.html LinguineMaps http://www.softwaresecretweapons.com/jspwiki/Wiki.jsp?page=LinguineMaps OmniGraffle Pro http://www.omnigroup.com/applications/omnigraffle/pro/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [m2-book] maven dependencies graph plugin?
It probably produces very nice graphs, but the 2 drawbacks (no pure Java implementation and only on Mac OS) seem too much to have a good solution in my opinion. regards, Wim 2006/5/2, Ralph Pöllath [EMAIL PROTECTED]: On 01.05.2006, at 10:43, Wim Deblauwe wrote: in the book there is talk of a maven dependencies graph plugin. Is the work on that already started? I know there is a page[1] on the wiki about it but I don't have a clue if someone started to work on that? It shouldn't be too hard to produce a dependency graph using Graphviz's Dot notation. LinguineMaps already uses Graphviz for visualizing Hibernate mappings, WSDL, Ant files, etc. The drawback is that the official Dot renderer isn't Java, which makes integration a bit more clumsy than it should be. Last time I looked, there was no pure Java implementation, but maybe that has changed in the meantime. Personally, I render dot files using OmniGraffle Pro (Mac OS X only), which produces the best looking output for simple stuff. Cheers, -Ralph. -- Graphviz http://www.graphviz.org Graphviz Dot http://www.graphviz.org/doc/info/lang.html LinguineMaps http://www.softwaresecretweapons.com/jspwiki/Wiki.jsp?page=LinguineMaps OmniGraffle Pro http://www.omnigroup.com/applications/omnigraffle/pro/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [m2-book] maven dependencies graph plugin?
You need to have graphviz installed, which makes it not portable enough. Prefuse understand graphml xml formats so it's really nice. On 5/2/06, Ralph Pöllath [EMAIL PROTECTED] wrote: On 02.05.2006, at 10:55, Wim Deblauwe wrote: It probably produces very nice graphs, but the 2 drawbacks (no pure Java implementation and only on Mac OS) seem too much to have a good solution in my opinion. Just for clarification, Graphviz itself is GPL and cross-platform. OmniGraffle Pro is a commercial diagramming application for Mac OS that understands Graphviz's dot notation. Cheers, -Ralph. 2006/5/2, Ralph Pöllath [EMAIL PROTECTED]: On 01.05.2006, at 10:43, Wim Deblauwe wrote: in the book there is talk of a maven dependencies graph plugin. Is the work on that already started? I know there is a page[1] on the wiki about it but I don't have a clue if someone started to work on that? It shouldn't be too hard to produce a dependency graph using Graphviz's Dot notation. LinguineMaps already uses Graphviz for visualizing Hibernate mappings, WSDL, Ant files, etc. The drawback is that the official Dot renderer isn't Java, which makes integration a bit more clumsy than it should be. Last time I looked, there was no pure Java implementation, but maybe that has changed in the meantime. Personally, I render dot files using OmniGraffle Pro (Mac OS X only), which produces the best looking output for simple stuff. Cheers, -Ralph. -- Graphviz http://www.graphviz.org Graphviz Dot http://www.graphviz.org/doc/info/lang.html LinguineMaps http://www.softwaresecretweapons.com/jspwiki/Wiki.jsp? page=LinguineMaps OmniGraffle Pro http://www.omnigroup.com/applications/omnigraffle/pro/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- I could give you my word as a Spaniard. No good. I've known too many Spaniards. -- The Princess Bride - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [m2-book] maven dependencies graph plugin?
I have a small thing that I did http://people.apache.org/~carlos/grafo/graphview.html I have to add it to the sandbox I've added a proposal for Google Summer Of Code http://wiki.apache.org/general/SummerOfCode2006 On 5/1/06, Wim Deblauwe [EMAIL PROTECTED] wrote: Hi, in the book there is talk of a maven dependencies graph plugin. Is the work on that already started? I know there is a page[1] on the wiki about it but I don't have a clue if someone started to work on that? regards, Wim [1] http://docs.codehaus.org/display/MAVEN/Dependency+Graphing -- I could give you my word as a Spaniard. No good. I've known too many Spaniards. -- The Princess Bride - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Dependencies on plugin classpath
Hi, I'm a new maven user and I have a plugin for 1.0.2 that is having trouble finding it's jars in a local repository even though I've defined them in the dependencies. It's purpose is to extract business rules from a local rule repository and then package deploy them to a remote server. Appended is the output of '-e', it's reporting that it can't find one of the jndi classes. This class is in jnp-client-4.0.jar and I've included this in the project.xml dependency list. I know it's finding it because if I mangle the name it carps about not finding it. The jellybean works thru a test class in eclipse so I don't believe it's a code issue. What puzzles me is that there are other outside classes used in the bean before the jndi context that are found on the classpath. Can someone help me get this jellybean's classpath working? Thanks, Darren If it helps, here's my plugin.jelly file: ?xml version=1.0? project xmlns:ant=jelly:ant xmlns:define=jelly:define xmlns:jrulesdeployer=jrulesdeployer define:taglib uri=jrulesdeployer define:jellybean name=jrulesdeployer className=com.emdeon.phoenix.jrules.deploy.JRulesRuleAppDeployer method=exportRuleApps / /define:taglib goal name=jrules-ruleapp-quality-deploy description=Deploy Quality Measures IRL files jrulesdeployer:jrulesdeployer var=rd repositoryPath=${medOne.jrules.deploy.quality.repositoryPath} ruleAppMajorVersion=${medOne.jrules.deploy.quality.ruleApp.majorVersion} ruleAppMinorVersion=${medOne.jrules.deploy.quality.ruleApp.minorVersion} / /goal /project Stack trace: BUILD FAILED javax.naming.NoInitialContextException: Cannot instantiate class: org.jnp.interfaces.NamingContextFactory [Root exception is java.lang.ClassNotFoundException: org/jnp/interfaces/NamingContextFactory] at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:652) at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:243) at javax.naming.InitialContext.init(InitialContext.java:219) at javax.naming.InitialContext.init(InitialContext.java:195) at com.emdeon.phoenix.jrules.deploy.JRulesRuleAppDeployer.connect(JRulesRuleAppDeployer.java:92) at com.emdeon.phoenix.jrules.deploy.JRulesRuleAppDeployer.exportRuleApps(JRulesRuleAppDeployer.java:70) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.apache.commons.jelly.impl.DynamicBeanTag.doTag(DynamicBeanTag.java:230) at org.apache.commons.jelly.impl.StaticTagScript.run(StaticTagScript.java:145) at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:135) at org.apache.maven.jelly.tags.werkz.MavenGoalTag.runBodyTag(MavenGoalTag.java:79) at org.apache.maven.jelly.tags.werkz.MavenGoalTag$MavenGoalAction.performAction(MavenGoalTag.java:110) at com.werken.werkz.Goal.fire(Goal.java:639) at com.werken.werkz.Goal.attain(Goal.java:575) at com.werken.werkz.WerkzProject.attainGoal(WerkzProject.java:193) at org.apache.maven.jelly.tags.werkz.MavenAttainGoalTag.doTag(MavenAttainGoalTag.java:127) at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:279) at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:135) at org.apache.maven.jelly.tags.werkz.MavenGoalTag.runBodyTag(MavenGoalTag.java:79) at org.apache.maven.jelly.tags.werkz.MavenGoalTag$MavenGoalAction.performAction(MavenGoalTag.java:110) at com.werken.werkz.Goal.fire(Goal.java:639) at com.werken.werkz.Goal.attain(Goal.java:575) at org.apache.maven.plugin.PluginManager.attainGoals(PluginManager.java:671) at org.apache.maven.MavenSession.attainGoals(MavenSession.java:263) at org.apache.maven.cli.App.doMain(App.java:488) at org.apache.maven.cli.App.main(App.java:1239) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at com.werken.forehead.Forehead.run(Forehead.java:551) at com.werken.forehead.Forehead.main(Forehead.java:581) Caused by: java.lang.ClassNotFoundException: org/jnp/interfaces/NamingContextFactory at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:219) at com.sun.naming.internal.VersionHelper12.loadClass(VersionHelper12.java:42) at
RE: Dependencies on plugin classpath
I have a target in one of my ant plugin as below: target name=activate description=Forces a package activate of supplied packages into the running IS container. java classname=com.ncc.Fusion.webMethods.test.IntegrationServerSixOhOneClien t fork=on timeout=10 classpath refid=dependency.classpath / !-- classpath pathelement location=${build} / path refid=classpath.all / /classpath -- arg value=activate-package / arg value=-PANYTHING / /java /target I do have a jar installed in my repository containing com.ncc.Fusion.webMethods.test.IntegrationServerSixOhOneClient. It is included in my plugin's dependencies tag. I am still getting ClassNotFoundException. Please advise. Thanks, Sandeep --- ***National City made the following annotations --- This communication is a confidential and proprietary business communication. It is intended solely for the use of the designated recipient(s). If this communication is received in error, please contact the sender and delete this communication. === - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Project dependencies and plugin classloaders
Hi, I have a project (A) which uses the maven-jaxme-plugin. The plugin allows to configure so-called factory chains. Think of them as plugins for the plugin. I have another project (B), which implements such a factory chain. Project B is one of the dependencies of A. However, the plugin fails to load the classes from B. In other words, the plugins classpath is obviously different from the projects classpath. Do I need to extend the plugins classpath? By looking at the projects dependency list? If so, how do I do that? Regards, Jochen -- Often it does seem a pity that Noah and his party did not miss the boat. (Mark Twain) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Project dependencies and plugin classloaders
Here's how. (I did this for a kodo plugin I'm finishing up) /** * Adds nessessary items to the classloader. * * @return ClassLoader original Classloader. * @throws MojoExecutionException */ public ClassLoader setupClassloader() throws MojoExecutionException { URLClassLoader loader = null; ClassLoader originalLoader = Thread.currentThread().getContextClassLoader(); URL[] urls = buildClassPathURLs(); loader = new URLClassLoader( urls, originalLoader ); Thread.currentThread().setContextClassLoader( loader ); printClassPath(); return originalLoader; } /** * Build the array of URLs to add to new ClassLoader * * @return * @throws MojoExecutionException */ private URL[] buildClassPathURLs() throws MojoExecutionException { ArrayList urls = new ArrayList(); Iterator iter = resources.iterator(); try { //add the Resource locations as urls while ( iter.hasNext() ) { Resource resource = (Resource) iter.next(); urls.add( new URL( file:/// + resource.getDirectory() + / ) ); } //add the outputDirectory // urls.add(new URL( file:/// + classDir.getAbsolutePath() + / // )); //add the extra files to classpath if ( null != extraClassPathItems ) { for ( int i = 0; i extraClassPathItems.length; i++ ) { urls.add( buildURL( extraClassPathItems[i] ) ); } } } catch ( MalformedURLException e ) { throw new MojoExecutionException( Nested:, e ); } //convert back to array URL[] urlArray = (URL[]) urls.toArray( new URL[urls.size()] ); return urlArray; } -Original Message- From: Jochen Wiedmann [mailto:[EMAIL PROTECTED] Sent: Wednesday, December 14, 2005 7:57 AM To: Maven Users List Subject: Project dependencies and plugin classloaders Hi, I have a project (A) which uses the maven-jaxme-plugin. The plugin allows to configure so-called factory chains. Think of them as plugins for the plugin. I have another project (B), which implements such a factory chain. Project B is one of the dependencies of A. However, the plugin fails to load the classes from B. In other words, the plugins classpath is obviously different from the projects classpath. Do I need to extend the plugins classpath? By looking at the projects dependency list? If so, how do I do that? Regards, Jochen -- Often it does seem a pity that Noah and his party did not miss the boat. (Mark Twain) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Project dependencies and plugin classloaders
Brian E. Fox wrote: Here's how. (I did this for a kodo plugin I'm finishing up) Thanks, that helped! :-) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[m2] can't get list of dependencies in plugin
I've been bashing my head against a brick wall trying to get the list of artifacts back from the project object for my plugin but project.getArtifacts() always returns an empty list whereas I expect the list of artifacts corresponding to the target pom dependency tags. 1. I recreated the problem by creating a default project like so: m2 archetype:create -DgroupId=acme -DartifactId=test - DarchetypeArtifactId=maven-archetype-mojo 2. then I replaced the generated mojo with this class that has a goal called test and whose execute method just prints out the artifacts size and it always prints out zero: package com.mycompany; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.project.MavenProject; /** * Test Mojo * * @goal test * * @execute phase=generate-sources */ public class MyMojo extends AbstractMojo { /** * @parameter expression=${project} * @required */ private MavenProject project; public void execute() throws MojoExecutionException { System.out.println(project.getName()= + project.getName()); System.out.println(project.getArtifacts().size()= + project.getArtifacts().size()); } } (So that it would compile I had to add a dependency in the pom: dependency groupIdorg.apache.maven/groupId artifactIdmaven-project/artifactId version2.0-beta-1-SNAPSHOT/version /dependency) 3. Finally I ran the plugin in the same directory as my target poms like so: m2 acme:test:1.0-SNAPSHOT:test and got the following results no matter which pom I ran it against: project.getName()=MBean Demo project.getArtifacts().size()=0 Notice that the name that is printed corresponds to the target pom so the plugin does manage to pick up some details ok. Maybe I should get the dependencies using a different api, but its the same call used by the eclipse plugin at EclipseWriter.writeEclipseClasspath just before the call to addDependency(). Anyone shed any light? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [m2] can't get list of dependencies in plugin
On Tue, Sep 06, 2005 at 12:52:01PM +0100, Ashley Williams wrote: I've been bashing my head against a brick wall trying to get the list of artifacts back from the project object for my plugin but project.getArtifacts() always returns an empty list whereas I expect the list of artifacts corresponding to the target pom dependency tags. 1. I recreated the problem by creating a default project like so: m2 archetype:create -DgroupId=acme -DartifactId=test - DarchetypeArtifactId=maven-archetype-mojo 2. then I replaced the generated mojo with this class that has a goal called test and whose execute method just prints out the artifacts size and it always prints out zero: package com.mycompany; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.project.MavenProject; /** * Test Mojo * * @goal test * * @execute phase=generate-sources I think you need to add @requiresDependencyResolution [compile|test|runtime] here. See [1] for the complete reference. */ public class MyMojo extends AbstractMojo { /** * @parameter expression=${project} * @required */ private MavenProject project; public void execute() throws MojoExecutionException { System.out.println(project.getName()= + project.getName()); System.out.println(project.getArtifacts().size()= + project.getArtifacts().size()); } } (So that it would compile I had to add a dependency in the pom: dependency groupIdorg.apache.maven/groupId artifactIdmaven-project/artifactId version2.0-beta-1-SNAPSHOT/version /dependency) You should not have a dependency on MavenProject (and thus maven-project) because this makes your mojo Maven specific. Instead have two parameters and expressions like this: @parameter expression=${project.name} @parameter expression=${project.artifacts} 3. Finally I ran the plugin in the same directory as my target poms like so: m2 acme:test:1.0-SNAPSHOT:test and got the following results no matter which pom I ran it against: project.getName()=MBean Demo project.getArtifacts().size()=0 Notice that the name that is printed corresponds to the target pom so the plugin does manage to pick up some details ok. Maybe I should get the dependencies using a different api, but its the same call used by the eclipse plugin at EclipseWriter.writeEclipseClasspath just before the call to addDependency(). Anyone shed any light? [1]: http://maven.apache.org/maven2/developers/mojo-api-specification.html -- Trygve signature.asc Description: Digital signature
Re: [m2] can't get list of dependencies in plugin
You need to add: @requiresDependencyResolution HTH, Brett On 9/6/05, Ashley Williams [EMAIL PROTECTED] wrote: I've been bashing my head against a brick wall trying to get the list of artifacts back from the project object for my plugin but project.getArtifacts() always returns an empty list whereas I expect the list of artifacts corresponding to the target pom dependency tags. 1. I recreated the problem by creating a default project like so: m2 archetype:create -DgroupId=acme -DartifactId=test - DarchetypeArtifactId=maven-archetype-mojo 2. then I replaced the generated mojo with this class that has a goal called test and whose execute method just prints out the artifacts size and it always prints out zero: package com.mycompany; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.project.MavenProject; /** * Test Mojo * * @goal test * * @execute phase=generate-sources */ public class MyMojo extends AbstractMojo { /** * @parameter expression=${project} * @required */ private MavenProject project; public void execute() throws MojoExecutionException { System.out.println(project.getName()= + project.getName()); System.out.println(project.getArtifacts().size()= + project.getArtifacts().size()); } } (So that it would compile I had to add a dependency in the pom: dependency groupIdorg.apache.maven/groupId artifactIdmaven-project/artifactId version2.0-beta-1-SNAPSHOT/version /dependency) 3. Finally I ran the plugin in the same directory as my target poms like so: m2 acme:test:1.0-SNAPSHOT:test and got the following results no matter which pom I ran it against: project.getName()=MBean Demo project.getArtifacts().size()=0 Notice that the name that is printed corresponds to the target pom so the plugin does manage to pick up some details ok. Maybe I should get the dependencies using a different api, but its the same call used by the eclipse plugin at EclipseWriter.writeEclipseClasspath just before the call to addDependency(). Anyone shed any light? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [m2] can't get list of dependencies in plugin
Looking forward to trying this out when my latest svn maven build gives me my machine back. Since I'm not modifying Maven, is there some way of turning off testing to reduce the build time?? Some related questions: what do the project.getDependencies() and project.getdependencyArtifacts do - they look more promising than project.getArtifacts() for my purposes. Are there any Javadocs so that I can find this sort of thing out for myself?? On 6 Sep 2005, at 12:58, Trygve Laugstøl wrote: On Tue, Sep 06, 2005 at 12:52:01PM +0100, Ashley Williams wrote: I've been bashing my head against a brick wall trying to get the list of artifacts back from the project object for my plugin but project.getArtifacts() always returns an empty list whereas I expect the list of artifacts corresponding to the target pom dependency tags. 1. I recreated the problem by creating a default project like so: m2 archetype:create -DgroupId=acme -DartifactId=test - DarchetypeArtifactId=maven-archetype-mojo 2. then I replaced the generated mojo with this class that has a goal called test and whose execute method just prints out the artifacts size and it always prints out zero: package com.mycompany; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.project.MavenProject; /** * Test Mojo * * @goal test * * @execute phase=generate-sources I think you need to add @requiresDependencyResolution [compile|test|runtime] here. See [1] for the complete reference. */ public class MyMojo extends AbstractMojo { /** * @parameter expression=${project} * @required */ private MavenProject project; public void execute() throws MojoExecutionException { System.out.println(project.getName()= + project.getName()); System.out.println(project.getArtifacts().size()= + project.getArtifacts().size()); } } (So that it would compile I had to add a dependency in the pom: dependency groupIdorg.apache.maven/groupId artifactIdmaven-project/artifactId version2.0-beta-1-SNAPSHOT/version /dependency) You should not have a dependency on MavenProject (and thus maven- project) because this makes your mojo Maven specific. Instead have two parameters and expressions like this: @parameter expression=${project.name} @parameter expression=${project.artifacts} 3. Finally I ran the plugin in the same directory as my target poms like so: m2 acme:test:1.0-SNAPSHOT:test and got the following results no matter which pom I ran it against: project.getName()=MBean Demo project.getArtifacts().size()=0 Notice that the name that is printed corresponds to the target pom so the plugin does manage to pick up some details ok. Maybe I should get the dependencies using a different api, but its the same call used by the eclipse plugin at EclipseWriter.writeEclipseClasspath just before the call to addDependency(). Anyone shed any light? [1]: http://maven.apache.org/maven2/developers/mojo-api- specification.html -- Trygve - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [m2] plugins as dependencies vs plugin in build/
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 I'm not 100% sure when I say this, but you should NEVER need to specify a plugin as a dependency of a project. It will not be bound into the build lifecycle, and cannot be configured here...in short, it's not seen as a plugin, but as a compile-, run-, or test-time dependency ONLY. See MNG-361 for more info (http://jira.codehaus.org/browse/MNG-361). - -john J. Matthew Pryor wrote: What are the practical differences of specifying a POM dependency of type plugin dependency groupIdorg.apache.maven.plugins/groupId artifactIdmaven-compiler-plugin/artifactId version1.0-alpha-2-SNAPSHOT/version typeplugin/type scopeWHAT WOULD GO HERE/scope dependency vs. a plugin entry in build/ build plugins plugin groupIdorg.apache.maven.plugins/groupId artifactIdmaven-compiler-plugin/artifactId version1.0-alpha-2-SNAPSHOT/version configuration source1.5/source target1.5/target /configuration /plugin /plugins /build I assume configuration cannot be specified in a plugin dependency When will a new plugin or a new version of a plugin get downloaded installed? When will the classpath be affected? Does one imply the other? Thanks for any clarification Matthew - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -BEGIN PGP SIGNATURE- Version: GnuPG v1.2.6 (GNU/Linux) iD8DBQFCb88RK3h2CZwO/4URAhzXAJ9JFuSWvelRS6NoOJQR64nFlWj6dQCggfs9 LgySSVeWSj82/ZQYbQOxR0c= =dvIf -END PGP SIGNATURE- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: plugin dependencies for plugin user
Thanks that works. I am now hoping to also be able to include the actual dependency classpath from the user project as well. i.e. AndroMDA has a base set of plugins. It will search the classpath for others. I would like it to be able to find any other AndroMDA plugins that are specified in the project.xml of the project using my AndroMDA maven plugin. I have tried this: path id=maven-andromda.classpath pathelement location=${plugin.getDependencyPath('commons-collections:commons-collection s')}/ [snip] path refid=maven.dependency.classpath/ /path taskdef name=andromda classname=org.andromda.core.anttasks.AndroMDAGenTask classpath path refid=maven-andromda.classpath/ /classpath /taskdef but maven.dependency.classpath seems to be empty, despite there being entries in the user project dependencies section Have I got something obvious wrong? Thanks, Matthew -Original Message- From: Brett Porter [mailto:[EMAIL PROTECTED] Sent: Monday, November 17, 2003 11:27 AM To: 'Maven Users List' Subject: RE: plugin dependencies for plugin user Hi, Maven.dependency.classpath only uses what is in the project's descriptor, however if you are just building an ant classpath you can create the path with your plugin's dependencies using dependency.getPath. Here is an example from cactus: ant:path id=cactus.classpath pathelement location=${plugin.getDependencyPath('cactus:cactus-ant')}/ pathelement location=${plugin.getDependencyPath('cactus:cactus')}/ pathelement location=${plugin.getDependencyPath('commons-logging:commons-logging')}/ pathelement location=${plugin.getDependencyPath('junit:junit')}/ pathelement location=${plugin.getDependencyPath('commons-httpclient:commons-httpclient' )}/ pathelement location=${plugin.getDependencyPath('aspectj:aspectjrt')}/ pathelement location=${plugin.getDependencyPath('httpunit:httpunit')}/ pathelement location=${plugin.getDependencyPath('nekohtml:nekohtml')}/ pathelement location=${plugin.getDependencyPath('xerces:xerces')}/ pathelement location=${plugin.getDependencyPath('xml-apis:xml-apis')}/ pathelement location=${plugin.getDependencyPath('rhino:js')}/ /ant:path ant:taskdef resource=cactus.tasks classpathref=cactus.classpath/ Cheers, Brett -Original Message- From: J. Matthew Pryor [mailto:[EMAIL PROTECTED] Sent: Monday, 17 November 2003 11:14 AM To: [EMAIL PROTECTED] Subject: plugin dependencies for plugin user Hello, I am writing an AndroMDA (http://www.adnromda.org) plugin for Maven and basically have it working but I am having trouble understanding dependencies. The AndroMDA pluging requires a bunch of jars to compile (but mostly at runtime). I have listed these in the dependencies section of the project.xml for the plugin. I can compile install the plugin no problem. However the only way I can get it to work is by duplicating the dependcy list from the plugin into the project.xml file of the project that uses the plugin. I don't think this is the right thing to do, it seems like a workaround. I have read all I can and searched archives but cannot find the answer to have these dependencies flow through to the project that uses the plugin. This may be complicated by the fact that the plugin.jelly has to do an Ant taskdef, I perform it like this: taskdef name=andromda classname=org.andromda.core.anttasks.AndroMDAGenTask classpath path refid=maven.dependency.classpath/ /classpath /taskdef But the taskdef fails unless I have all of the required JARs for AndroMDA in the dependencies section of the project that simply wants to use the AndroMDA plugin. Does that piece of Jelly code refer to the maven.dependency.classpath of the plugin or of the project using the plugin? Is this normal? Is there some other way to manage the depencies? I tried declaring the AndroMDA plugin in the depencies section as a typeplugin/type, but that didn't solve the problem I hope I have provided enough information. Links to previsous posts I missed or documenation I missed would be appreciated Thanks, Matthew __ Do you Yahoo!? Protect your identity with Yahoo! Mail AddressGuard http://antispam.yahoo.com/whatsnewfree - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do you Yahoo!? Free Pop-Up Blocker - Get it now http://companion.yahoo.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED
RE: plugin dependencies for plugin user
Remind me to use maven contentvalidate in future so I can diagnose my own typos ... problem solved, badly formed dependencies section jmp -Original Message- From: J. Matthew Pryor [mailto:[EMAIL PROTECTED] Sent: Friday, November 21, 2003 2:03 PM To: Maven Users List Subject: RE: plugin dependencies for plugin user Thanks that works. I am now hoping to also be able to include the actual dependency classpath from the user project as well. i.e. AndroMDA has a base set of plugins. It will search the classpath for others. I would like it to be able to find any other AndroMDA plugins that are specified in the project.xml of the project using my AndroMDA maven plugin. I have tried this: path id=maven-andromda.classpath pathelement location=${plugin.getDependencyPath('commons-collections:commons-collection s')}/ [snip] path refid=maven.dependency.classpath//path taskdef name=andromda classname=org.andromda.core.anttasks.AndroMDAGenTask classpath path refid=maven-andromda.classpath/ /classpath/taskdef but maven.dependency.classpath seems to be empty, despite there being entries in the user project dependencies section Have I got something obvious wrong? Thanks, Matthew -Original Message- From: Brett Porter [mailto:[EMAIL PROTECTED] Sent: Monday, November 17, 2003 11:27 AM To: 'Maven Users List' Subject: RE: plugin dependencies for plugin user Hi, Maven.dependency.classpath only uses what is in the project's descriptor, however if you are just building an ant classpath you can create the path with your plugin's dependencies using dependency.getPath. Here is an example from cactus: ant:path id=cactus.classpath pathelement location=${plugin.getDependencyPath('cactus:cactus-ant')}/ pathelement location=${plugin.getDependencyPath('cactus:cactus')}/ pathelement location=${plugin.getDependencyPath('commons-logging:commons-logging')}/ pathelement location=${plugin.getDependencyPath('junit:junit')}/ pathelement location=${plugin.getDependencyPath('commons-httpclient:commons-httpclient' )}/ pathelement location=${plugin.getDependencyPath('aspectj:aspectjrt')}/ pathelement location=${plugin.getDependencyPath('httpunit:httpunit')}/ pathelement location=${plugin.getDependencyPath('nekohtml:nekohtml')}/ pathelement location=${plugin.getDependencyPath('xerces:xerces')}/ pathelement location=${plugin.getDependencyPath('xml-apis:xml-apis')}/ pathelement location=${plugin.getDependencyPath('rhino:js')}/ /ant:path ant:taskdef resource=cactus.tasks classpathref=cactus.classpath/ Cheers, Brett -Original Message- From: J. Matthew Pryor [mailto:[EMAIL PROTECTED] Sent: Monday, 17 November 2003 11:14 AM To: [EMAIL PROTECTED] Subject: plugin dependencies for plugin user Hello, I am writing an AndroMDA (http://www.adnromda.org) plugin for Maven and basically have it working but I am having trouble understanding dependencies. The AndroMDA pluging requires a bunch of jars to compile (but mostly at runtime). I have listed these in the dependencies section of the project.xml for the plugin. I can compile install the plugin no problem. However the only way I can get it to work is by duplicating the dependcy list from the plugin into the project.xml file of the project that uses the plugin. I don't think this is the right thing to do, it seems like a workaround. I have read all I can and searched archives but cannot find the answer to have these dependencies flow through to the project that uses the plugin. This may be complicated by the fact that the plugin.jelly has to do an Ant taskdef, I perform it like this:taskdef name=andromda classname=org.andromda.core.anttasks.AndroMDAGenTask classpath path refid=maven.dependency.classpath/ /classpath /taskdef But the taskdef fails unless I have all of the required JARs for AndroMDA in the dependencies section of the project that simply wants to use the AndroMDA plugin. Does that piece of Jelly code refer to the maven.dependency.classpath of the plugin or of the project using the plugin? Is this normal? Is there some other way to manage the depencies? I tried declaring the AndroMDA plugin in the depencies section as a typeplugin/type, but that didn't solve the problem I hope I have provided enough information. Links to previsous posts I missed or documenation I missed would be appreciated Thanks, Matthew __ Do you Yahoo!? Protect your identity with Yahoo! Mail AddressGuard http://antispam.yahoo.com/whatsnewfree - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do you Yahoo!? Free Pop-Up Blocker - Get it now ttp://companion.yahoo.com
RE: plugin dependencies for plugin user
Hi, Maven.dependency.classpath only uses what is in the project's descriptor, however if you are just building an ant classpath you can create the path with your plugin's dependencies using dependency.getPath. Here is an example from cactus: ant:path id=cactus.classpath pathelement location=${plugin.getDependencyPath('cactus:cactus-ant')}/ pathelement location=${plugin.getDependencyPath('cactus:cactus')}/ pathelement location=${plugin.getDependencyPath('commons-logging:commons-logging')}/ pathelement location=${plugin.getDependencyPath('junit:junit')}/ pathelement location=${plugin.getDependencyPath('commons-httpclient:commons-httpclient' )}/ pathelement location=${plugin.getDependencyPath('aspectj:aspectjrt')}/ pathelement location=${plugin.getDependencyPath('httpunit:httpunit')}/ pathelement location=${plugin.getDependencyPath('nekohtml:nekohtml')}/ pathelement location=${plugin.getDependencyPath('xerces:xerces')}/ pathelement location=${plugin.getDependencyPath('xml-apis:xml-apis')}/ pathelement location=${plugin.getDependencyPath('rhino:js')}/ /ant:path ant:taskdef resource=cactus.tasks classpathref=cactus.classpath/ Cheers, Brett -Original Message- From: J. Matthew Pryor [mailto:[EMAIL PROTECTED] Sent: Monday, 17 November 2003 11:14 AM To: [EMAIL PROTECTED] Subject: plugin dependencies for plugin user Hello, I am writing an AndroMDA (http://www.adnromda.org) plugin for Maven and basically have it working but I am having trouble understanding dependencies. The AndroMDA pluging requires a bunch of jars to compile (but mostly at runtime). I have listed these in the dependencies section of the project.xml for the plugin. I can compile install the plugin no problem. However the only way I can get it to work is by duplicating the dependcy list from the plugin into the project.xml file of the project that uses the plugin. I don't think this is the right thing to do, it seems like a workaround. I have read all I can and searched archives but cannot find the answer to have these dependencies flow through to the project that uses the plugin. This may be complicated by the fact that the plugin.jelly has to do an Ant taskdef, I perform it like this: taskdef name=andromda classname=org.andromda.core.anttasks.AndroMDAGenTask classpath path refid=maven.dependency.classpath/ /classpath /taskdef But the taskdef fails unless I have all of the required JARs for AndroMDA in the dependencies section of the project that simply wants to use the AndroMDA plugin. Does that piece of Jelly code refer to the maven.dependency.classpath of the plugin or of the project using the plugin? Is this normal? Is there some other way to manage the depencies? I tried declaring the AndroMDA plugin in the depencies section as a typeplugin/type, but that didn't solve the problem I hope I have provided enough information. Links to previsous posts I missed or documenation I missed would be appreciated Thanks, Matthew __ Do you Yahoo!? Protect your identity with Yahoo! Mail AddressGuard http://antispam.yahoo.com/whatsnewfree - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]