Author: sisbell Date: Mon Jul 14 18:33:18 2008 New Revision: 676786 URL: http://svn.apache.org/viewvc?rev=676786&view=rev Log: No inheritence of plugin execution rule. Various bug fixes.
Modified: maven/sandbox/branches/SI_MAVEN_2_1/maven-project/src/main/java/org/apache/maven/project/builder/ArtifactModelContainerFactory.java maven/sandbox/branches/SI_MAVEN_2_1/maven-project/src/main/java/org/apache/maven/project/builder/IdModelContainerFactory.java maven/sandbox/branches/SI_MAVEN_2_1/maven-project/src/main/java/org/apache/maven/project/builder/PomClassicDomainModel.java maven/sandbox/branches/SI_MAVEN_2_1/maven-project/src/main/java/org/apache/maven/project/builder/PomClassicTransformer.java maven/sandbox/branches/SI_MAVEN_2_1/maven-project/src/main/java/org/apache/maven/project/builder/ProjectUri.java maven/sandbox/branches/SI_MAVEN_2_1/maven-project/src/main/java/org/apache/maven/project/builder/impl/DefaultProjectBuilder.java maven/sandbox/branches/SI_MAVEN_2_1/maven-project/src/test/java/org/apache/maven/project/DefaultMavenProjectBuilderTest.java Modified: maven/sandbox/branches/SI_MAVEN_2_1/maven-project/src/main/java/org/apache/maven/project/builder/ArtifactModelContainerFactory.java URL: http://svn.apache.org/viewvc/maven/sandbox/branches/SI_MAVEN_2_1/maven-project/src/main/java/org/apache/maven/project/builder/ArtifactModelContainerFactory.java?rev=676786&r1=676785&r2=676786&view=diff ============================================================================== --- maven/sandbox/branches/SI_MAVEN_2_1/maven-project/src/main/java/org/apache/maven/project/builder/ArtifactModelContainerFactory.java (original) +++ maven/sandbox/branches/SI_MAVEN_2_1/maven-project/src/main/java/org/apache/maven/project/builder/ArtifactModelContainerFactory.java Mon Jul 14 18:33:18 2008 @@ -63,7 +63,7 @@ } if (artifactId == null) { - 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); } } @@ -103,7 +103,7 @@ 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) { + for (ModelProperty mp : properties) { sb.append(mp).append("\r\n"); } return sb.toString(); Modified: maven/sandbox/branches/SI_MAVEN_2_1/maven-project/src/main/java/org/apache/maven/project/builder/IdModelContainerFactory.java URL: http://svn.apache.org/viewvc/maven/sandbox/branches/SI_MAVEN_2_1/maven-project/src/main/java/org/apache/maven/project/builder/IdModelContainerFactory.java?rev=676786&r1=676785&r2=676786&view=diff ============================================================================== --- maven/sandbox/branches/SI_MAVEN_2_1/maven-project/src/main/java/org/apache/maven/project/builder/IdModelContainerFactory.java (original) +++ maven/sandbox/branches/SI_MAVEN_2_1/maven-project/src/main/java/org/apache/maven/project/builder/IdModelContainerFactory.java Mon Jul 14 18:33:18 2008 @@ -13,7 +13,8 @@ ProjectUri.PluginRepositories.PluginRepository.xUri, ProjectUri.Repositories.Repository.xUri, ProjectUri.Reporting.Plugins.Plugin.ReportSets.ReportSet.xUri, - ProjectUri.Profiles.Profile.xUri + ProjectUri.Profiles.Profile.xUri, + ProjectUri.Build.Plugins.Plugin.Executions.Execution.xUri )); public Collection<String> getUris() { Modified: maven/sandbox/branches/SI_MAVEN_2_1/maven-project/src/main/java/org/apache/maven/project/builder/PomClassicDomainModel.java URL: http://svn.apache.org/viewvc/maven/sandbox/branches/SI_MAVEN_2_1/maven-project/src/main/java/org/apache/maven/project/builder/PomClassicDomainModel.java?rev=676786&r1=676785&r2=676786&view=diff ============================================================================== --- maven/sandbox/branches/SI_MAVEN_2_1/maven-project/src/main/java/org/apache/maven/project/builder/PomClassicDomainModel.java (original) +++ maven/sandbox/branches/SI_MAVEN_2_1/maven-project/src/main/java/org/apache/maven/project/builder/PomClassicDomainModel.java Mon Jul 14 18:33:18 2008 @@ -15,7 +15,8 @@ /** * Provides a wrapper for the maven model. */ -public final class PomClassicDomainModel implements InputStreamDomainModel { +public final class + PomClassicDomainModel implements InputStreamDomainModel { private byte[] inputBytes; @@ -99,6 +100,10 @@ } public void setEventHistory(String eventHistory) { + if(eventHistory == null) { + throw new IllegalArgumentException("eventHistory: null"); + } + //System.out.println(eventHistory); this.eventHistory = eventHistory; } Modified: maven/sandbox/branches/SI_MAVEN_2_1/maven-project/src/main/java/org/apache/maven/project/builder/PomClassicTransformer.java URL: http://svn.apache.org/viewvc/maven/sandbox/branches/SI_MAVEN_2_1/maven-project/src/main/java/org/apache/maven/project/builder/PomClassicTransformer.java?rev=676786&r1=676785&r2=676786&view=diff ============================================================================== --- maven/sandbox/branches/SI_MAVEN_2_1/maven-project/src/main/java/org/apache/maven/project/builder/PomClassicTransformer.java (original) +++ maven/sandbox/branches/SI_MAVEN_2_1/maven-project/src/main/java/org/apache/maven/project/builder/PomClassicTransformer.java Mon Jul 14 18:33:18 2008 @@ -1,10 +1,8 @@ package org.apache.maven.project.builder; import org.apache.maven.model.io.xpp3.MavenXpp3Reader; -import org.apache.maven.shared.model.DomainModel; -import org.apache.maven.shared.model.ModelMarshaller; -import org.apache.maven.shared.model.ModelProperty; -import org.apache.maven.shared.model.ModelTransformer; +import org.apache.maven.shared.model.*; +import org.apache.maven.shared.model.impl.DefaultModelDataSource; import org.codehaus.plexus.util.xml.pull.XmlPullParserException; import java.io.IOException; @@ -24,50 +22,63 @@ public PomClassicTransformer() { this.uris = new HashSet<String>(Arrays.asList( - "http://apache.org/maven/project/build/resources#collection", - "http://apache.org/maven/project/build/plugins/plugin/dependencies/dependency/exclusions#collection", - "http://apache.org/maven/project/profiles/profile/build/pluginManagement/plugins#collection", - "http://apache.org/maven/project/profiles/profile/build/plugins/plugin/dependencies/dependency/exclusions#collection", - "http://apache.org/maven/project/profiles/profile/reporting/plugins#collection", + ProjectUri.Build.Extensions.xUri, + ProjectUri.Build.PluginManagement.Plugins.xUri, + ProjectUri.Build.Plugins.xUri, + ProjectUri.Build.Plugins.Plugin.Dependencies.xUri, + ProjectUri.Build.Plugins.Plugin.Executions.xUri, + ProjectUri.Build.Resources.xUri, + ProjectUri.Build.TestResources.xUri, + + ProjectUri.CiManagement.Notifiers.xUri, + + ProjectUri.Contributors.xUri, + + ProjectUri.Dependencies.xUri, + ProjectUri.Dependencies.Dependency.Exclusions.xUri, + + ProjectUri.DependencyManagement.Dependencies.xUri, + + ProjectUri.Developers.xUri, + ProjectUri.Licenses.xUri, + ProjectUri.MailingLists.xUri, + ProjectUri.Modules.xUri, + ProjectUri.PluginRepositories.xUri, + + ProjectUri.Profiles.xUri, + ProjectUri.Profiles.Profile.Build.TestResources.xUri, + ProjectUri.Profiles.Profile.Dependencies.xUri, + ProjectUri.Profiles.Profile.DependencyManagement.Dependencies.xUri, + ProjectUri.Profiles.Profile.Repositories.xUri, + + ProjectUri.Reporting.Plugins.xUri, + + ProjectUri.Repositories.xUri, + "http://apache.org/maven/project/dependencyManagement/dependencies/dependency/exclusions#collection", - "http://apache.org/maven/project/profiles/profile/build/testResources#collection", "http://apache.org/maven/project/reporting/plugins/plugin/reportSets#collection", - "http://apache.org/maven/project/pluginRepositories#collection", + "http://apache.org/maven/project/profiles/profile/build/pluginManagement/plugins/plugin/dependencies#collection", "http://apache.org/maven/project/profiles/profile/build/resources#collection", "http://apache.org/maven/project/profiles/profile/build/pluginManagement/plugins/plugin/dependencies/dependency/exclusions#collection", - "http://apache.org/maven/project/licenses#collection", - "http://apache.org/maven/project/build/plugins/plugin/dependencies#collection", - "http://apache.org/maven/project/profiles/profile/dependencyManagement/dependencies/dependency/exclusions#collection", - "http://apache.org/maven/project/dependencies/dependency/exclusions#collection", "http://apache.org/maven/project/profiles/profile/build/plugins/plugin/dependencies#collection", - "http://apache.org/maven/project/build/testResources#collection", "http://apache.org/maven/project/profiles/profile/pluginRepositories#collection", - "http://apache.org/maven/project/build/pluginManagement/plugins#collection", - "http://apache.org/maven/project/profiles#collection", - "http://apache.org/maven/project/reporting/plugins#collection", - "http://apache.org/maven/project/build/pluginManagement/plugins/plugin/dependencies/dependency/exclusions#collection", - "http://apache.org/maven/project/build/pluginManagement/plugins/plugin/executions#collection", "http://apache.org/maven/project/profiles/profile/dependencies/dependency/exclusions#collection", - "http://apache.org/maven/project/dependencies#collection", - "http://apache.org/maven/project/contributors#collection", - "http://apache.org/maven/project/developers#collection", - "http://apache.org/maven/project/build/plugins#collection", "http://apache.org/maven/project/profiles/profile/build/pluginManagement/plugins/plugin/executions#collection", - "http://apache.org/maven/project/profiles/profile/dependencies#collection", - "http://apache.org/maven/project/mailingLists#collection", - "http://apache.org/maven/project/profiles/profile/dependencyManagement/dependencies#collection", - "http://apache.org/maven/project/profiles/profile/repositories#collection", - "http://apache.org/maven/project/build/extensions#collection", - "http://apache.org/maven/project/build/plugins/plugin/executions#collection", - "http://apache.org/maven/project/repositories#collection", - "http://apache.org/maven/project/ciManagement/notifiers#collection", - "http://apache.org/maven/project/dependencyManagement/dependencies#collection", - "http://apache.org/maven/project/build/pluginManagement/plugins/plugin/dependencies#collection", + "http://apache.org/maven/project/profiles/profile/build/pluginManagement/plugins#collection", + "http://apache.org/maven/project/profiles/profile/build/plugins/plugin/dependencies/dependency/exclusions#collection", + "http://apache.org/maven/project/profiles/profile/reporting/plugins#collection", + "http://apache.org/maven/project/profiles/profile/dependencyManagement/dependencies/dependency/exclusions#collection", "http://apache.org/maven/project/profiles/profile/reporting/plugins/plugin/reportSets#collection", "http://apache.org/maven/project/profiles/profile/build/plugins#collection", "http://apache.org/maven/project/profiles/profile/build/plugins/plugin/executions#collection", - "http://apache.org/maven/project/modules#collection" + + "http://apache.org/maven/project/build/plugins/plugin/dependencies/dependency/exclusions#collection", + "http://apache.org/maven/project/build/plugins/plugin/dependencies#collection", + "http://apache.org/maven/project/build/pluginManagement/plugins/plugin/dependencies/dependency/exclusions#collection", + "http://apache.org/maven/project/build/pluginManagement/plugins/plugin/executions#collection", + "http://apache.org/maven/project/build/pluginManagement/plugins/plugin/dependencies#collection" + )); } @@ -77,8 +88,8 @@ } List<ModelProperty> props = new ArrayList<ModelProperty>(); - for(ModelProperty mp : properties) { //TODO: Resolved values - if(mp.getValue() != null && mp.getValue().contains("=")) { + for (ModelProperty mp : properties) { //TODO: Resolved values + if (mp.getValue() != null && mp.getValue().contains("=")) { props.add(new ModelProperty(mp.getUri(), "<![CDATA[" + mp.getValue() + "]]>")); } else { props.add(mp); @@ -120,7 +131,7 @@ //Modules Not Inherited Rule if (domainModels.indexOf(domainModel) != 0) { ModelProperty modulesProperty = getPropertyFor(ProjectUri.Modules.xUri, tmp); - if(modulesProperty != null) { + if (modulesProperty != null) { tmp.remove(modulesProperty); tmp.removeAll(getPropertiesFor(ProjectUri.Modules.module, tmp)); } @@ -132,9 +143,29 @@ tmp.add(new ModelProperty(ProjectUri.groupId, parentGroupId.getValue())); } - //Not inherited plugin rule - - + //Not inherited plugin execution rule + if (domainModels.indexOf(domainModel) > 0) { + List<ModelProperty> removeProperties = new ArrayList<ModelProperty>(); + ModelDataSource source = new DefaultModelDataSource(); + source.init(tmp, Arrays.asList(new ArtifactModelContainerFactory(), new IdModelContainerFactory())); + List<ModelContainer> containers = source.queryFor(ProjectUri.Build.Plugins.Plugin.Executions.Execution.xUri); + for (ModelContainer container : containers) { + for (ModelProperty mp : container.getProperties()) { + if (mp.getUri().equals(ProjectUri.Build.Plugins.Plugin.Executions.Execution.inherited) + && mp.getValue() != null && mp.getValue().equals("false")) { + removeProperties.addAll(container.getProperties()); + for (int j = tmp.indexOf(mp); j >=0; j--) { + if (tmp.get(j).getUri().equals(ProjectUri.Build.Plugins.Plugin.Executions.xUri)) { + removeProperties.add(tmp.get(j)); + break; + } + } + break; + } + } + } + tmp.removeAll(removeProperties); + } //SCM Rule ModelProperty scmUrlProperty = getPropertyFor(ProjectUri.Scm.url, tmp); @@ -152,8 +183,8 @@ modelProperties.addAll(tmp); //Remove Parent Info - for(ModelProperty mp : tmp) { - if(mp.getUri().startsWith(ProjectUri.Parent.xUri)) { + for (ModelProperty mp : tmp) { + if (mp.getUri().startsWith(ProjectUri.Parent.xUri)) { modelProperties.remove(mp); } } Modified: maven/sandbox/branches/SI_MAVEN_2_1/maven-project/src/main/java/org/apache/maven/project/builder/ProjectUri.java URL: http://svn.apache.org/viewvc/maven/sandbox/branches/SI_MAVEN_2_1/maven-project/src/main/java/org/apache/maven/project/builder/ProjectUri.java?rev=676786&r1=676785&r2=676786&view=diff ============================================================================== --- maven/sandbox/branches/SI_MAVEN_2_1/maven-project/src/main/java/org/apache/maven/project/builder/ProjectUri.java (original) +++ maven/sandbox/branches/SI_MAVEN_2_1/maven-project/src/main/java/org/apache/maven/project/builder/ProjectUri.java Mon Jul 14 18:33:18 2008 @@ -253,42 +253,42 @@ public static String extensions = "http://apache.org/maven/project/build/plugins#collection/plugin/extensions"; public static class Executions { - public static String xUri = "http://apache.org/maven/project/build/plugins#collection/plugin/executions"; + public static String xUri = "http://apache.org/maven/project/build/plugins#collection/plugin/executions#collection"; public static class Execution { - public static String xUri = "http://apache.org/maven/project/build/plugins#collection/plugin/executions/execution"; - public static String id = "http://apache.org/maven/project/build/plugins#collection/plugin/executions/execution/id"; - public static String phase = "http://apache.org/maven/project/build/plugins#collection/plugin/executions/execution/phase"; - public static String goals = "http://apache.org/maven/project/build/plugins#collection/plugin/executions/execution/goals"; - public static String inherited = "http://apache.org/maven/project/build/plugins#collection/plugin/executions/execution/inherited"; - public static String configuration = "http://apache.org/maven/project/build/plugins#collection/plugin/executions/execution/configuration"; + public static String xUri = "http://apache.org/maven/project/build/plugins#collection/plugin/executions#collection/execution"; + public static String id = "http://apache.org/maven/project/build/plugins#collection/plugin/executions#collection/execution/id"; + public static String phase = "http://apache.org/maven/project/build/plugins#collection/plugin/executions#collection/execution/phase"; + public static String goals = "http://apache.org/maven/project/build/plugins#collection/plugin/executions#collection/execution/goals"; + public static String inherited = "http://apache.org/maven/project/build/plugins#collection/plugin/executions#collection/execution/inherited"; + public static String configuration = "http://apache.org/maven/project/build/plugins#collection/plugin/executions#collection/execution/configuration"; } } public static class Dependencies { - public static String xUri = "http://apache.org/maven/project/build/plugins#collection/plugin/dependencies"; + public static String xUri = "http://apache.org/maven/project/build/plugins#collection/plugin/dependencies#collection"; public static class Dependency { - public static String xUri = "http://apache.org/maven/project/build/plugins#collection/plugin/dependencies/dependency"; - public static String groupId = "http://apache.org/maven/project/build/plugins#collection/plugin/dependencies/dependency/groupId"; - public static String artifactId = "http://apache.org/maven/project/build/plugins#collection/plugin/dependencies/dependency/artifactId"; - public static String version = "http://apache.org/maven/project/build/plugins#collection/plugin/dependencies/dependency/version"; - public static String type = "http://apache.org/maven/project/build/plugins#collection/plugin/dependencies/dependency/type"; - public static String classifier = "http://apache.org/maven/project/build/plugins#collection/plugin/dependencies/dependency/classifier"; - public static String scope = "http://apache.org/maven/project/build/plugins#collection/plugin/dependencies/dependency/scope"; - public static String systemPath = "http://apache.org/maven/project/build/plugins#collection/plugin/dependencies/dependency/systemPath"; + public static String xUri = "http://apache.org/maven/project/build/plugins#collection/plugin/dependencies#collection/dependency"; + public static String groupId = "http://apache.org/maven/project/build/plugins#collection/plugin/dependencies#collection/dependency/groupId"; + public static String artifactId = "http://apache.org/maven/project/build/plugins#collection/plugin/dependencies#collection/dependency/artifactId"; + public static String version = "http://apache.org/maven/project/build/plugins#collection/plugin/dependencies#collection/dependency/version"; + public static String type = "http://apache.org/maven/project/build/plugins#collection/plugin/dependencies#collection/dependency/type"; + public static String classifier = "http://apache.org/maven/project/build/plugins#collection/plugin/dependencies#collection/dependency/classifier"; + public static String scope = "http://apache.org/maven/project/build/plugins#collection/plugin/dependencies#collection/dependency/scope"; + public static String systemPath = "http://apache.org/maven/project/build/plugins#collection/plugin/dependencies#collection/dependency/systemPath"; public static class Exclusions { - public static String xUri = "http://apache.org/maven/project/build/plugins#collection/plugin/dependencies/dependency/exclusions"; + public static String xUri = "http://apache.org/maven/project/build/plugins#collection/plugin/dependencies#collection/dependency/exclusions"; public static class Exclusion { - public static String xUri = "http://apache.org/maven/project/build/plugins#collection/plugin/dependencies/dependency/exclusions/exclusion"; - public static String artifactId = "http://apache.org/maven/project/build/plugins#collection/plugin/dependencies/dependency/exclusions/exclusion/artifactId"; - public static String groupId = "http://apache.org/maven/project/build/plugins#collection/plugin/dependencies/dependency/exclusions/exclusion/groupId"; + public static String xUri = "http://apache.org/maven/project/build/plugins#collection/plugin/dependencies#collection/dependency/exclusions/exclusion"; + public static String artifactId = "http://apache.org/maven/project/build/plugins#collection/plugin/dependencies#collection/dependency/exclusions/exclusion/artifactId"; + public static String groupId = "http://apache.org/maven/project/build/plugins#collection/plugin/dependencies#collection/dependency/exclusions/exclusion/groupId"; } } - public static String optional = "http://apache.org/maven/project/build/plugins#collection/plugin/dependencies/dependency/optional"; + public static String optional = "http://apache.org/maven/project/build/plugins#collection/plugin/dependencies#collection/dependency/optional"; } } Modified: maven/sandbox/branches/SI_MAVEN_2_1/maven-project/src/main/java/org/apache/maven/project/builder/impl/DefaultProjectBuilder.java URL: http://svn.apache.org/viewvc/maven/sandbox/branches/SI_MAVEN_2_1/maven-project/src/main/java/org/apache/maven/project/builder/impl/DefaultProjectBuilder.java?rev=676786&r1=676785&r2=676786&view=diff ============================================================================== --- maven/sandbox/branches/SI_MAVEN_2_1/maven-project/src/main/java/org/apache/maven/project/builder/impl/DefaultProjectBuilder.java (original) +++ maven/sandbox/branches/SI_MAVEN_2_1/maven-project/src/main/java/org/apache/maven/project/builder/impl/DefaultProjectBuilder.java Mon Jul 14 18:33:18 2008 @@ -84,7 +84,9 @@ transformer, properties)).getModel(); //validateModel(model); - + for(DomainModel dm : domainModels) { + // System.out.println(dm.getEventHistory()); + } MavenProject mavenProject = new MavenProject(model); mavenProject.setArtifact(artifactFactory.createProjectArtifact(model.getGroupId(), model.getArtifactId(), model.getVersion())); Modified: maven/sandbox/branches/SI_MAVEN_2_1/maven-project/src/test/java/org/apache/maven/project/DefaultMavenProjectBuilderTest.java URL: http://svn.apache.org/viewvc/maven/sandbox/branches/SI_MAVEN_2_1/maven-project/src/test/java/org/apache/maven/project/DefaultMavenProjectBuilderTest.java?rev=676786&r1=676785&r2=676786&view=diff ============================================================================== --- maven/sandbox/branches/SI_MAVEN_2_1/maven-project/src/test/java/org/apache/maven/project/DefaultMavenProjectBuilderTest.java (original) +++ maven/sandbox/branches/SI_MAVEN_2_1/maven-project/src/test/java/org/apache/maven/project/DefaultMavenProjectBuilderTest.java Mon Jul 14 18:33:18 2008 @@ -25,6 +25,7 @@ import org.apache.maven.model.Build; import org.apache.maven.model.Plugin; import org.apache.maven.model.Resource; +import org.apache.maven.project.builder.PomClassicDomainModel; import org.codehaus.plexus.util.FileUtils; import java.io.File;