Implementing a Maven plugin with alternate mojo/component implementations?
Hi, I am currently setting up a new Maven plugin project and am currently faced with the following problem: I have fefined a dafaultLifecycle which defines which mojos should generally be invoked in which phase. My problem now is that I would like to have different implementations used for performing the tasks. There should allways be a default mojo/component that is used if the user doesn't specify which implementation he wants to use, but should offer a way to tell the build to use a different implementation. Would it be good to have some sort of proxy-mojo that is allways called and then relays to an implementation component based upon the configuration, or would it be better do define completely independent Mojos? The Internet seems to be full of tutorials on creating Maven plugins, but I haven't found a single one dealing with this particular problem. Help greatly appreciated, Chris
RE: No compile errors with plexus-compiler-eclipse
Hello Peter I downloaded maven-eclipse-compiler version 1.9.2 from maven repo1 and was able to use the pom.xml to compile and package here is the pom.xml i implemented: ?xml version=1.0 encoding=UTF-8? project xsi:schemaLocation=http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xmlns=http://maven.apache.org/POM/4.0.0; modelVersion4.0.0/modelVersion parent groupIdorg.codehaus.plexus/groupId artifactIdplexus-compilers/artifactId version1.9.2/version /parent groupIdorg.codehaus.plexus/groupId artifactIdplexus-compiler-eclipse/artifactId version1.9.2/version namePlexus Eclipse Compiler/name dependencies dependency groupIdorg.codehaus.plexus/groupId artifactIdplexus-container-default/artifactId version1.5.5/version /dependency dependency groupIdorg.codehaus.plexus/groupId artifactIdplexus-compiler-api/artifactId version1.9.2/version /dependency dependency groupIdorg.codehaus.plexus/groupId artifactIdplexus-utils/artifactId version3.0/version /dependency dependency groupIdorg.eclipse.jdt/groupId artifactIdcore/artifactId version3.3.0-v_771/version exclusions exclusion groupIdorg.eclipse.core/groupId artifactIdresources/artifactId /exclusion exclusion groupIdorg.eclipse.core/groupId artifactIdruntime/artifactId /exclusion exclusion groupIdorg.eclipse.core/groupId artifactIdfilesystem/artifactId /exclusion exclusion groupIdorg.eclipse/groupId artifactIdtext/artifactId /exclusion /exclusions /dependency /dependencies /project http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-compiler-eclipse/1.9.2 does this not compile for your environment? Martin Gainty __ Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen. Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni. From: li...@zentrumderarbeit.org Subject: No compile errors with plexus-compiler-eclipse Date: Fri, 30 Nov 2012 08:47:08 +0100 To: users@maven.apache.org Hello, I'm trying to make use of plexus-compiler-eclipse by setting plugin artifactIdmaven-compiler-plugin/artifactId version3.0/version configuration compilerIdeclipse/compilerId /configuration dependencies dependency groupIdorg.codehaus.plexus/groupId artifactIdplexus-compiler-eclipse/artifactId version2.0/version /dependency /dependencies /plugin in pom.xml. mvn compile works, but in fact I still have errors in my code (I'm actually porting an ant and xdoclet based project to maven). But instead of getting errors I see a lot of warnings and build succeeds. The warnings are not only about Hashtable is a raw type. References to generic type HashtableK,V should be parameterized which I'd expect as a warning only, but also Type mismatch: cannot convert from Object to MyBusinessFacadeRemote or MyBusinessServlet cannot be resolved or Unreachable catch block for RemoteException. This exception is never thrown from the try statement body or The import foo.bar.Bla cannot be resolved or even whole types (formerly xdoclet generated types I partially need to create manually by myself and haven't done yet). These I'd expect to pop up as an error and fail the build. Instead it's only printed as a warning and build continues. Am I configuring maven-compiler-plugin - and plexus-compile-eclipse - the wrong way? Or is plexus-compiler-eclipse not raising these errors as such at all, which would render it quite a bit useless at the moment? -- Thanks in advance, and best regards, Peter - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: Implementing a Maven plugin with alternate mojo/component implementations?
Here are some plugins which you should have a look at: maven-compiler-plugin ( compilerId ) maven-release-plugin ( mavenExecutorId ) Now you need to do some Plexus-stuff, since that's the DI-framework for Maven. Every task-implementation needs to have the same interface (plexus role) and a specific id (role-hint) In your manager you can let Plexus fill a map based on the plexus role. So now you can add a parameter to your plugin with a default taskId, and users can overrule it. I think this meets your requirements. Good luck, Robert Op Sun, 02 Dec 2012 12:33:43 +0100 schreef christofer.d...@c-ware.de christofer.d...@c-ware.de: Hi, I am currently setting up a new Maven plugin project and am currently faced with the following problem: I have fefined a dafaultLifecycle which defines which mojos should generally be invoked in which phase. My problem now is that I would like to have different implementations used for performing the tasks. There should allways be a default mojo/component that is used if the user doesn't specify which implementation he wants to use, but should offer a way to tell the build to use a different implementation. Would it be good to have some sort of proxy-mojo that is allways called and then relays to an implementation component based upon the configuration, or would it be better do define completely independent Mojos? The Internet seems to be full of tutorials on creating Maven plugins, but I haven't found a single one dealing with this particular problem. Help greatly appreciated, Chris - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
AW: Implementing a Maven plugin with alternate mojo/component implementations?
Hi Robert, I managed to actually get something working in the meanwhile. Here's what I did: - I created an API artifact containing the interface of my modules. - I created several Implementations of the Interfaces each one annotated with @Component with the Role set to the Interface class and each one with an individual hint-name. - I create one Mojo with a map property with MapHintName, ModuleType and a String property to select the desired implementation (defaulting to a default string) - Now in the execute method of my Mojo I simply read the desired implementation name, fetch that instance from the map and use the Module interface to relay the call to that particular instance. Semms to be doing the jobe nicely ... is this a valid approch or would a best practice do it differently? Chris -Ursprüngliche Nachricht- Von: Robert Scholte [mailto:rfscho...@apache.org] Gesendet: Sonntag, 2. Dezember 2012 15:57 An: Maven Users List Betreff: Re: Implementing a Maven plugin with alternate mojo/component implementations? Here are some plugins which you should have a look at: maven-compiler-plugin ( compilerId ) maven-release-plugin ( mavenExecutorId ) Now you need to do some Plexus-stuff, since that's the DI-framework for Maven. Every task-implementation needs to have the same interface (plexus role) and a specific id (role-hint) In your manager you can let Plexus fill a map based on the plexus role. So now you can add a parameter to your plugin with a default taskId, and users can overrule it. I think this meets your requirements. Good luck, Robert Op Sun, 02 Dec 2012 12:33:43 +0100 schreef christofer.d...@c-ware.de christofer.d...@c-ware.de: Hi, I am currently setting up a new Maven plugin project and am currently faced with the following problem: I have fefined a dafaultLifecycle which defines which mojos should generally be invoked in which phase. My problem now is that I would like to have different implementations used for performing the tasks. There should allways be a default mojo/component that is used if the user doesn't specify which implementation he wants to use, but should offer a way to tell the build to use a different implementation. Would it be good to have some sort of proxy-mojo that is allways called and then relays to an implementation component based upon the configuration, or would it be better do define completely independent Mojos? The Internet seems to be full of tutorials on creating Maven plugins, but I haven't found a single one dealing with this particular problem. Help greatly appreciated, Chris - 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
hi, is these any properties like ${project.module} in maven's system properties?
I assembly a multi-module project, in the assembly, I write like the follow, is there any property word like ${project.module} to replace module1? or can i user .properties file to set project.module1=module1? moduleSets moduleSet useAllReactorProjectstrue/useAllReactorProjects includes include${project.groupId}:module1/include /includes binaries outputDirectorymodule1/outputDirectory unpackfalse/unpack includeDependenciestrue/includeDependencies dependencySets dependencySet outputDirectorymodule1/lib/outputDirectory scoperuntime/scope /dependencySet /dependencySets /binaries /moduleSet thanks a
Re: AW: Implementing a Maven plugin with alternate mojo/component implementations?
Hi Chris, yes, this is a right approach, matches close to what I described. Robert Op Sun, 02 Dec 2012 16:05:23 +0100 schreef christofer.d...@c-ware.de christofer.d...@c-ware.de: Hi Robert, I managed to actually get something working in the meanwhile. Here's what I did: - I created an API artifact containing the interface of my modules. - I created several Implementations of the Interfaces each one annotated with @Component with the Role set to the Interface class and each one with an individual hint-name. - I create one Mojo with a map property with MapHintName, ModuleType and a String property to select the desired implementation (defaulting to a default string) - Now in the execute method of my Mojo I simply read the desired implementation name, fetch that instance from the map and use the Module interface to relay the call to that particular instance. Semms to be doing the jobe nicely ... is this a valid approch or would a best practice do it differently? Chris -Ursprüngliche Nachricht- Von: Robert Scholte [mailto:rfscho...@apache.org] Gesendet: Sonntag, 2. Dezember 2012 15:57 An: Maven Users List Betreff: Re: Implementing a Maven plugin with alternate mojo/component implementations? Here are some plugins which you should have a look at: maven-compiler-plugin ( compilerId ) maven-release-plugin ( mavenExecutorId ) Now you need to do some Plexus-stuff, since that's the DI-framework for Maven. Every task-implementation needs to have the same interface (plexus role) and a specific id (role-hint) In your manager you can let Plexus fill a map based on the plexus role. So now you can add a parameter to your plugin with a default taskId, and users can overrule it. I think this meets your requirements. Good luck, Robert Op Sun, 02 Dec 2012 12:33:43 +0100 schreef christofer.d...@c-ware.de christofer.d...@c-ware.de: Hi, I am currently setting up a new Maven plugin project and am currently faced with the following problem: I have fefined a dafaultLifecycle which defines which mojos should generally be invoked in which phase. My problem now is that I would like to have different implementations used for performing the tasks. There should allways be a default mojo/component that is used if the user doesn't specify which implementation he wants to use, but should offer a way to tell the build to use a different implementation. Would it be good to have some sort of proxy-mojo that is allways called and then relays to an implementation component based upon the configuration, or would it be better do define completely independent Mojos? The Internet seems to be full of tutorials on creating Maven plugins, but I haven't found a single one dealing with this particular problem. Help greatly appreciated, Chris - 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
Re: No compile errors with plexus-compiler-eclipse
Hello Martin, Am 02.12.2012 um 15:37 schrieb Martin Gainty mgai...@hotmail.com: I downloaded maven-eclipse-compiler version 1.9.2 from maven repo1 and was able to use the pom.xml to compile and package here is the pom.xml i implemented: [...] http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-compiler-eclipse/1.9.2 does this not compile for your environment? Pardon? My message was not about compiling plexus-comiler-eclipse itself, but using it to compile my very own stuff. As requested by Olivier Lamy I already opened a JIRA issue about my objections, but thanks for your comment. -- Best regards, Peter - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
RE: No compile errors with plexus-compiler-eclipse
Subject: Re: No compile errors with plexus-compiler-eclipse From: pitpa...@gmail.com Date: Sun, 2 Dec 2012 20:05:53 +0100 To: users@maven.apache.org Hello Martin, Am 02.12.2012 um 15:37 schrieb Martin Gainty mgai...@hotmail.com: I downloaded maven-eclipse-compiler version 1.9.2 from maven repo1 and was able to use the pom.xml to compile and package here is the pom.xml i implemented: [...] http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-compiler-eclipse/1.9.2 does this not compile for your environment? Pardon? My message was not about compiling plexus-comiler-eclipse itself, but using it to compile my very own stuff. As requested by Olivier Lamy I already opened a JIRA issue about my objections, but thanks for your comment. -- Best regards, Peter MGunderstood.. MGi too work in both environments and have implemented execution scripts calling legacy ANT build.xml target via maven-antrun-plugin MGpingback if you see a maven functionality hole that can only be filled by calling a taskdef'ed Java Ant class MGwhich *should* (eventually) be ported to a fully functional maven-plugin - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
RE: problem while conversion in build
Can u please someone tell , how can I add german characters in validation.global.xml? So that it can be converted exactly in validation.xml m while building. Thanks Warm Regards, Praveen Jain Praveen Jain | 020-66563094 Prime Sourcing, Oracle Financial Services, Oracle Park, Pune, India From: Praveen Jain Sent: Thursday, November 29, 2012 4:25 PM To: Maven Users List Subject: RE: problem while conversion in build Yes I am using ISO-8859-1 Thanks Warm Regards, Praveen Jain Praveen Jain | 020-66563094 Prime Sourcing, Oracle Financial Services, Oracle Park, Pune, India From: Martin Eisengardt [mailto:martin.eisenga...@gmail.com] Sent: Thursday, November 29, 2012 4:17 PM To: Maven Users List Subject: Re: problem while conversion in build Do you set any encoding in your pom.xml? for example see http://maven.apache.org/plugins/maven-resources-plugin/examples/encoding.html On Thu, Nov 29, 2012 at 11:44 AM, Praveen Jain praveen.x.j...@oracle.com wrote: Hi I am building my project using maven, I have some german character in my validation-global.xml When I build it they got converted to some garbage value in validation.xml. If I add ? Xml version=1.0 encoding =iso-8859-1 in validation-global.xml , then after build german character placed as it is in validation.xml. But in validation.xml after form-validation I have again ? Xml version=1.0 encoding =iso-8859-1 which violets the XML structure and it doesnot work. Please assist Thanks Warm Regards, Praveen Jain Praveen Jain | 020-66563094 Prime Sourcing, Oracle Financial Services, Oracle Park, Pune, India - 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