Removing the build overlay, as it was causing problems with path translation, and doesn't serve any real purpose.

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@605095 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
John Dennis Casey 2007-12-18 05:36:03 +00:00
parent b7785ba822
commit fe4363a4c5
4 changed files with 8 additions and 344 deletions

View File

@ -261,7 +261,7 @@ public class PluginParameterExpressionEvaluatorTest
Object value = expressionEvaluator.evaluate( "${project.build.directory}" + FS + "${project.build.finalName}" ); Object value = expressionEvaluator.evaluate( "${project.build.directory}" + FS + "${project.build.finalName}" );
assertEquals( new File( "expected-directory/expected-finalName" ).getCanonicalPath(), value ); assertEquals( "expected-directory/expected-finalName", value );
} }
public void testShouldExtractPluginArtifacts() public void testShouldExtractPluginArtifacts()

View File

@ -706,15 +706,17 @@ public class DefaultMavenProjectBuilder
if ( fromSourceTree ) if ( fromSourceTree )
{ {
Build build = project.getBuild();
// NOTE: setting this script-source root before path translation, because
// the plugin tools compose basedir and scriptSourceRoot into a single file.
project.addScriptSourceRoot( build.getScriptSourceDirectory() );
getLogger().debug( "Aligning project: " + project.getId() + " to base directory: " + projectDescriptor.getParentFile() ); getLogger().debug( "Aligning project: " + project.getId() + " to base directory: " + projectDescriptor.getParentFile() );
pathTranslator.alignToBaseDirectory( project.getModel(), projectDescriptor.getParentFile() ); pathTranslator.alignToBaseDirectory( project.getModel(), projectDescriptor.getParentFile() );
Build build = project.getBuild();
project.addCompileSourceRoot( build.getSourceDirectory() ); project.addCompileSourceRoot( build.getSourceDirectory() );
project.addScriptSourceRoot( build.getScriptSourceDirectory() );
project.addTestCompileSourceRoot( build.getTestSourceDirectory() ); project.addTestCompileSourceRoot( build.getTestSourceDirectory() );
// Only track the file of a POM in the source tree // Only track the file of a POM in the source tree

View File

@ -51,7 +51,6 @@ import org.apache.maven.model.io.xpp3.MavenXpp3Writer;
import org.apache.maven.project.artifact.ActiveProjectArtifact; import org.apache.maven.project.artifact.ActiveProjectArtifact;
import org.apache.maven.project.artifact.InvalidDependencyVersionException; import org.apache.maven.project.artifact.InvalidDependencyVersionException;
import org.apache.maven.project.artifact.MavenMetadataSource; import org.apache.maven.project.artifact.MavenMetadataSource;
import org.apache.maven.project.overlay.BuildOverlay;
import org.codehaus.plexus.util.xml.Xpp3Dom; import org.codehaus.plexus.util.xml.Xpp3Dom;
import java.io.File; import java.io.File;
@ -1038,19 +1037,12 @@ public class MavenProject
public void setBuild( Build build ) public void setBuild( Build build )
{ {
buildOverlay = new BuildOverlay( build );
model.setBuild( build ); model.setBuild( build );
} }
public Build getBuild() public Build getBuild()
{ {
if ( buildOverlay == null ) return getModelBuild();
{
buildOverlay = new BuildOverlay( getModelBuild() );
}
return buildOverlay;
} }
public List getResources() public List getResources()

View File

@ -1,330 +0,0 @@
package org.apache.maven.project.overlay;
/*
* 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.
*/
import org.apache.maven.model.Build;
import org.apache.maven.model.Extension;
import org.apache.maven.model.Plugin;
import org.apache.maven.model.PluginManagement;
import org.apache.maven.model.Resource;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* @todo why delegate? this is asking for trouble when there are additions.
*/
public class BuildOverlay
extends Build
{
private final Build build;
private List resources;
private List testResources;
public BuildOverlay( Build build )
{
if ( build == null )
{
this.build = new Build();
resources = new ArrayList();
testResources = new ArrayList();
}
else
{
this.build = build;
resources = new ArrayList( build.getResources() );
testResources = new ArrayList( build.getTestResources() );
}
}
public void addExtension( Extension extension )
{
build.addExtension( extension );
}
public void addPlugin( Plugin plugin )
{
build.addPlugin( plugin );
}
public void addResource( Resource resource )
{
resources.add( resource );
}
public void addTestResource( Resource resource )
{
testResources.add( resource );
}
public boolean equals( Object obj )
{
return build.equals( obj );
}
public void flushPluginMap()
{
build.flushPluginMap();
}
public String getDefaultGoal()
{
return build.getDefaultGoal();
}
public String getDirectory()
{
String path = build.getDirectory();
File file = new File( build.getDirectory() );
try
{
path = file.getCanonicalPath();
}
catch ( IOException e )
{
handleCanonicalException( path, e );
}
return path;
}
public List getExtensions()
{
return build.getExtensions();
}
public String getFinalName()
{
return build.getFinalName();
}
public String getOutputDirectory()
{
String path = build.getDirectory();
File file = new File( build.getOutputDirectory() );
try
{
path = file.getCanonicalPath();
}
catch ( IOException e )
{
handleCanonicalException( path, e );
}
return path;
}
public PluginManagement getPluginManagement()
{
return build.getPluginManagement();
}
public List getPlugins()
{
return build.getPlugins();
}
public Map getPluginsAsMap()
{
return build.getPluginsAsMap();
}
public List getResources()
{
return resources;
}
public String getScriptSourceDirectory()
{
String path = build.getDirectory();
File file = new File( build.getScriptSourceDirectory() );
try
{
path = file.getCanonicalPath();
}
catch ( IOException e )
{
handleCanonicalException( path, e );
}
return path;
}
private void handleCanonicalException( String path, IOException e )
{
IllegalStateException error = new IllegalStateException( "Cannot compute canonical path for: " + path
+ ". Reason: " + e.getMessage() );
error.initCause( e );
throw error;
}
public String getSourceDirectory()
{
return build.getSourceDirectory();
}
public String getTestOutputDirectory()
{
return build.getTestOutputDirectory();
}
public List getTestResources()
{
return testResources;
}
public String getTestSourceDirectory()
{
String path = build.getDirectory();
File file = new File( build.getTestSourceDirectory() );
try
{
path = file.getCanonicalPath();
}
catch ( IOException e )
{
handleCanonicalException( path, e );
}
return path;
}
public int hashCode()
{
return build.hashCode();
}
public void removeExtension( Extension extension )
{
build.removeExtension( extension );
}
public void removePlugin( Plugin plugin )
{
build.removePlugin( plugin );
}
public void removeResource( Resource resource )
{
resources.remove( resource );
}
public void removeTestResource( Resource resource )
{
testResources.remove( resource );
}
public void setDefaultGoal( String defaultGoal )
{
build.setDefaultGoal( defaultGoal );
}
public void setDirectory( String directory )
{
build.setDirectory( directory );
}
public void setExtensions( List extensions )
{
build.setExtensions( extensions );
}
public void setFinalName( String finalName )
{
build.setFinalName( finalName );
}
public void setOutputDirectory( String outputDirectory )
{
build.setOutputDirectory( outputDirectory );
}
public void setPluginManagement( PluginManagement pluginManagement )
{
build.setPluginManagement( pluginManagement );
}
public void setPlugins( List plugins )
{
build.setPlugins( plugins );
}
public void setResources( List resources )
{
this.resources = resources;
}
public void setScriptSourceDirectory( String scriptSourceDirectory )
{
build.setScriptSourceDirectory( scriptSourceDirectory );
}
public void setSourceDirectory( String sourceDirectory )
{
build.setSourceDirectory( sourceDirectory );
}
public void setTestOutputDirectory( String testOutputDirectory )
{
build.setTestOutputDirectory( testOutputDirectory );
}
public void setTestResources( List testResources )
{
this.testResources = testResources;
}
public void setTestSourceDirectory( String testSourceDirectory )
{
build.setTestSourceDirectory( testSourceDirectory );
}
public String toString()
{
return build.toString();
}
public void addFilter( String string )
{
build.addFilter( string );
} //-- void addFilter(String)
public List getFilters()
{
return build.getFilters();
} //-- java.util.List getFilters()
public void removeFilter( String string )
{
build.removeFilter( string );
} //-- void removeFilter(String)
public void setFilters( List filters )
{
build.setFilters( filters );
} //-- void setFilters(java.util.List)
}