mirror of https://github.com/apache/maven.git
Hooked up maven-project-builder into build. Updated classes.
git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@706143 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
3412160ab7
commit
d733885e54
|
@ -31,6 +31,10 @@ under the License.
|
||||||
<artifactId>maven-core</artifactId>
|
<artifactId>maven-core</artifactId>
|
||||||
<name>Maven Core</name>
|
<name>Maven Core</name>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.maven</groupId>
|
||||||
|
<artifactId>maven-project-builder</artifactId>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.maven</groupId>
|
<groupId>org.apache.maven</groupId>
|
||||||
<artifactId>maven-lifecycle</artifactId>
|
<artifactId>maven-lifecycle</artifactId>
|
||||||
|
|
|
@ -27,7 +27,9 @@ under the License.
|
||||||
<version>3.0-SNAPSHOT</version>
|
<version>3.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<groupId>org.apache.maven</groupId>
|
||||||
<artifactId>maven-project-builder</artifactId>
|
<artifactId>maven-project-builder</artifactId>
|
||||||
|
<version>3.0-SNAPSHOT</version>
|
||||||
<name>Maven Project Builder</name>
|
<name>Maven Project Builder</name>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|
|
@ -37,12 +37,13 @@ public final class ArtifactModelContainerFactory
|
||||||
private static final Collection<String> uris = Collections.unmodifiableList( Arrays.asList(
|
private static final Collection<String> uris = Collections.unmodifiableList( Arrays.asList(
|
||||||
|
|
||||||
ProjectUri.DependencyManagement.Dependencies.Dependency.xUri, ProjectUri.Dependencies.Dependency.xUri,
|
ProjectUri.DependencyManagement.Dependencies.Dependency.xUri, ProjectUri.Dependencies.Dependency.xUri,
|
||||||
|
ProjectUri.Reporting.Plugins.Plugin.xUri,
|
||||||
ProjectUri.Build.PluginManagement.Plugins.Plugin.xUri,
|
ProjectUri.Build.PluginManagement.Plugins.Plugin.xUri,
|
||||||
ProjectUri.Build.PluginManagement.Plugins.Plugin.Dependencies.Dependency.xUri,
|
ProjectUri.Build.PluginManagement.Plugins.Plugin.Dependencies.Dependency.xUri,
|
||||||
|
|
||||||
ProjectUri.Build.Plugins.Plugin.xUri, ProjectUri.Build.Plugins.Plugin.Dependencies.Dependency.xUri,
|
ProjectUri.Build.Plugins.Plugin.xUri, ProjectUri.Build.Plugins.Plugin.Dependencies.Dependency.xUri,
|
||||||
ProjectUri.Build.Plugins.Plugin.Dependencies.Dependency.Exclusions.Exclusion.xUri ) );
|
ProjectUri.Build.Plugins.Plugin.Dependencies.Dependency.Exclusions.Exclusion.xUri
|
||||||
|
) );
|
||||||
|
|
||||||
public Collection<String> getUris()
|
public Collection<String> getUris()
|
||||||
{
|
{
|
||||||
|
@ -128,7 +129,7 @@ public final class ArtifactModelContainerFactory
|
||||||
sb.append( mp ).append( "\r\n" );
|
sb.append( mp ).append( "\r\n" );
|
||||||
}
|
}
|
||||||
throw new IllegalArgumentException( "Properties does not contain artifact id. Group ID = " + groupId +
|
throw new IllegalArgumentException( "Properties does not contain artifact id. Group ID = " + groupId +
|
||||||
", Version = " + version + ":" + sb );
|
", Version = " + version + ", Base = " + uri + ":\r\n" + sb );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( type == null )
|
if ( type == null )
|
||||||
|
|
|
@ -1506,7 +1506,7 @@ public class ProjectUri
|
||||||
"http://apache.org/maven/project/reporting/plugins#collection/plugin/inherited";
|
"http://apache.org/maven/project/reporting/plugins#collection/plugin/inherited";
|
||||||
|
|
||||||
public static String configuration =
|
public static String configuration =
|
||||||
"http://apache.org/maven/project/reporting/plugins#collection/plugin/configuration";
|
"http://apache.org/maven/project/reporting/plugins#collection/plugin/configuration#set";
|
||||||
|
|
||||||
public static class ReportSets
|
public static class ReportSets
|
||||||
{
|
{
|
||||||
|
|
|
@ -36,6 +36,10 @@ under the License.
|
||||||
<groupId>org.apache.maven</groupId>
|
<groupId>org.apache.maven</groupId>
|
||||||
<artifactId>maven-model</artifactId>
|
<artifactId>maven-model</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.maven</groupId>
|
||||||
|
<artifactId>maven-project-builder</artifactId>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.codehaus.plexus</groupId>
|
<groupId>org.codehaus.plexus</groupId>
|
||||||
<artifactId>plexus-utils</artifactId>
|
<artifactId>plexus-utils</artifactId>
|
||||||
|
|
|
@ -1,230 +0,0 @@
|
||||||
package org.apache.maven.project.builder;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* 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.shared.model.ModelContainer;
|
|
||||||
import org.apache.maven.shared.model.ModelContainerAction;
|
|
||||||
import org.apache.maven.shared.model.ModelContainerFactory;
|
|
||||||
import org.apache.maven.shared.model.ModelProperty;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public final class ArtifactModelContainerFactory
|
|
||||||
implements ModelContainerFactory
|
|
||||||
{
|
|
||||||
|
|
||||||
private static final Collection<String> uris = Collections.unmodifiableList( Arrays.asList(
|
|
||||||
|
|
||||||
ProjectUri.DependencyManagement.Dependencies.Dependency.xUri, ProjectUri.Dependencies.Dependency.xUri,
|
|
||||||
ProjectUri.Reporting.Plugins.Plugin.xUri,
|
|
||||||
ProjectUri.Build.PluginManagement.Plugins.Plugin.xUri,
|
|
||||||
ProjectUri.Build.PluginManagement.Plugins.Plugin.Dependencies.Dependency.xUri,
|
|
||||||
|
|
||||||
ProjectUri.Build.Plugins.Plugin.xUri, ProjectUri.Build.Plugins.Plugin.Dependencies.Dependency.xUri,
|
|
||||||
ProjectUri.Build.Plugins.Plugin.Dependencies.Dependency.Exclusions.Exclusion.xUri
|
|
||||||
) );
|
|
||||||
|
|
||||||
public Collection<String> getUris()
|
|
||||||
{
|
|
||||||
return uris;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ModelContainer create( List<ModelProperty> modelProperties )
|
|
||||||
{
|
|
||||||
if ( modelProperties == null || modelProperties.size() == 0 )
|
|
||||||
{
|
|
||||||
throw new IllegalArgumentException( "modelProperties: null or empty" );
|
|
||||||
}
|
|
||||||
return new ArtifactModelContainer( modelProperties );
|
|
||||||
}
|
|
||||||
|
|
||||||
private static class ArtifactModelContainer
|
|
||||||
implements ModelContainer
|
|
||||||
{
|
|
||||||
|
|
||||||
private String groupId;
|
|
||||||
|
|
||||||
private String artifactId;
|
|
||||||
|
|
||||||
private String version;
|
|
||||||
|
|
||||||
private String type;
|
|
||||||
|
|
||||||
private List<ModelProperty> properties;
|
|
||||||
|
|
||||||
private static String findBaseUriFrom( List<ModelProperty> modelProperties )
|
|
||||||
{
|
|
||||||
String baseUri = null;
|
|
||||||
for ( ModelProperty mp : modelProperties )
|
|
||||||
{
|
|
||||||
if ( baseUri == null || mp.getUri().length() < baseUri.length() )
|
|
||||||
{
|
|
||||||
baseUri = mp.getUri();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return baseUri;
|
|
||||||
}
|
|
||||||
|
|
||||||
private ArtifactModelContainer( List<ModelProperty> properties )
|
|
||||||
{
|
|
||||||
this.properties = new ArrayList<ModelProperty>( properties );
|
|
||||||
this.properties = Collections.unmodifiableList( this.properties );
|
|
||||||
String uri = findBaseUriFrom( this.properties );
|
|
||||||
|
|
||||||
for ( ModelProperty mp : this.properties )
|
|
||||||
{
|
|
||||||
if ( version == null && mp.getUri().equals( uri + "/version" ) )
|
|
||||||
{
|
|
||||||
this.version = mp.getResolvedValue();
|
|
||||||
}
|
|
||||||
else if ( artifactId == null && mp.getUri().equals( uri + "/artifactId" ) )
|
|
||||||
{
|
|
||||||
this.artifactId = mp.getResolvedValue();
|
|
||||||
}
|
|
||||||
else if ( groupId == null && mp.getUri().equals( uri + "/groupId" ) )
|
|
||||||
{
|
|
||||||
this.groupId = mp.getResolvedValue();
|
|
||||||
}
|
|
||||||
else if ( type == null && mp.getUri().equals( ProjectUri.Dependencies.Dependency.type )
|
|
||||||
|| mp.getUri().equals(ProjectUri.DependencyManagement.Dependencies.Dependency.type)
|
|
||||||
|| mp.getUri().equals(ProjectUri.Build.PluginManagement.Plugins.Plugin.Dependencies.Dependency.type)
|
|
||||||
|| mp.getUri().equals(ProjectUri.Build.Plugins.Plugin.Dependencies.Dependency.type))
|
|
||||||
{
|
|
||||||
this.type = mp.getResolvedValue();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ( groupId == null )
|
|
||||||
{
|
|
||||||
groupId = "org.apache.maven.plugins";
|
|
||||||
// throw new IllegalArgumentException("properties does not contain group id. Artifact ID = "
|
|
||||||
// + artifactId + ", Version = " + version);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( artifactId == null )
|
|
||||||
{
|
|
||||||
StringBuffer sb = new StringBuffer();
|
|
||||||
for ( ModelProperty mp : properties )
|
|
||||||
{
|
|
||||||
sb.append( mp ).append( "\r\n" );
|
|
||||||
}
|
|
||||||
throw new IllegalArgumentException( "Properties does not contain artifact id. Group ID = " + groupId +
|
|
||||||
", Version = " + version + ", Base = " + uri + ":\r\n" + sb );
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( type == null )
|
|
||||||
{
|
|
||||||
type = "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public ModelContainerAction containerAction( ModelContainer modelContainer )
|
|
||||||
{
|
|
||||||
if ( modelContainer == null )
|
|
||||||
{
|
|
||||||
throw new IllegalArgumentException( "modelContainer: null" );
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( !( modelContainer instanceof ArtifactModelContainer ) )
|
|
||||||
{
|
|
||||||
throw new IllegalArgumentException( "modelContainer: wrong type" );
|
|
||||||
}
|
|
||||||
|
|
||||||
ArtifactModelContainer c = (ArtifactModelContainer) modelContainer;
|
|
||||||
if ( c.groupId.equals( groupId ) && c.artifactId.equals( artifactId ) )
|
|
||||||
{
|
|
||||||
if ( c.version == null )
|
|
||||||
{
|
|
||||||
if ( version == null )
|
|
||||||
{
|
|
||||||
if ( c.type.equals( type ) )
|
|
||||||
{
|
|
||||||
return ModelContainerAction.JOIN;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return ModelContainerAction.NOP;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ModelContainerAction.JOIN;
|
|
||||||
}
|
|
||||||
if ( version == null )
|
|
||||||
{
|
|
||||||
if ( c.version == null )
|
|
||||||
{
|
|
||||||
if ( c.type.equals( type ) )
|
|
||||||
{
|
|
||||||
return ModelContainerAction.JOIN;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return ModelContainerAction.NOP;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ModelContainerAction.JOIN;
|
|
||||||
}
|
|
||||||
if ( c.version.equals( version ) )
|
|
||||||
{
|
|
||||||
if ( c.type.equals( type ) )
|
|
||||||
{
|
|
||||||
return ModelContainerAction.JOIN;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return ModelContainerAction.NOP;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return ModelContainerAction.DELETE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return ModelContainerAction.NOP;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public ModelContainer createNewInstance( List<ModelProperty> modelProperties )
|
|
||||||
{
|
|
||||||
return new ArtifactModelContainer( modelProperties );
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<ModelProperty> getProperties()
|
|
||||||
{
|
|
||||||
return properties;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String toString()
|
|
||||||
{
|
|
||||||
StringBuffer sb = new StringBuffer();
|
|
||||||
sb.append( "Group ID = " ).append( groupId ).append( ", Artifact ID = " ).append( artifactId )
|
|
||||||
.append( ", Version" ).append( version ).append( "\r\n" );
|
|
||||||
for ( ModelProperty mp : properties )
|
|
||||||
{
|
|
||||||
sb.append( mp ).append( "\r\n" );
|
|
||||||
}
|
|
||||||
return sb.toString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,113 +0,0 @@
|
||||||
package org.apache.maven.project.builder;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* 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.shared.model.ModelContainer;
|
|
||||||
import org.apache.maven.shared.model.ModelContainerAction;
|
|
||||||
import org.apache.maven.shared.model.ModelContainerFactory;
|
|
||||||
import org.apache.maven.shared.model.ModelProperty;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class IdModelContainerFactory
|
|
||||||
implements ModelContainerFactory
|
|
||||||
{
|
|
||||||
|
|
||||||
private static final Collection<String> uris = Collections.unmodifiableList( Arrays.asList(
|
|
||||||
ProjectUri.PluginRepositories.PluginRepository.xUri, ProjectUri.Repositories.Repository.xUri,
|
|
||||||
ProjectUri.Reporting.Plugins.Plugin.ReportSets.ReportSet.xUri, ProjectUri.Profiles.Profile.xUri,
|
|
||||||
ProjectUri.Build.Plugins.Plugin.Executions.Execution.xUri ) );
|
|
||||||
|
|
||||||
public Collection<String> getUris()
|
|
||||||
{
|
|
||||||
return uris;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ModelContainer create( List<ModelProperty> modelProperties )
|
|
||||||
{
|
|
||||||
if ( modelProperties == null || modelProperties.size() == 0 )
|
|
||||||
{
|
|
||||||
throw new IllegalArgumentException( "modelProperties: null or empty" );
|
|
||||||
}
|
|
||||||
return new IdModelContainer( modelProperties );
|
|
||||||
}
|
|
||||||
|
|
||||||
private static class IdModelContainer
|
|
||||||
implements ModelContainer
|
|
||||||
{
|
|
||||||
|
|
||||||
private String id;
|
|
||||||
|
|
||||||
private List<ModelProperty> properties;
|
|
||||||
|
|
||||||
private IdModelContainer( List<ModelProperty> properties )
|
|
||||||
{
|
|
||||||
this.properties = new ArrayList<ModelProperty>( properties );
|
|
||||||
this.properties = Collections.unmodifiableList( this.properties );
|
|
||||||
|
|
||||||
for ( ModelProperty mp : properties )
|
|
||||||
{
|
|
||||||
if ( mp.getUri().endsWith( "/id" ) )
|
|
||||||
{
|
|
||||||
this.id = mp.getResolvedValue();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public ModelContainerAction containerAction( ModelContainer modelContainer )
|
|
||||||
{
|
|
||||||
if ( modelContainer == null )
|
|
||||||
{
|
|
||||||
throw new IllegalArgumentException( "modelContainer: null" );
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( !( modelContainer instanceof IdModelContainer ) )
|
|
||||||
{
|
|
||||||
throw new IllegalArgumentException( "modelContainer: wrong type" );
|
|
||||||
}
|
|
||||||
|
|
||||||
IdModelContainer c = (IdModelContainer) modelContainer;
|
|
||||||
if ( c.id == null || id == null )
|
|
||||||
{
|
|
||||||
return ModelContainerAction.NOP;
|
|
||||||
}
|
|
||||||
return ( c.id.equals( id ) ) ? ModelContainerAction.JOIN : ModelContainerAction.NOP;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ModelContainer createNewInstance( List<ModelProperty> modelProperties )
|
|
||||||
{
|
|
||||||
return new IdModelContainer( modelProperties );
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<ModelProperty> getProperties()
|
|
||||||
{
|
|
||||||
return properties;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String toString()
|
|
||||||
{
|
|
||||||
return "ID = " + id;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,14 +0,0 @@
|
||||||
package org.apache.maven.project.builder;
|
|
||||||
|
|
||||||
|
|
||||||
public enum PomInterpolatorTag
|
|
||||||
{
|
|
||||||
|
|
||||||
USER_PROPERTIES,
|
|
||||||
|
|
||||||
PROJECT_PROPERTIES,
|
|
||||||
|
|
||||||
SYSTEM_PROPERTIES
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
File diff suppressed because it is too large
Load Diff
6
pom.xml
6
pom.xml
|
@ -266,6 +266,7 @@
|
||||||
<module>maven-model</module>
|
<module>maven-model</module>
|
||||||
<module>maven-plugin-api</module>
|
<module>maven-plugin-api</module>
|
||||||
<module>maven-project</module>
|
<module>maven-project</module>
|
||||||
|
<module>maven-project-builder</module>
|
||||||
<module>maven-reporting-api</module>
|
<module>maven-reporting-api</module>
|
||||||
<module>maven-embedder</module>
|
<module>maven-embedder</module>
|
||||||
<module>maven-shared-model</module>
|
<module>maven-shared-model</module>
|
||||||
|
@ -328,6 +329,11 @@
|
||||||
<artifactId>maven-project</artifactId>
|
<artifactId>maven-project</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.maven</groupId>
|
||||||
|
<artifactId>maven-project-builder</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.maven</groupId>
|
<groupId>org.apache.maven</groupId>
|
||||||
<artifactId>maven-plugin-api</artifactId>
|
<artifactId>maven-plugin-api</artifactId>
|
||||||
|
|
Loading…
Reference in New Issue