I thought it needed a full deep copy to preserve the model and we decided to back away from that in this release? I remember discussing it, but not the exact outcome.
-----Original Message----- From: John Casey [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 03, 2008 1:20 PM To: Maven Developers List Subject: Re: Question: How to get the original model before the super-pom's pluginManagement is injected? That's in the stuff I've been putting out in RCs, to be clear... John Casey wrote: > FWIW, the reimplemented cloneModel(..) method (which in part causes this > problem, because it clones too shallowly) should keep the originalModel > instance from being polluted with resolved plugin information. > > I *think* the integration test for MNG-3710 should cover this case, but > I can't remember for sure. If not, we need a test case that we can use > to fix it. > > Stephen Connolly wrote: >> Grrr argh! >> >> Ok, hmm I'll have a closer look at your code as you did not seem to be >> parsing the XML from my initial reading of the code >> >> On Wed, Sep 3, 2008 at 3:15 PM, Brian E. Fox >> <[EMAIL PROTECTED]>wrote: >> >>> You can't, this is why in the enforcer rule, I have to walk and >>> interpolate the entire tree. If I could get the model from maven >>> unmolested, I could cut out 99% of that code. >>> >>> -----Original Message----- >>> From: Stephen Connolly [mailto:[EMAIL PROTECTED] >>> Sent: Wednesday, September 03, 2008 6:31 AM >>> To: Maven Developers List >>> Subject: Question: How to get the original model before the super-pom's >>> pluginManagement is injected? >>> >>> If I have the floowing pom.xml: >>> >>> <project> >>> <modelVersion>4.0.0</modelVersion> >>> >>> <groupId>org.codehaus.mojo.versions-maven-plugin.it</groupId> >>> <artifactId>parent</artifactId> >>> <version>2.0</version> >>> <packaging>pom</packaging> >>> >>> <build> >>> <pluginManagement> >>> <plugins> >>> <plugin> >>> <artifactId>maven-checkstyle-plugin</artifactId> >>> <version>2.1</version> >>> </plugin> >>> <plugin> >>> <groupId>org.apache.maven.plugins</groupId> >>> <artifactId>maven-javadoc-plugin</artifactId> >>> </plugin> >>> <plugin> >>> <groupId>org.apache.maven.plugins</groupId> >>> <artifactId>maven-compiler-plugin</artifactId> >>> <configuration> >>> <source>1.4</source> >>> <target>1.4</target> >>> </configuration> >>> </plugin> >>> <plugin> >>> <groupId>org.codehaus.mojo</groupId> >>> <artifactId>build-helper-maven-plugin</artifactId> >>> </plugin> >>> </plugins> >>> </pluginManagement> >>> <plugins> >>> <plugin> >>> <groupId>org.apache.maven.plugins</groupId> >>> <artifactId>maven-clean-plugin</artifactId> >>> <version>2.1</version> >>> </plugin> >>> </plugins> >>> </build> >>> </project> >>> >>> How do I detect in a mojo that the pluginManagement section has a entry >>> for >>> maven-compiler-plugin that *does not have the version specified*... >>> >>> If I look at mavenProject.getPluginManagement().getPlugins() I'll see >>> maven-compiler-plugin but with version set to 2.0.2 (from the super pom) >>> >>> If I look at >>> mavenProject.getModel().getBuild().getPluginManagement().getPlugins(), >>> same >>> thing (*But this should be ok as it's the interpolated model anyway*) >>> >>> If I look at >>> mavenProject.getOriginalModel().getBuild().getPluginManagement().getPlug >>> ins(), >>> same thing *isn't this supposed to be the original model... before >>> interpolation* >>> >>> Just to check I'm not going mad I logged the output of >>> mavenProject.writeOriginalModel which gives: >>> >>> <?xml version="1.0" encoding="UTF-8"?><project> >>> <modelVersion>4.0.0</modelVersion> >>> <groupId>org.codehaus.mojo.versions-maven-plugin.it</groupId> >>> <artifactId>parent</artifactId> >>> <packaging>pom</packaging> >>> <version>2.0</version> >>> <build> >>> <pluginManagement> >>> <plugins> >>> <plugin> >>> <artifactId>maven-antrun-plugin</artifactId> >>> <version>1.1</version> >>> </plugin> >>> <plugin> >>> <artifactId>maven-assembly-plugin</artifactId> >>> <version>2.2-beta-2</version> >>> </plugin> >>> <plugin> >>> <artifactId>maven-clean-plugin</artifactId> >>> <version>2.2</version> >>> </plugin> >>> <plugin> >>> <artifactId>maven-compiler-plugin</artifactId> >>> <version>2.0.2</version> >>> <configuration> >>> <source>1.4</source> >>> <target>1.4</target> >>> </configuration> >>> </plugin> >>> <plugin> >>> <artifactId>maven-dependency-plugin</artifactId> >>> <version>2.0</version> >>> </plugin> >>> <plugin> >>> <artifactId>maven-deploy-plugin</artifactId> >>> <version>2.3</version> >>> </plugin> >>> <plugin> >>> <artifactId>maven-ear-plugin</artifactId> >>> <version>2.3.1</version> >>> </plugin> >>> <plugin> >>> <artifactId>maven-ejb-plugin</artifactId> >>> <version>2.1</version> >>> </plugin> >>> <plugin> >>> <artifactId>maven-install-plugin</artifactId> >>> <version>2.2</version> >>> </plugin> >>> <plugin> >>> <artifactId>maven-jar-plugin</artifactId> >>> <version>2.2</version> >>> </plugin> >>> <plugin> >>> <artifactId>maven-checkstyle-plugin</artifactId> >>> <version>2.1</version> >>> </plugin> >>> <plugin> >>> <artifactId>maven-javadoc-plugin</artifactId> >>> <version>2.4</version> >>> </plugin> >>> <plugin> >>> <artifactId>maven-plugin-plugin</artifactId> >>> <version>2.4.1</version> >>> </plugin> >>> <plugin> >>> <artifactId>maven-rar-plugin</artifactId> >>> <version>2.2</version> >>> </plugin> >>> <plugin> >>> <artifactId>maven-release-plugin</artifactId> >>> <version>2.0-beta-7</version> >>> </plugin> >>> <plugin> >>> <artifactId>maven-resources-plugin</artifactId> >>> <version>2.2</version> >>> </plugin> >>> <plugin> >>> <artifactId>maven-site-plugin</artifactId> >>> <version>2.0-beta-6</version> >>> </plugin> >>> <plugin> >>> <artifactId>maven-source-plugin</artifactId> >>> <version>2.0.4</version> >>> </plugin> >>> <plugin> >>> <artifactId>maven-surefire-plugin</artifactId> >>> <version>2.4.2</version> >>> </plugin> >>> <plugin> >>> <artifactId>maven-war-plugin</artifactId> >>> <version>2.1-alpha-1</version> >>> </plugin> >>> <plugin> >>> <groupId>org.codehaus.mojo</groupId> >>> <artifactId>build-helper-maven-plugin</artifactId> >>> </plugin> >>> </plugins> >>> </pluginManagement> >>> <plugins> >>> <plugin> >>> <artifactId>maven-clean-plugin</artifactId> >>> <version>2.1</version> >>> </plugin> >>> </plugins> >>> </build> >>> </project> >>> >>> *oh look the super pom has been injected in before I can see it* >>> >>> I have not checked, but I suspect that maven-enforcer-plugin will have >>> the >>> same issue with Maven 2.0.9+ (given that I've pilfered a lot of the >>> logic >>> for missing versions from there) >>> >>> I really don't want to have to write my own ModelXpp3Reader, or have to >>> bury >>> in plugin code logic to find the pom.xml and read it in directly... >>> >>> So... any thoughts? >>> >>> -Stephen >>> >>> --------------------------------------------------------------------- >>> To unsubscribe, e-mail: [EMAIL PROTECTED] >>> For additional commands, e-mail: [EMAIL PROTECTED] >>> >>> >> > -- John Casey Developer, PMC Member - Apache Maven (http://maven.apache.org) Blog: http://www.ejlife.net/blogs/buildchimp/ --------------------------------------------------------------------- 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]