AW: Best practice - multi project
Hi Milo, >From what I understood, the best solution would be to further break up the >app1 und app2 wars in a app1-jar and a app1-war. I know that this increases >the project complexity but from my point of view, it is the clearer approach >for achieving your goal. I would also think, that having a war only contain >webapp resources and no java files is a good thing. But that is only my point >of view and has arguably some drawbacks, because some java code is only needed >for the webapp alone. So what I would do, is create the following setup: /myapp + /common | + /app1-jar : depends on common | + /app1-war : depends on app1-jar | + /app2-jar : depends on common | + /app2-war : depends on app2-jar | + /admin-war: depends on app1-jar and app2-jar Whereas I would break up the app1 and app2 java code in code, that is needed by admin and app1 and thus goes to app1-jar and code that is only needed by app1-war and stays inside this project. Same for app2. By this layout you get a clear approach to reasonsibility and dependencies of your projects. Greetings, Christian. -- christian domsch [software developer] innoWake gmbh innovative.software.development(); ACHTUNG! WIR SIND UMGEZOGEN: IT-Tower Robert-Bosch-Str. 1 | 89250 Senden Fon: +49.7307.92190.0 Fax: +49.7307.92190.20 [EMAIL PROTECTED] www.innowake.de innoWake gmbh HRB Ulm 4584 Geschäftsführer: Thorsten Bernecker This e-mail may contain confidential information. If you are not the intended recipient please notify the sender immediately and destroy this e-mail. -Ursprüngliche Nachricht- Von: Milo Mo [mailto:[EMAIL PROTECTED] Gesendet: Freitag, 7. November 2008 01:10 An: users@maven.apache.org Betreff: Best practice - multi project Hi! I have come up with a solution to a dependency problem I have had in my multi-maven-project, but I wonder if maybe there's a better solution. I have the following multi project scenario, which is probably not that uncommon: - MyApp - parent pom - MyApp/Common - common code - MyApp/App1 - Web app - MyApp/App2 - Web app - MyApp/Admin - Webapp admin interface for App1/App2 Dependencies: - Common: none - App1: Common - App2: Common - Admin: App1 + App2 + Common All sub projects include the parent pom. Projects App1, App2 and Admin have Common declared as a dependency in the maven configuration. I run the following commands: cd MyApp mvn clean install The parent pom and the Common jar will be installed in my local maven repository (along with the App1 and App2 war files). The problem is the Admin project, which has dependencies to App1 and App2. I want the java classes from App1/App2 bundled in jar files and the jars installed in my local maven repository, but the App1 and App2 projects produce war packages... I have three environments: local, stage, production My solution is this: I have configured App1 and App2 as maven projects with packaging "jar", so the command "mvn package" will produce a jar, and "mvn install" will install the jar files in the local maven repository. I use an Eclipse-embedded Jetty to run the applications on my local machine, so no war file is needed for local use (if I really need a local war i can use the command "mvn package war:war"). So no profile specified means a local build. To build war files for stage and production I have created two maven profiles, "stage" and "production". To make sure war files are built for stage and production, I have specified that the goal war:war (from the plugin maven-war-plugin) will be executed in the "package" phase in the profiles' builds. This means that for App1: - "mvn clean install" will install App1.jar in the maven repository - "mvn -Pstage clean package cargo:deploy" builds a war file and deploys it in my stage environment - "mvn -Pproduction clean package" builds a war file for my production environment Now I can install the App1 and App2 jar files in my local maven repository ("mvn install") and add App1 and App2 as dependencies in Admin. The Admin project now builds fine. I can't help thinking that declaring "jar" packaging in App1 and App2 is a bit of a hack. Is there a better way of doing this? Web apps depending on java classes in other web apps must be a standard issue when building multi projects. Another solution is breaking out the classes from App1 and App2 that Admin needs, but that means two more projects (e.g. "App1-common" and "App2-common"), and I think 6 maven projects for two web applications + admin is a bit much. Any help is appreciated! Kind regards, Milo - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
AW: How to define a parent POM in a company wide.
Take a look at the svn repository for maven. Start here and then follow around: http://svn.apache.org/viewvc/maven/pom/trunk/asf/pom.xml?view=markup http://svn.apache.org/viewvc/maven/pom/trunk/maven/pom.xml?view=markup http://svn.apache.org/viewvc/maven/components/trunk/pom.xml?view=markup -- christian domsch [software developer] innoWake gmbh innovative.software.development(); graf-arco-strasse 18 | 89079 ulm-donautal fon: +49 (0)7 31 - 5 50 27 - 0 fax: +49 (0)7 31 - 5 50 27 - 20 [EMAIL PROTECTED] www.innowake.de innoWake gmbh hrb ulm 4584 geschäftsführer: thorsten bernecker This e-mail may contain confidential information. If you are not the intended recipient please notify the sender immediately and destroy this e-mail. -Ursprüngliche Nachricht- Von: 陈思淼 [mailto:[EMAIL PROTECTED] Gesendet: Freitag, 12. September 2008 11:00 An: Maven Users List Betreff: Re: How to define a parent POM in a company wide. can you give me a specific exmaple URL ,so i can understand this efficiently,Thanks! 2008/9/12 christian domsch (innoWake gmbh) <[EMAIL PROTECTED]> > Thats the standard way. Why is this tricky? Maybe I explained to > complicated. > > You have a parent pom (where you place it is rather irrelevant): > > http://maven.apache.org/POM/4.0.0"; xmlns:xsi=" > http://www.w3.org/2001/XMLSchema-instance"; >xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 > http://maven.apache.org/maven-v4_0_0.xsd";> >4.0.0 >#a groupt for the parent pom ># an artifact id for the parent pom >1.0.0-SNAPSHOT >pom >Global parent pom >... >dependencies >build definitions >profiles >plugins >distribution definitions... > > > This is the way how maven works with configuring global > configurations. You can create very precise configuration hierarchies for all > your projects. > Look at the apache and codehaus projects, they show how this can be > done very efficently. > > -- > christian domsch > [software developer] > > > > innoWake gmbh > innovative.software.development(); > graf-arco-strasse 18 | 89079 ulm-donautal > fon: +49 (0)7 31 - 5 50 27 - 0 > fax: +49 (0)7 31 - 5 50 27 - 20 > [EMAIL PROTECTED] > www.innowake.de > > > innoWake gmbh hrb ulm 4584 > geschäftsführer: thorsten bernecker > > This e-mail may contain confidential information. If you are not the > intended recipient please notify the sender immediately and destroy > this e-mail. > -Ursprüngliche Nachricht- > Von: 陈思淼 [mailto:[EMAIL PROTECTED] > Gesendet: Freitag, 12. September 2008 10:32 > An: Maven Users List > Betreff: Re: How to define a parent POM in a company wide. > > that's a tricky way to solve this problem, does maven provide some > mechanism to do this? > > 2008/9/12 christian domsch (innoWake gmbh) > <[EMAIL PROTECTED]> > > > Hi, > > > > This is done by creating a POM-Project. You just create a normal > > project with just a pom in it. The type here is pom and there you > > configurate all your stuff, installed (or deploy) it in the > > repository and now you can use it as a parent pom. > > > > > > -- > > christian domsch > > [software developer] > > > > > > > > innoWake gmbh > > innovative.software.development(); > > graf-arco-strasse 18 | 89079 ulm-donautal > > fon: +49 (0)7 31 - 5 50 27 - 0 > > fax: +49 (0)7 31 - 5 50 27 - 20 > > [EMAIL PROTECTED] > > www.innowake.de > > > > > > innoWake gmbh hrb ulm 4584 > > geschäftsführer: thorsten bernecker > > > > This e-mail may contain confidential information. If you are not the > > intended recipient please notify the sender immediately and destroy > > this e-mail. > > -Ursprüngliche Nachricht- > > Von: 陈思淼 [mailto:[EMAIL PROTECTED] > > Gesendet: Freitag, 12. September 2008 10:16 > > An: users@maven.apache.org > > Betreff: How to define a parent POM in a company wide. > > > > we use Maven in our company, but there are some plugin config like > > source plugin ,compile plugin we'd like to define for everyone, > > there is a Super POM concept in Maven , can anybody tell me how to config > > it? > > >
AW: How to define a parent POM in a company wide.
Thats the standard way. Why is this tricky? Maybe I explained to complicated. You have a parent pom (where you place it is rather irrelevant): http://maven.apache.org/POM/4.0.0"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd";> 4.0.0 #a groupt for the parent pom # an artifact id for the parent pom 1.0.0-SNAPSHOT pom Global parent pom ... dependencies build definitions profiles plugins distribution definitions... This is the way how maven works with configuring global configurations. You can create very precise configuration hierarchies for all your projects. Look at the apache and codehaus projects, they show how this can be done very efficently. -- christian domsch [software developer] innoWake gmbh innovative.software.development(); graf-arco-strasse 18 | 89079 ulm-donautal fon: +49 (0)7 31 - 5 50 27 - 0 fax: +49 (0)7 31 - 5 50 27 - 20 [EMAIL PROTECTED] www.innowake.de innoWake gmbh hrb ulm 4584 geschäftsführer: thorsten bernecker This e-mail may contain confidential information. If you are not the intended recipient please notify the sender immediately and destroy this e-mail. -Ursprüngliche Nachricht- Von: 陈思淼 [mailto:[EMAIL PROTECTED] Gesendet: Freitag, 12. September 2008 10:32 An: Maven Users List Betreff: Re: How to define a parent POM in a company wide. that's a tricky way to solve this problem, does maven provide some mechanism to do this? 2008/9/12 christian domsch (innoWake gmbh) <[EMAIL PROTECTED]> > Hi, > > This is done by creating a POM-Project. You just create a normal > project with just a pom in it. The type here is pom and there you > configurate all your stuff, installed (or deploy) it in the repository > and now you can use it as a parent pom. > > > -- > christian domsch > [software developer] > > > > innoWake gmbh > innovative.software.development(); > graf-arco-strasse 18 | 89079 ulm-donautal > fon: +49 (0)7 31 - 5 50 27 - 0 > fax: +49 (0)7 31 - 5 50 27 - 20 > [EMAIL PROTECTED] > www.innowake.de > > > innoWake gmbh hrb ulm 4584 > geschäftsführer: thorsten bernecker > > This e-mail may contain confidential information. If you are not the > intended recipient please notify the sender immediately and destroy > this e-mail. > -Ursprüngliche Nachricht- > Von: 陈思淼 [mailto:[EMAIL PROTECTED] > Gesendet: Freitag, 12. September 2008 10:16 > An: users@maven.apache.org > Betreff: How to define a parent POM in a company wide. > > we use Maven in our company, but there are some plugin config like > source plugin ,compile plugin we'd like to define for everyone, there > is a Super POM concept in Maven , can anybody tell me how to config it? >
AW: How to define a parent POM in a company wide.
Hi, This is done by creating a POM-Project. You just create a normal project with just a pom in it. The type here is pom and there you configurate all your stuff, installed (or deploy) it in the repository and now you can use it as a parent pom. -- christian domsch [software developer] innoWake gmbh innovative.software.development(); graf-arco-strasse 18 | 89079 ulm-donautal fon: +49 (0)7 31 - 5 50 27 - 0 fax: +49 (0)7 31 - 5 50 27 - 20 [EMAIL PROTECTED] www.innowake.de innoWake gmbh hrb ulm 4584 geschäftsführer: thorsten bernecker This e-mail may contain confidential information. If you are not the intended recipient please notify the sender immediately and destroy this e-mail. -Ursprüngliche Nachricht- Von: 陈思淼 [mailto:[EMAIL PROTECTED] Gesendet: Freitag, 12. September 2008 10:16 An: users@maven.apache.org Betreff: How to define a parent POM in a company wide. we use Maven in our company, but there are some plugin config like source plugin ,compile plugin we'd like to define for everyone, there is a Super POM concept in Maven , can anybody tell me how to config it?
AW: [M2] best-practice to retrieve the version of a webapp?
Hi R.C., This is more or less the same we do in our project. I use the buildnumber-plugin to generate a buildnumber and write this information inside the generated MANIFEST.MF on each jar building process (jar, war, ear). Then I use the war overlay mechanism to join my project war with a util-war that just adds a library.jsp page, that iterates over all METAINF.MF files in the classpath and looks for that property and writes it to a page. Greetings, Christian. -- christian domsch [software developer] innoWake gmbh innovative.software.development(); graf-arco-strasse 18 | 89079 ulm-donautal fon: +49 (0)7 31 - 5 50 27 - 0 fax: +49 (0)7 31 - 5 50 27 - 20 [EMAIL PROTECTED] www.innowake.de innoWake gmbh hrb ulm 4584 geschäftsführer: thorsten bernecker This e-mail may contain confidential information. If you are not the intended recipient please notify the sender immediately and destroy this e-mail. -Ursprüngliche Nachricht- Von: CodingPlayer [mailto:[EMAIL PROTECTED] Gesendet: Dienstag, 24. Juni 2008 11:20 An: users@maven.apache.org Betreff: [M2] best-practice to retrieve the version of a webapp? Hi, Some days ago i had some problems with a webapp of mine, deployed at a test-server. The reason was a wrong version (properties for localhost). Now i wonder if there exists any plugin that generates some kind of version info, that can be retrieved from a running webapp (or at least the webapp should log this information to the logger). What i exactly have in mind, would be... - artifactId-version-buildnumber (eg: SVN Revision) - it would be also nice, if the "name" (respectively id) of the maven profile would be added as well, since i use multiple profiles to include the corresponding properties, using... localhost src/main/resources.localhost live-server src/main/resources.live test-server src/main/resources.test My approach would be to write a plugin, that reads out this information (at build-time) and generate a buildinfo.properties (buildinfo.txt) file that is put into the classpath (e.g.: .WAR file), and can than be read out through a small service that can be integrated into a webapp (or CLI as well). any hints, thoughts, ideas are very welcome. best regards R.C. -- View this message in context: http://www.nabble.com/-M2--best-practice-to-retrieve-the-version-of-a-webapp--tp18087164p18087164.html Sent from the Maven - Users mailing list archive at Nabble.com. - 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]
Find POM for artifact
Hi all, I have a mojo that has to analyse its artifacts and the corresponding poms. I aquire the list of artifacts from a parameter and now I want to read the pom for each artefact. Since I can get the file for an artefact, getting the pom is fairely easy, since I only have to change the file extension. Now I want to access some information inside the pom I don't want to parse the information myself. So I wanted to know how I can get an instance of MavenProject for instance from a give pom file. But maybe I should ask differently: I am converting a Maven 1 plugin to a Maven 2 Mojo. In the old poms, each dependency had some properties. Now as I see, these per dependency properties do now exit anymore, maybe because of the transitiveness of dependencies. But I have to use some sort oe equivilant mechanismus. What I want to do, is iterate over my project dependencies and obfuscate the libraries, but only if the dependency has a property attached. For the case that there are no more dependency properties, I had the idea to put that property inside the pom that builds the artefact behind the dependency and somehow evaluate this property. But I don't know, how to get this property in the right way. Any ideas or suggestions? Greetings, Christian