so required properties with a default values would work and you filter only the descriptor file. This would allow us to not define 10 variables and use ant for them but just reuse our parent pom properties
Romain Manni-Bucau Twitter: @rmannibucau Blog: http://rmannibucau.wordpress.com/ LinkedIn: http://fr.linkedin.com/in/rmannibucau Github: https://github.com/rmannibucau 2014-07-23 15:22 GMT+02:00 Andy Gumbrecht <[email protected]>: > Tried that - If you filter then you replace the template placeholders with > current values - so ${version} get replaced with '1.7.0-SNAPSHOT' for > example. > Don't know how to tell resources plugin to ignore that? Which is why I > used the ant stuff, there is also a codehaus replace plugin. Maybe better. > > Andy > > > On 23/07/2014 14:57, Romain Manni-Bucau wrote: > >> Ok got my mistake....so surely miss another point: why not simply >> filtering >> the archetype pom, it is in src/main/resources and we have tomee.version, >> openejb.version etc... (it works and doesn't need any hack). >> >> >> >> Romain Manni-Bucau >> Twitter: @rmannibucau >> Blog: http://rmannibucau.wordpress.com/ >> LinkedIn: http://fr.linkedin.com/in/rmannibucau >> Github: https://github.com/rmannibucau >> >> >> 2014-07-23 14:50 GMT+02:00 Andy Gumbrecht <[email protected]>: >> >> We're obviously looking at two different things here, so you need to >>> check >>> it out and correct whatever you feel you need to. >>> >>> When I run generate I get the following pom now, which is exactly what it >>> should be: >>> >>> <?xml version="1.0" encoding="UTF-8"?> >>> <!-- >>> Licensed to the Apache Software Foundation (ASF) under one or more >>> contributor license agreements. See the NOTICE file distributed with >>> this work for additional information regarding copyright ownership. >>> The ASF licenses this file to You under the Apache License, Version >>> 2.0 >>> (the "License"); you may not use this file except in compliance with >>> the License. You may obtain a copy of the License at >>> >>> http://www.apache.org/licenses/LICENSE-2.0 >>> >>> Unless required by applicable law or agreed to in writing, software >>> distributed under the License is distributed on an "AS IS" BASIS, >>> WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or >>> implied. >>> See the License for the specific language governing permissions and >>> limitations under the License. >>> --> >>> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi=" >>> http://www.w3.org/2001/XMLSchema-instance" >>> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 >>> http://maven.apache.org/maven-v4_0_0.xsd"> >>> <modelVersion>4.0.0</modelVersion> >>> >>> <groupId>andy</groupId> >>> <artifactId>andy</artifactId> >>> <version>1.0-SNAPSHOT</version> >>> <packaging>war</packaging> >>> <name>andy TomEE Webapp</name> >>> <url>http://tomee.apache.org</url> >>> >>> <properties> >>> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> >>> </properties> >>> >>> <dependencies> >>> <dependency> >>> <groupId>org.apache.openejb</groupId> >>> <artifactId>javaee-api</artifactId> >>> <version>6.0-6</version> >>> <scope>provided</scope> >>> </dependency> >>> >>> <!-- to test with TomEE and Arquillian --> >>> >>> <dependency> >>> <groupId>org.apache.openejb</groupId> >>> <artifactId>arquillian-tomee-remote</artifactId> >>> <version>1.7.0-SNAPSHOT</version> >>> >>> <scope>test</scope> >>> </dependency> >>> <dependency> >>> <groupId>org.jboss.arquillian.junit</groupId> >>> <artifactId>arquillian-junit-container</artifactId> >>> <version>1.1.5.Final</version> >>> >>> <scope>test</scope> >>> </dependency> >>> <dependency> >>> <groupId>junit</groupId> >>> <artifactId>junit</artifactId> >>> <version>4.11</version> >>> <scope>test</scope> >>> </dependency> >>> >>> <!-- to test with OpenEJB embedded and Arquillian >>> <dependency> >>> <groupId>org.apache.openejb</groupId> >>> <artifactId>arquillian-openejb-embedded-4</artifactId> >>> <version>4.7.0-SNAPSHOT</version> >>> >>> <scope>test</scope> >>> </dependency> >>> <dependency> >>> <groupId>org.jboss.arquillian.junit</groupId> >>> <artifactId>arquillian-junit-container</artifactId> >>> <version>1.1.2.Final</version> >>> >>> <scope>test</scope> >>> </dependency> >>> <dependency> >>> <groupId>junit</groupId> >>> <artifactId>junit</artifactId> >>> <version>4.11</version> >>> <scope>test</scope> >>> </dependency> >>> --> >>> </dependencies> >>> >>> <build> >>> <plugins> >>> <plugin> >>> <groupId>org.apache.maven.plugins</groupId> >>> <artifactId>maven-compiler-plugin</artifactId> >>> <version>3.1</version> >>> </plugin> >>> <plugin> >>> <groupId>org.apache.maven.plugins</groupId> >>> <artifactId>maven-surefire-plugin</artifactId> >>> <version>2.17</version> >>> </plugin> >>> <plugin> >>> <groupId>org.apache.maven.plugins</groupId> >>> <artifactId>maven-war-plugin</artifactId> >>> <version>2.4</version> >>> <configuration> >>> <failOnMissingWebXml>false</failOnMissingWebXml> >>> </configuration> >>> </plugin> >>> >>> <plugin> >>> <groupId>org.apache.openejb.maven</groupId> >>> <artifactId>tomee-maven-plugin</artifactId> >>> <version>1.7.0-SNAPSHOT</version> >>> >>> <configuration> >>> <context>ROOT</context> >>> </configuration> >>> </plugin> >>> <plugin> >>> <groupId>org.apache.openjpa</groupId> >>> <artifactId>openjpa-maven-plugin</artifactId> >>> <version>2.3.0</version> >>> <configuration> >>> <includes>**/entities/*.class</includes> >>> <excludes>**/entities/XML*.class</excludes> >>> <addDefaultConstructor>true</addDefaultConstructor> >>> <enforcePropertyRestrictions>true</enforcePropertyRestrictions> >>> </configuration> >>> <executions> >>> <execution> >>> <id>enhancer</id> >>> <phase>process-classes</phase> >>> <goals> >>> <goal>enhance</goal> >>> </goals> >>> </execution> >>> </executions> >>> <dependencies> >>> <dependency> >>> <groupId>org.apache.openjpa</groupId> >>> <artifactId>openjpa</artifactId> >>> <!-- set the version to be the same as the level in your >>> runtime --> >>> <version>2.3.0</version> >>> </dependency> >>> </dependencies> >>> </plugin> >>> </plugins> >>> </build> >>> >>> <repositories> >>> <repository> >>> <id>apache-snapshot</id> >>> <name>Apache Snapshot Repository</name> >>> <url>https://repository.apache.org/content/groups/snapshots/</url> >>> </repository> >>> </repositories> >>> >>> </project> >>> >>> >>> >>> On 23/07/2014 14:44, Romain Manni-Bucau wrote: >>> >>> that's why we use @version@ instead, no? >>>> >>>> >>>> >>>> Romain Manni-Bucau >>>> Twitter: @rmannibucau >>>> Blog: http://rmannibucau.wordpress.com/ >>>> LinkedIn: http://fr.linkedin.com/in/rmannibucau >>>> Github: https://github.com/rmannibucau >>>> >>>> >>>> 2014-07-23 14:41 GMT+02:00 Andy Gumbrecht <[email protected]>: >>>> >>>> No, you are not getting it. This is about modifying the pom.xml >>>> template >>>> >>>>> resource that needs the TomEE and OpenEJB versions hard coded at build >>>>> time >>>>> NOT the user defined ${version} that the user enters at mvn >>>>> archetype:generate. >>>>> Please, if you know of a better way of injecting the project versions >>>>> into >>>>> the template before the jar is built and deployed then please show me. >>>>> You >>>>> cannot use simple resource parsing as ${version} with get replaced, >>>>> which >>>>> we don't want, because it's a template. >>>>> >>>>> It has NOTHING to do with default property/user overrides defined in >>>>> the >>>>> archetype-metadata! >>>>> >>>>> >>>>> >>>>> On 23/07/2014 14:24, Romain Manni-Bucau wrote: >>>>> >>>>> Sorry I don't follow (maybe read too fast) >>>>> >>>>>> but we can use requiredProperty ( >>>>>> http://maven.apache.org/archetype/maven-archetype- >>>>>> plugin/specification/ >>>>>> archetype-metadata.html), >>>>>> filter the descriptor to get correct default and allow then the user >>>>>> to >>>>>> override it. >>>>>> >>>>>> This is the way maven do it usually. Ant is a not common hack I'm >>>>>> still >>>>>> not >>>>>> sure we need. >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> Romain Manni-Bucau >>>>>> Twitter: @rmannibucau >>>>>> Blog: http://rmannibucau.wordpress.com/ >>>>>> LinkedIn: http://fr.linkedin.com/in/rmannibucau >>>>>> Github: https://github.com/rmannibucau >>>>>> >>>>>> >>>>>> 2014-07-23 14:20 GMT+02:00 Andy Gumbrecht <[email protected]>: >>>>>> >>>>>> No, it's not the same - you are thinking of the user >>>>>> defined/archtype >>>>>> >>>>>> version - Please just try it and you will see what it wrong! >>>>>>> >>>>>>> >>>>>>> Andy. >>>>>>> >>>>>>> On 23/07/2014 14:15, Romain Manni-Bucau wrote: >>>>>>> >>>>>>> Yeah, but we should use the archetype to query the version, said >>>>>>> >>>>>>> otherwise >>>>>>>> we shouldn't use ant since maven archetype provides this feature. >>>>>>>> >>>>>>>> Last note: since we release the archetype with tomee (which doesn't >>>>>>>> makes >>>>>>>> sense anymore btw) we should just hardcode the version linked to the >>>>>>>> release. >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> Romain Manni-Bucau >>>>>>>> Twitter: @rmannibucau >>>>>>>> Blog: http://rmannibucau.wordpress.com/ >>>>>>>> LinkedIn: http://fr.linkedin.com/in/rmannibucau >>>>>>>> Github: https://github.com/rmannibucau >>>>>>>> >>>>>>>> >>>>>>>> 2014-07-23 14:07 GMT+02:00 Andy Gumbrecht <[email protected] >>>>>>>> >: >>>>>>>> >>>>>>>> No, it is the template pom - Needs the correct tomee/openejb >>>>>>>> project >>>>>>>> >>>>>>>> versions for the plugins. It's fixed, try the old one - quite >>>>>>>> >>>>>>>>> useless >>>>>>>>> to a >>>>>>>>> newbie as the generated pom does not work - seems no one ever used >>>>>>>>> it? >>>>>>>>> >>>>>>>>> Andy >>>>>>>>> >>>>>>>>> >>>>>>>>> On 23/07/2014 13:48, Romain Manni-Bucau wrote: >>>>>>>>> >>>>>>>>> BTW not sure I follow what you do since maven archetype is >>>>>>>>> able to >>>>>>>>> >>>>>>>>> handle >>>>>>>>> >>>>>>>>>> it out of the box, why doing [VERSION]? >>>>>>>>>> >>>>>>>>>> + we should reuse pom of the archetype version with @version@ no? >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> Romain Manni-Bucau >>>>>>>>>> Twitter: @rmannibucau >>>>>>>>>> Blog: http://rmannibucau.wordpress.com/ >>>>>>>>>> LinkedIn: http://fr.linkedin.com/in/rmannibucau >>>>>>>>>> Github: https://github.com/rmannibucau >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> 2014-07-23 13:45 GMT+02:00 Andy Gumbrecht < >>>>>>>>>> [email protected] >>>>>>>>>> >>>>>>>>>>> : >>>>>>>>>>> >>>>>>>>>> Yea it,s a mistake, and no - It's supposed to be the >>>>>>>>>> placeholder >>>>>>>>>> for >>>>>>>>>> the >>>>>>>>>> >>>>>>>>>> user defined version. Fixing now! >>>>>>>>>> >>>>>>>>>> Andy. >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> On 23/07/2014 13:34, Romain Manni-Bucau wrote: >>>>>>>>>>> >>>>>>>>>>> <version>1.0-SNAPSHOT</version>? >>>>>>>>>>> >>>>>>>>>>> not the first time I see something related to tomee you set to >>>>>>>>>>> >>>>>>>>>>> 1.0-SNAPSHOT, isn't it 2? >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> Romain Manni-Bucau >>>>>>>>>>>> Twitter: @rmannibucau >>>>>>>>>>>> Blog: http://rmannibucau.wordpress.com/ >>>>>>>>>>>> LinkedIn: http://fr.linkedin.com/in/rmannibucau >>>>>>>>>>>> Github: https://github.com/rmannibucau >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> ---------- Forwarded message ---------- >>>>>>>>>>>> From: <[email protected]> >>>>>>>>>>>> Date: 2014-07-23 13:30 GMT+02:00 >>>>>>>>>>>> Subject: svn commit: r1612812 - in /tomee/tomee/trunk: ./ >>>>>>>>>>>> maven/tomee-webapp-archetype/pom.xml >>>>>>>>>>>> maven/tomee-webapp-archetype/src/main/resources/archetype- >>>>>>>>>>>> resources/pom.xml >>>>>>>>>>>> To: [email protected] >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> Author: andygumbrecht >>>>>>>>>>>> Date: Wed Jul 23 11:30:16 2014 >>>>>>>>>>>> New Revision: 1612812 >>>>>>>>>>>> >>>>>>>>>>>> URL: http://svn.apache.org/r1612812 >>>>>>>>>>>> Log: >>>>>>>>>>>> Fix archetype-resources/pom.xml >>>>>>>>>>>> >>>>>>>>>>>> Modified: >>>>>>>>>>>> tomee/tomee/trunk/ (props changed) >>>>>>>>>>>> tomee/tomee/trunk/maven/tomee- >>>>>>>>>>>> webapp-archetype/pom.xml >>>>>>>>>>>> >>>>>>>>>>>> tomee/tomee/trunk/maven/tomee-webapp-archetype/src/main/ >>>>>>>>>>>> resources/archetype-resources/pom.xml >>>>>>>>>>>> >>>>>>>>>>>> Propchange: tomee/tomee/trunk/ >>>>>>>>>>>> ------------------------------------------------------------ >>>>>>>>>>>> ------------------ >>>>>>>>>>>> Merged /tomee/tomee/branches/tomee-1.7.x:r1612811 >>>>>>>>>>>> >>>>>>>>>>>> Modified: tomee/tomee/trunk/maven/tomee- >>>>>>>>>>>> webapp-archetype/pom.xml >>>>>>>>>>>> URL: >>>>>>>>>>>> http://svn.apache.org/viewvc/tomee/tomee/trunk/maven/tomee- >>>>>>>>>>>> webapp-archetype/pom.xml?rev=1612812&r1=1612811&r2=1612812& >>>>>>>>>>>> view=diff >>>>>>>>>>>> ============================================================ >>>>>>>>>>>> ================== >>>>>>>>>>>> --- tomee/tomee/trunk/maven/tomee-webapp-archetype/pom.xml >>>>>>>>>>>> (original) >>>>>>>>>>>> +++ tomee/tomee/trunk/maven/tomee-webapp-archetype/pom.xml Wed >>>>>>>>>>>> Jul >>>>>>>>>>>> 23 >>>>>>>>>>>> 11:30:16 2014 >>>>>>>>>>>> @@ -27,4 +27,28 @@ Licensed to the Apache Software Foundati >>>>>>>>>>>> >>>>>>>>>>>> <artifactId>tomee-webapp-archetype</artifactId> >>>>>>>>>>>> <name>OpenEJB :: Maven Plugins :: TomEE Webapp >>>>>>>>>>>> Archetype</name> >>>>>>>>>>>> + >>>>>>>>>>>> + <build> >>>>>>>>>>>> + <plugins> >>>>>>>>>>>> + <plugin> >>>>>>>>>>>> + <groupId>org.apache.maven.plugins</groupId> >>>>>>>>>>>> + <artifactId>maven-antrun-plugin</artifactId> >>>>>>>>>>>> + <executions> >>>>>>>>>>>> + <execution> >>>>>>>>>>>> + <id>remove-apps</id> >>>>>>>>>>>> + <phase>process-resources</phase> >>>>>>>>>>>> + <goals> >>>>>>>>>>>> + <goal>run</goal> >>>>>>>>>>>> + </goals> >>>>>>>>>>>> + <configuration> >>>>>>>>>>>> + <target> >>>>>>>>>>>> + <replace >>>>>>>>>>>> file="${project.build.directory}/classes/archetype- >>>>>>>>>>>> resources/pom.xml" >>>>>>>>>>>> token="[VERSION]" value="${project.version}"/> >>>>>>>>>>>> + </target> >>>>>>>>>>>> + </configuration> >>>>>>>>>>>> + </execution> >>>>>>>>>>>> + </executions> >>>>>>>>>>>> + </plugin> >>>>>>>>>>>> + </plugins> >>>>>>>>>>>> + </build> >>>>>>>>>>>> + >>>>>>>>>>>> </project> >>>>>>>>>>>> >>>>>>>>>>>> Modified: >>>>>>>>>>>> tomee/tomee/trunk/maven/tomee-webapp-archetype/src/main/ >>>>>>>>>>>> resources/archetype-resources/pom.xml >>>>>>>>>>>> URL: >>>>>>>>>>>> http://svn.apache.org/viewvc/tomee/tomee/trunk/maven/tomee- >>>>>>>>>>>> webapp-archetype/src/main/resources/archetype-resources/ >>>>>>>>>>>> pom.xml?rev=1612812&r1=1612811&r2=1612812&view=diff >>>>>>>>>>>> ============================================================ >>>>>>>>>>>> ================== >>>>>>>>>>>> --- >>>>>>>>>>>> tomee/tomee/trunk/maven/tomee-webapp-archetype/src/main/ >>>>>>>>>>>> resources/archetype-resources/pom.xml >>>>>>>>>>>> (original) >>>>>>>>>>>> +++ >>>>>>>>>>>> tomee/tomee/trunk/maven/tomee-webapp-archetype/src/main/ >>>>>>>>>>>> resources/archetype-resources/pom.xml >>>>>>>>>>>> Wed Jul 23 11:30:16 2014 >>>>>>>>>>>> @@ -42,7 +42,7 @@ >>>>>>>>>>>> <dependency> >>>>>>>>>>>> <groupId>org.apache.openejb</groupId> >>>>>>>>>>>> <artifactId>arquillian-tomee-remote</artifactId> >>>>>>>>>>>> - <version>${version}</version> >>>>>>>>>>>> + <version>1.0-SNAPSHOT</version> >>>>>>>>>>>> <scope>test</scope> >>>>>>>>>>>> </dependency> >>>>>>>>>>>> <dependency> >>>>>>>>>>>> @@ -104,13 +104,13 @@ >>>>>>>>>>>> <plugin> >>>>>>>>>>>> <groupId>org.apache.openejb.maven</groupId> >>>>>>>>>>>> <artifactId>tomee-maven-plugin</artifactId> >>>>>>>>>>>> - <version>${version}</version> >>>>>>>>>>>> + <version>[VERSION]</version> >>>>>>>>>>>> <configuration> >>>>>>>>>>>> <context>ROOT</context> >>>>>>>>>>>> </configuration> >>>>>>>>>>>> </plugin> >>>>>>>>>>>> <plugin> >>>>>>>>>>>> - <groupId>org.apache.openejb</groupId> >>>>>>>>>>>> + <groupId>org.apache.openjpa</groupId> >>>>>>>>>>>> <artifactId>openjpa-maven-plugin</artifactId> >>>>>>>>>>>> <version>2.3.0</version> >>>>>>>>>>>> <configuration> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> -- >>>>>>>>>>>> >>>>>>>>>>>> Andy Gumbrecht >>>>>>>>>>>> >>>>>>>>>>>> http://www.tomitribe.com >>>>>>>>>>> [email protected] >>>>>>>>>>> https://twitter.com/AndyGeeDe >>>>>>>>>>> >>>>>>>>>>> TomEE treibt Tomitribe! | http://tomee.apache.org >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> -- >>>>>>>>>>> >>>>>>>>>>> Andy Gumbrecht >>>>>>>>>>> >>>>>>>>>> http://www.tomitribe.com >>>>>>>>> [email protected] >>>>>>>>> https://twitter.com/AndyGeeDe >>>>>>>>> >>>>>>>>> TomEE treibt Tomitribe! | http://tomee.apache.org >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> -- >>>>>>>>> >>>>>>>>> Andy Gumbrecht >>>>>>>> >>>>>>> http://www.tomitribe.com >>>>>>> [email protected] >>>>>>> https://twitter.com/AndyGeeDe >>>>>>> >>>>>>> TomEE treibt Tomitribe! | http://tomee.apache.org >>>>>>> >>>>>>> >>>>>>> >>>>>>> -- >>>>>>> >>>>>> Andy Gumbrecht >>>>> >>>>> http://www.tomitribe.com >>>>> [email protected] >>>>> https://twitter.com/AndyGeeDe >>>>> >>>>> TomEE treibt Tomitribe! | http://tomee.apache.org >>>>> >>>>> >>>>> >>>>> -- >>> Andy Gumbrecht >>> >>> http://www.tomitribe.com >>> [email protected] >>> https://twitter.com/AndyGeeDe >>> >>> TomEE treibt Tomitribe! | http://tomee.apache.org >>> >>> >>> > -- > Andy Gumbrecht > > http://www.tomitribe.com > [email protected] > https://twitter.com/AndyGeeDe > > TomEE treibt Tomitribe! | http://tomee.apache.org > >
