Author: bentmann Date: Fri May 1 10:04:53 2009 New Revision: 770604 URL: http://svn.apache.org/viewvc?rev=770604&view=rev Log: o Fixed IOE when running on Java 1.4
Modified: maven/components/branches/maven-2.1.x/maven-project/src/main/java/org/apache/maven/project/artifact/VersionExpressionTransformation.java Modified: maven/components/branches/maven-2.1.x/maven-project/src/main/java/org/apache/maven/project/artifact/VersionExpressionTransformation.java URL: http://svn.apache.org/viewvc/maven/components/branches/maven-2.1.x/maven-project/src/main/java/org/apache/maven/project/artifact/VersionExpressionTransformation.java?rev=770604&r1=770603&r2=770604&view=diff ============================================================================== --- maven/components/branches/maven-2.1.x/maven-project/src/main/java/org/apache/maven/project/artifact/VersionExpressionTransformation.java (original) +++ maven/components/branches/maven-2.1.x/maven-project/src/main/java/org/apache/maven/project/artifact/VersionExpressionTransformation.java Fri May 1 10:04:53 2009 @@ -179,7 +179,7 @@ return; } - protected File transformVersions( File pomFile, Artifact artifact, ArtifactRepository localRepository ) + File transformVersions( File pomFile, Artifact artifact, ArtifactRepository localRepository ) throws IOException, ModelInterpolationException { ProjectBuilderConfiguration pbConfig; @@ -238,6 +238,21 @@ outputFile = pomFile; } + catch ( NoClassDefFoundError ncdfe ) + { + if ( ncdfe.getMessage().indexOf( "javax/xml/xpath" ) > -1 ) + { + getLogger().warn( "Cannot load XPath classes from JDK. Your JDK version may be < 1.5." + + "\n\nNOTE: This prevents the interpolation of version expressions in your POMs " + + "during the install/deploy steps of the build!\n\n" ); + + outputFile = pomFile; + } + else + { + throw ncdfe; + } + } finally { IOUtil.close( reader ); @@ -246,7 +261,7 @@ return outputFile; } - protected void interpolateVersions( File pomFile, File outputFile, Model model, File projectDir, + void interpolateVersions( File pomFile, File outputFile, Model model, File projectDir, ProjectBuilderConfiguration config ) throws ModelInterpolationException { @@ -256,26 +271,7 @@ // use of the XPP3 Model reader/writers, which have a tendency to lose XML comments and such. // SOOO, we're using a two-stage string interpolation here. The first stage selects all XML 'version' // elements, and subjects their values to interpolation in the second stage. - XPathVersionExpressionInterpolator interpolator; - try - { - interpolator = new XPathVersionExpressionInterpolator( getLogger() ); - } - catch ( NoClassDefFoundError ncdfe ) - { - if ( ncdfe.getMessage().indexOf( "javax/xml/xpath" ) > -1 ) - { - getLogger().warn( "Cannot load XPath classes from JDK. Your JDK version may be < 1.5." + - "\n\nNOTE: This prevents the interpolation of version expressions in your POMs " + - "during the install/deploy steps of the build!\n\n" ); - - return; - } - else - { - throw ncdfe; - } - } + XPathVersionExpressionInterpolator interpolator = new XPathVersionExpressionInterpolator( getLogger() ); // The second-stage interpolator is the 'normal' one used in all Model interpolation throughout // maven-project.