Getting substring of ArtifactId
Hi, I need to have a maven property (say myArtifactId) which gives me a substring of artifactId and then I need to use this maven property (myArtifactId) later on in another plugin execution. I tried using gmaven plugin and I was able to extract and print the substring but I could not update the property value with this new substring value. All I need is to get a substring of artifactId and use it in another plugins's execution. Any idea on how to do this? Thanks, - Raja.
Re: Comparing dependency trees
Wayne, Thanks for the response, diff is one solution but still to manual for my liking. We are using WAR overlays as a sort of deployment description of our application as we have lots of components that can be changed for each deployment for different customers based around a core product. What I want to do is when we do a new deployment for an existing deployment we can produce some report showing what dependencies have changed version, what have been removed and what has been added. Seems like an extension to the dependency plugin to me? Paul On 25 February 2011 04:17, Wayne Fay wayne...@gmail.com wrote: Is there a way of comparing the dependency tree of 2 version of the same POM and printing out the differences? Other than something like this (below), I don't know of any way to do this. mvn dependency:tree 1.txt mvn dependency:tree -f pom-old.xml 2.txt diff 1.txt 2.txt Wayne - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: Release plugin
On 24/02/2011 18:49, Marcin Kuthan wrote: Hi If you need different version for API part it should be set up as separate project. In the API module you probably don't need inherit from myproject-parent. aggregate \_myproject-api \_myproject-impl \_myproject-subsystem1 \_myproject-subsystem2 \_myproject-parent You can release myproject-api and myproject-impl in the independent way. myproject-api and myproject-impl modules don't inherit from aggregate (rather from corporate pom). Hi - thanks. Although I chose myproject-api and myproject-impl as an example, we have many more bundles and the situation is (in general) not as clean as just having one -impl depending on one -api, by the way the project is Apache Aries - see dev@aries for more than you would ever want to read on the subject:-) I think what you are saying is that the only release process that we can apply completely generally across all modules and sub-modules is one in which each bundle (sub-module) is released independently. This seems to be the conclusion that Felix and Sling have come to. Zoe Marcin m4enterprise.googlecode.com On 24 February 2011 12:37, zoe slatteryzoe.slatt...@gmail.com wrote: Hi Karl - thanks for this, but I really _want_ different versions of the bundles, that's the problem. I'd like to be able to follow OSGi semantic versioning for bundles, that means that the versions will necessarily be different for sub-modules. I understand that the alternative is to release each bundle independently (this is what Sling do) - but we have a very large number of bundles and they are usefully grouped into modules. So, I'm looking for some way to override the check that happens in the release prepare, or something like that. It's a bit frustrating that the -DdryRun all works OK :-/ Zoe Hi, the problem i oberserve is that you have different versions in your components. A usual multimodule build contains only a single version number at root. myproject \_myproject-parent (version 1.0.1-SNAPSHOT) \_myproject-api \_myproject-impl All other modules have only a reference to their parent parent groupId../groupId artifactId../artifactId version1.0.1-SNAPSHOT /parent artifactIdmyproject-impl/artifactId Take a look at this simple example: https://github.com/khmarbaise/testprojects Kind regards Karl Heinz Marbaise - Kind regards Karl Heinz Marbaise http://www.soebes.de http://www.skmwiki.de http://supose.org/wiki/supose - 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...@maven.apache.org
Dynamic content generation for a file using maven archetype plugin
I'm creating project using Maven Archtype. I'm adding few xml files to my project using archetype. Now my requirement is to create dynamic content for a config file (xml file) and create actual file at run time when i usages archetype:create plugin. We thought of using velocity form template. Can we use velocity in maven archetype ? or Is there any other way to address this requirement ? - Pankaj -- View this message in context: http://maven.40175.n5.nabble.com/Dynamic-content-generation-for-a-file-using-maven-archetype-plugin-tp3399850p3399850.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
Re: Dynamic content generation for a file using maven archetype plugin
you can simply use ${artifactId}, ${groupId} etc in your xml's which will be replaced at the time of generation. Thanks, Sumit Teke Omniscient Software Pvt Ltd T. +91-20-26680814, Ext. 217 F. +91-20-26680815, Ext. 212 M. +91-9975709032 E. sumit_t...@omniscient.co.in On Friday 25 February 2011 03:16 PM, Pankaj wrote: I'm creating project using Maven Archtype. I'm adding few xml files to my project using archetype. Now my requirement is to create dynamic content for a config file (xml file) and create actual file at run time when i usages archetype:create plugin. We thought of using velocity form template. Can we use velocity in maven archetype ? or Is there any other way to address this requirement ? - Pankaj - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: Release plugin
On 25 February 2011 10:38, zoe slattery zoe.slatt...@gmail.com wrote: On 24/02/2011 18:49, Marcin Kuthan wrote: Hi If you need different version for API part it should be set up as separate project. In the API module you probably don't need inherit from myproject-parent. aggregate \_myproject-api \_myproject-impl \_myproject-subsystem1 \_myproject-subsystem2 \_myproject-parent You can release myproject-api and myproject-impl in the independent way. myproject-api and myproject-impl modules don't inherit from aggregate (rather from corporate pom). Hi - thanks. Although I chose myproject-api and myproject-impl as an example, we have many more bundles and the situation is (in general) not as clean as just having one -impl depending on one -api, by the way the project is Apache Aries - see dev@aries for more than you would ever want to read on the subject:-) Wow, I found information about Aries in my feed reader a few days ago. Interesting concept. But proposed model should work also for projects with complex structure. You can find general idea in Maven Reference: http://www.sonatype.com/books/mvnref-book/reference/pom-relationships-sect-pom-best-practice.html#pom-relationships-sect-multi-vs-inherit Inheritance should not be overused, exactly like in OOP :-) I think what you are saying is that the only release process that we can apply completely generally across all modules and sub-modules is one in which each bundle (sub-module) is released independently. This seems to be the conclusion that Felix and Sling have come to. Yep, release cycle should be reflected in the project structure. Please remember that when you release one bundle, all dependencies to other bundles must be already released. Thanks, Marcin - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: Dynamic content generation for a file using maven archetype plugin
Thanks for your response. Agreed, but how do we pass the custom parameter? for eg. can i substitute ${myParam} with console command -DmyParam=test while using archetype:create command. I had tried this but didn't work for me. I came across with many post related with same problem but didn't find any solution. - Pankaj -- View this message in context: http://maven.40175.n5.nabble.com/Dynamic-content-generation-for-a-file-using-maven-archetype-plugin-tp3399850p345.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
Re: Dynamic content generation for a file using maven archetype plugin
check if this helps http://maven.apache.org/archetype/maven-archetype-plugin/examples/create-with-property-file.html Thanks, Sumit Teke Omniscient Software Pvt Ltd T. +91-20-26680814, Ext. 217 F. +91-20-26680815, Ext. 212 M. +91-9975709032 E. sumit_t...@omniscient.co.in On Friday 25 February 2011 05:46 PM, Pankaj wrote: Thanks for your response. Agreed, but how do we pass the custom parameter? for eg. can i substitute ${myParam} with console command -DmyParam=test while using archetype:create command. I had tried this but didn't work for me. I came across with many post related with same problem but didn't find any solution. - Pankaj - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: PMD'S or findbug's report
Can I think that artifactIdpmd-jdk14/artifactId is to config the JDK's version? if yes, Unfortunately, there is no any info in the pmd report No, this generally means the plugin is coded to work with JDK4 or higher. This means it does not use any special features of JDK5 or 6 that would mean that someone using JDK4 would not be able to use it. I had got error info with it in PMD report (mvn site), but only three. I had got a lot via plugin in Eclipse. that's why I inqured the difference. Again, this list is the wrong place for a detailed discussion on PMD. Please ask their user list for help. Wayne - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Retrieving all available versions of an artifact
Hi all, I'm writing a plug-in and currently need a list of all available versions for a specific artifact. I've found this method: ArtifactMetadataSource.retrieveAvailableVersions which I thought would do this. However, this method does not give the list of available SNAPSHOTs. In my plug-in I want to make sure that the latest version of a certain artifact is used. This version may either be the latest release or a newer SNAPSHOT. But like I said, the method doesn't give me the latest version of the SNAPSHOTs. I figured out already, that this is because the implementation of the above method only checks the remote release repositories. It doesn't look in the local repository (which in my tests contained the SNAPSHOT I was looking for) or the remote snapshot repositories. Does anybody know if there is a method that does exactly what I want, or am I stuck to defining my snapshot repositories to contain releases as well? The latter is a workaround that gets me the artifact, but now Maven tries to resolve all artifacts to that repo as well, and it makes my build that much slower. Any help is greatly appreciated! -- Roland Asmann Senior Software Engineer adesso Austria GmbH Floridotower 26. Stock T +43 1 2198790-27 Floridsdorfer Hauptstr. 1 F +43 1 2198790-927 A-1210 Wien M +43 664 88657566 E roland.asm...@adesso.at W www.adesso.at - business. people. technology. - - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Dependency Resolution and Version Range Conflicts
Hello, the client I currently work for has strange requirements when it comes to maven version ranges. Part 1: Snapshots should not be included in Version Ranges, unless they are specifically mentioned in the upper or lower bound e.g. [0.5,1.0) should not match 0.6-SNAPSHOT [0.6-SNAPSHOT,1.0) should match 0.6-SNAPSHOT, but not 0.6.1-SNAPSHOT (This is loosely equivalent to http://jira.codehaus.org/browse/MNG-3092 , and my client has previously used maven 2.09 with the patch attached to this issue) I have managed to implement this functionality in Maven 3 using a) the patch I contributed to this issue: http://jira.codehaus.org/browse/MNG-5017 and b) a custom VersionScheme implementation that extends GenericVersionScheme and decorates the GenericVersionConstraint objects with the above requirements. Now I just have to hope that MNG-5017 gets accepted (or else my client will again have a complicated migration path for future versions) Part2: It gets even more complicated, unfortunately. My client's requirement is as follows: if a project has several paths to a given dependency and at least one path includes a SNAPSHOT version, then this version should be included in all version constraints for this node Example: [this project] | | | +-- artifactA -- artifactB [0.5,1.0) | +- artifactC -- artifactB [0.4,) in this scenario, version 0.5-SNAPSHOT won't be included [this project] | | | +-- artifactA -- artifactB [0.5-SNAPSHOT,1.0) | +- artifactC -- artifactB [0.4,) in this scenario, version 0.5-SNAPSHOT will be included, as it is included in at least one version range Obviously, I can't implement this requirement with my above approach alone. From what I see so far, I will have to use a DependencyGraphTransformer somehow. I can think of the following approach: a) Implement a DependencyGraphTransformer that is added in the Transformer chain before NearestVersionConflictResolver. b) This Transformer would check all version constraints for the current node to see if this scenario applies. c) If it does, this Transformer would have to change all constraints in the current node to allow snapshots. Since I already use Custom VersionConstraint decorators, b) and c) will be easy to achieve, however a) is the problem. The way I see is to - implement an AbstractMavenLifecycleParticipant and register it as a component (store the artifact in $MAVEN_HOME/lib/ext) - in AbstractMavenLifecycleParticipant.afterSessionStart(session), get the current DependencyGraphTransformer from session.getRepositorySession() - Create a ChainedDependencyGraphTransformer delegating to a) my custom transformer and b) the previous transformer - inject that ChainedDependencyGraphTransformer back into session.getRepository() (probably using org.sonatype.guice.bean.reflect.BeanProperty.set(bean, value)) Would that approach work? Is there a better way to implement this functionality? Thanks in advance, Sean Floyd -- Empfehlen Sie GMX DSL Ihren Freunden und Bekannten und wir belohnen Sie mit bis zu 50,- Euro! https://freundschaftswerbung.gmx.de - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: Getting substring of ArtifactId
All I need is to get a substring of artifactId and use it in another plugins's execution. Any idea on how to do this? For what purpose...? You should probably just put the substring directly into its own property, and use that in the various places where you need it. Wayne - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: recursive release
Thanks. We do use Hudson, but a specific job wouldn't help enough since we have many components and versions changing over time. I really need a general solution, so I think I will just write a plugin. It shouldn't be too hard (fingers crossed). Phillip On Thu, Feb 24, 2011 at 11:24 AM, Baptiste MATHUS m...@batmat.net wrote: No. But as long as you know the versions to use, this is something that would easily achieved using a dedicated jenkins job. This job would simply execute releases in the needed order. Cheers Le 24 févr. 2011 16:34, Phillip Hellewell ssh...@gmail.com a écrit : Apologies if this has been asked before, but is there a plugin that builds upon the release plugin, but that will recursively checkout and release all the snapshot dependencies? Thanks, Phillip - 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
Maven 3 site: how to add report configured in module to parent's report config?
With Maven 3, how do I configure the site plugin to have a module's defined site reports added to the parent's defined site reports (and parent doesn't have the child report defined) instead of replacing the parent's report config? Is this expected to work/possible (I'm hoping I don't have to dupe the reports config into the child module)? In the parent pom's build/pluginManagement element, I configured the site plugin with default reports configuration. This works great for having all modules run with the same reports. Now one module needs an additional report which shouldn't run for the other modules as it would just duplicate the effort. So I added the site plugin config with that one additional report configured to that module's build/plugins element. However, for that module, now the other reports, defined in the parent, don't run; only the one report configured in its pom runs. I didn't find docs/info on this problem and my experiments didn't change anything. Anyone have advice on how to solve this problem? I realize one workaround is to create a separate project/pom and have a different CI job run that one report, and I may have to, but it seems this Should Work (TM) and I don't know how yet! - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
design help
I'm implementing a maven build on a medium-sized code base. The production dependency tree looks something like the following: n - ... - C - B - A C-B But there's a problem class PC in test branch of B, that downstream tests (n - ... - C) depend upon. It's a dependency quagmire, with a ton of static methods that new up test instances of all varieties. Most of these Foos and Bars are defined in B. So, I've chosen to draw a line in the sand and put PC into a new testing utility project test-B-utils. But, not surprisingly, many tests in B use PC as well. Options I can think of: 1. Move PC to src/main (kind of like the legacy build) and exclude PC from the production build (ignore the dependency problems). 2. Stick an interface for PC upstream (test-A-utils) and return extracted interfaces for all Foos and Bars. Use dependency inversion to build up PCIfaces in B and test-B-utils. Deal with some overlapping functionality in PCforB and PCforEveryoneElse (test scoped). Does anyone have a simpler or better mechanism? JPN
Re: Generating site content with Maven 2 site-plugin
Ludwig This was very helpful, and I now have it all working, the Perl script is run by the exec-maven-plugin; and I use maven-resources-plugin to copy the generated PNG files, both are tied pre-site phase. One gottcha is the exec-maven-plugin is not platform agnostic, so while I have ActiveState Perl (Community edition) configured to run from the DOS command line on windows; I need to have a different configuration to execute it compared to my Fedora host. The exec-maven-plugin (of which there can only be one per lifecycle phase) is declared before the maven-resources-plugin in the build/plugins section. I have added snippets from my POM.xml below and I also used properties to allow me to change them rather than edit the exec-maven-plugin section. So that is the next thing to tackle is trying to make this platform agnostic. Many thanks - Geoff Properties: properties beginWeek01/beginWeek weekCount16/weekCount /properties Maven-resources-plugin: plugin groupIdorg.apache.maven.plugins/groupId artifactIdmaven-resources-plugin/artifactId version2.4.3/version configuration outputDirectorysrc/site/resources/outputDirectory /configuration executions execution idcopy-resources/id phasepre-site/phase goals goalcopy-resources/goal /goals configuration outputDirectory${basedir}/src/site/resources/images/outputDirectory resources resource directory${basedir}/target/gnuplot/directory filteringfalse/filtering includes include**/*.png/include /includes /resource /resources /configuration /execution /executions /plugin Linux exec-maven-plugin: plugin groupIdorg.codehaus.mojo/groupId artifactIdexec-maven-plugin/artifactId version1.2/version configuration executablesrc/main/generateGraphs.pl/executable commandlineArgs--begin ${beginWeek} --weeks ${weekCount} data/2011.txt/commandlineArgs /configuration executions execution idexec-maven-plugin/id phasepre-site/phase goals goalexec/goal /goals /execution /executions /plugin Windows exec-maven-plugin plugin groupIdorg.codehaus.mojo/groupId artifactIdexec-maven-plugin/artifactId version1.2/version configuration executablecmd/executable arguments argument/C/argument argumentsrc\main\generateGraphs.pl/argument argument--begin=${beginWeek}/argument argument--weeks ${weekCount}/argument argumentdata/2011.txt/argument /arguments /configuration executions execution idexec-maven-plugin/id phasepre-site/phase goals goalexec/goal /goals /execution /executions /plugin From: Ludwig Magnusson lud...@itcatapult.com To: 'Maven Users List' users@maven.apache.org; 'Geoffrey Collis' gcol...@ymail.com Cc: Sent: Sunday, 6 February 2011, 12:16 Subject: RE: Generating site content with Maven 2 site-plugin Generating site content with Maven 2 site-plugin Yes, you only need to do two things: 1. Run the perl script 2. Copy the files to the right location (if they can’t be generated directly to the location) I have never used perl but according to google this plugin can help you execute perl scripts: http://mojo.codehaus.org/exec-maven-plugin/exec-mojo.html The resource plugin can then copy the resources with the copy-resources goal http://maven.apache.org/plugins/maven-resources-plugin/ You need to include both plugins in your pom and tie them to the pre-site phase. You can read more about lifecycle phases and how to tie plugins to them here: http://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html When you have managed to do this, you will probably have a good basic understanding of how maven works and no need to call yourself a newbe =) /Ludwig From:Geoffrey Collis [mailto:gcol...@ymail.com] Sent: den 5 februari 2011 22:27 To: users@maven.apache.org Cc: gcol...@ymail.com Subject: Generating site content with Maven 2 site-plugin I want to automatically generate GIF files to be included in a web site generated using the maven-2 site plugin. Part of the site contains an ASCII data file from which I need to [re]generate a number of GIF files using Perl and GNUPlot. Site maintenance consists of updating the ASCII data file, regenerating the GIF files, adding some comments to APT files and pushing it live. Is it possible to get the mvn site:site to run my Perl script which generates the GIF files and copies them to the site/resources/images directory so they get pushed to the site automatically? Despite several days of reading through Doxia Macros, Mylyn, Wagon, Maven and ANT integration tips and
[Cobertura] Cobertura Report Not Showing
I am not able to get this plugin to work properly. The online documentation is terrible. When I run the plugin, I can get the results from the clean and check goals. However, it seems as though the cobertura goal isn't even running. Here is my xml: Plugin section ... plugin groupIdorg.codehaus.mojo/groupId artifactIdcobertura-maven-plugin/artifactId version2.4/version executions execution goals goalclean/goal goalcobertura/goal goalcheck/goal /goals /execution /executions /plugin ... Report section ... reporting plugins plugin groupIdorg.codehaus.mojo/groupId artifactIdcobertura-maven-plugin/artifactId configuration formats formathtml/format formatxml/format /formats outputDirectorytarget/site/cobertura/outputDirectory /configuration /plugin /plugins /reporting ... Once again, the clean and check seem to be functioning but there is no site created in any format when this is run. Please help and update the online documentation. Thanks. Russell Collins Sr. Software Engineer CoreLogic Spatial Solutions Do or do not, there is no try. - Yoda *** This message may contain confidential or proprietary information intended only for the use of the addressee(s) named above or may contain information that is legally privileged. If you are not the intended addressee, or the person responsible for delivering it to the intended addressee, you are hereby notified that reading, disseminating, distributing or copying this message is strictly prohibited. If you have received this message by mistake, please immediately notify us by replying to the message and delete the original message and any copies immediately thereafter. Thank you.
Re: Retrieving all available versions of an artifact
On Fri, Feb 25, 2011 at 10:30 AM, Asmann, Roland roland.asm...@adesso.at wrote: I'm writing a plug-in and currently need a list of all available versions for a specific artifact. I've found this method: The Codehaus mojo dev list might be a better place to find plugin developers to ask... And you might want to look at the Versions Maven Plugin over there, I think it does something similar: http://mojo.codehaus.org/versions-maven-plugin/ . -- Wendy - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: [Cobertura] Cobertura Report Not Showing
I am not able to get this plugin to work properly. The online documentation is terrible. ... groupIdorg.codehaus.mojo/groupId ... Please help and update the online documentation. Thanks. What exactly do you expect the Maven project to do about your problems with a third-party (Codehaus Mojo) plugin?? [Disclaimer: I also participate in the Codehaus.] Wayne - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Configuring repositories
How can I configure maven to first check all the default repositories and if a jar is not found THEN check our corporate repo (Archiva)? I've added the following to settings.xml however It tries to connect to this repo first, not last. idFoo/id urlhttp://my.company.com:8080/archiva/repository/internal//url releases enabledtrue/enabled /releases snapshots enabledtrue/enabled /snapshots This repo will also only be available if I am connected to our VPN. Is there also a way to configure a connect timeout so it doesn't hang for minutes when Im not connected to the VPN? Thanks - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org