From cc5f2f954b001ae9b6902a1b56a1b880322cb58f Mon Sep 17 00:00:00 2001 From: Jason van Zyl Date: Sat, 2 Jun 2007 15:35:57 +0000 Subject: [PATCH] Reverting the package changes Issue id: MNG-2943 git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@543753 13f79535-47bb-0310-9956-ffa450edef68 --- make-embedder.sh | 2 +- maven-core/pom.xml | 14 -- .../monitor/event/DefaultEventMonitor.java | 50 ----- .../core/monitor/logging/DefaultLog.java | 132 ------------- .../execution/MavenExecutionRequest.java | 1 + .../monitor/event/DefaultEventMonitor.java | 17 +- .../maven/monitor/logging/DefaultLog.java | 100 +++++++++- .../maven/plugin/DefaultPluginManager.java | 2 +- maven-embedder/pom.xml | 2 +- .../apache/maven/embedder/MavenEmbedder.java | 2 +- ...avenExecutionRequestDefaultsPopulator.java | 4 +- .../maven/embedder/MavenEmbedderTest.java | 2 +- maven-project/pom.xml | 20 +- .../org/apache/maven/DefaultMavenTools.java | 185 ++++++++++++++---- .../java/org/apache/maven/MavenTools.java | 23 ++- .../project/DefaultMavenProjectBuilder.java | 1 + .../maven/project/DefaultMavenTools.java | 174 ---------------- .../org/apache/maven/project/MavenTools.java | 49 ----- .../model/DefaultModelLineageBuilder.java | 2 +- .../build/profile/DefaultProfileAdvisor.java | 2 +- .../resources/META-INF/plexus/components.xml | 17 +- .../maven/project/ProjectClasspathTest.xml | 4 +- .../canonical/CanonicalProjectBuilderTest.xml | 4 +- maven-settings/pom.xml | 10 - .../maven/SettingsConfigurationException.java | 24 ++- .../SettingsConfigurationException.java | 65 ------ pom.xml | 22 +-- 27 files changed, 324 insertions(+), 606 deletions(-) delete mode 100644 maven-core/src/main/java/org/apache/maven/core/monitor/event/DefaultEventMonitor.java delete mode 100644 maven-core/src/main/java/org/apache/maven/core/monitor/logging/DefaultLog.java delete mode 100644 maven-project/src/main/java/org/apache/maven/project/DefaultMavenTools.java delete mode 100644 maven-project/src/main/java/org/apache/maven/project/MavenTools.java delete mode 100644 maven-settings/src/main/java/org/apache/maven/settings/SettingsConfigurationException.java diff --git a/make-embedder.sh b/make-embedder.sh index 2c944e94c1..9cada7b63b 100755 --- a/make-embedder.sh +++ b/make-embedder.sh @@ -11,5 +11,5 @@ mv target/maven-2.1-SNAPSHOT-sources.jar $dir/maven-embedder-$ds-depsrc.zip cd maven-embedder sed "s@.*@$ds@" pom.xml > tmp; mv tmp pom.xml mvn clean install - mv target/maven-embedder-*-ueber.jar $dir/maven-embedder-$ds-dep.jar + mv target/maven-embedder-*-uber.jar $dir/maven-embedder-$ds-dep.jar ) diff --git a/maven-core/pom.xml b/maven-core/pom.xml index c3df980a44..9f5e3574b8 100644 --- a/maven-core/pom.xml +++ b/maven-core/pom.xml @@ -150,18 +150,4 @@ under the License. test - - - - org.apache.felix - maven-bundle-plugin - - - - !org.apache.maven.monitor.*,* - - - - - diff --git a/maven-core/src/main/java/org/apache/maven/core/monitor/event/DefaultEventMonitor.java b/maven-core/src/main/java/org/apache/maven/core/monitor/event/DefaultEventMonitor.java deleted file mode 100644 index 11acf98e98..0000000000 --- a/maven-core/src/main/java/org/apache/maven/core/monitor/event/DefaultEventMonitor.java +++ /dev/null @@ -1,50 +0,0 @@ -package org.apache.maven.core.monitor.event; - -/* - * 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.monitor.event.AbstractSelectiveEventMonitor; -import org.apache.maven.monitor.event.MavenEvents; -import org.codehaus.plexus.logging.Logger; - -/** - * @author jdcasey - * @since 2.1 - */ -public class DefaultEventMonitor - extends AbstractSelectiveEventMonitor -{ - - private static final String[] START_EVENTS = {MavenEvents.MOJO_EXECUTION}; - - private final Logger logger; - - public DefaultEventMonitor( Logger logger ) - { - super( START_EVENTS, MavenEvents.NO_EVENTS, MavenEvents.NO_EVENTS ); - - this.logger = logger; - } - - protected void doStartEvent( String event, String target, long time ) - { - logger.info( "[" + target + "]" ); - } - -} \ No newline at end of file diff --git a/maven-core/src/main/java/org/apache/maven/core/monitor/logging/DefaultLog.java b/maven-core/src/main/java/org/apache/maven/core/monitor/logging/DefaultLog.java deleted file mode 100644 index a10663ebab..0000000000 --- a/maven-core/src/main/java/org/apache/maven/core/monitor/logging/DefaultLog.java +++ /dev/null @@ -1,132 +0,0 @@ -package org.apache.maven.core.monitor.logging; - -/* - * 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.plugin.logging.Log; -import org.codehaus.plexus.logging.Logger; - -/** - * @author jdcasey - * @since 2.1 - */ -public class DefaultLog - implements Log -{ - - private final Logger logger; - - public DefaultLog( Logger logger ) - { - this.logger = logger; - } - - public void debug( CharSequence content ) - { - logger.debug( toString( content ) ); - } - - private String toString( CharSequence content ) - { - if ( content == null ) - { - return ""; - } - else - { - return content.toString(); - } - } - - public void debug( CharSequence content, Throwable error ) - { - logger.debug( toString( content ), error ); - } - - public void debug( Throwable error ) - { - logger.debug( "", error ); - } - - public void info( CharSequence content ) - { - logger.info( toString( content ) ); - } - - public void info( CharSequence content, Throwable error ) - { - logger.info( toString( content ), error ); - } - - public void info( Throwable error ) - { - logger.info( "", error ); - } - - public void warn( CharSequence content ) - { - logger.warn( toString( content ) ); - } - - public void warn( CharSequence content, Throwable error ) - { - logger.warn( toString( content ), error ); - } - - public void warn( Throwable error ) - { - logger.warn( "", error ); - } - - public void error( CharSequence content ) - { - logger.error( toString( content ) ); - } - - public void error( CharSequence content, Throwable error ) - { - logger.error( toString( content ), error ); - } - - public void error( Throwable error ) - { - logger.error( "", error ); - } - - public boolean isDebugEnabled() - { - return logger.isDebugEnabled(); - } - - public boolean isInfoEnabled() - { - return logger.isInfoEnabled(); - } - - public boolean isWarnEnabled() - { - return logger.isWarnEnabled(); - } - - public boolean isErrorEnabled() - { - return logger.isErrorEnabled(); - } - -} \ No newline at end of file diff --git a/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java b/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java index 9398c4c248..59c795c8c6 100644 --- a/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java +++ b/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java @@ -89,6 +89,7 @@ public interface MavenExecutionRequest // Properties MavenExecutionRequest setProperties( Properties properties ); + MavenExecutionRequest setProperty( String key, String value ); Properties getProperties(); // Reactor diff --git a/maven-core/src/main/java/org/apache/maven/monitor/event/DefaultEventMonitor.java b/maven-core/src/main/java/org/apache/maven/monitor/event/DefaultEventMonitor.java index 0749b14286..4dc05f03e0 100644 --- a/maven-core/src/main/java/org/apache/maven/monitor/event/DefaultEventMonitor.java +++ b/maven-core/src/main/java/org/apache/maven/monitor/event/DefaultEventMonitor.java @@ -23,14 +23,25 @@ import org.codehaus.plexus.logging.Logger; /** * @author jdcasey - * @deprecated use {@link org.apache.maven.core.monitor.event.DefaultEventMonitor} */ public class DefaultEventMonitor - extends org.apache.maven.core.monitor.event.DefaultEventMonitor + extends AbstractSelectiveEventMonitor { + private static final String[] START_EVENTS = {MavenEvents.MOJO_EXECUTION}; + + private final Logger logger; + public DefaultEventMonitor( Logger logger ) { - super( logger ); + super( START_EVENTS, MavenEvents.NO_EVENTS, MavenEvents.NO_EVENTS ); + + this.logger = logger; } + + protected void doStartEvent( String event, String target, long time ) + { + logger.info( "[" + target + "]" ); + } + } \ No newline at end of file diff --git a/maven-core/src/main/java/org/apache/maven/monitor/logging/DefaultLog.java b/maven-core/src/main/java/org/apache/maven/monitor/logging/DefaultLog.java index c1293d0beb..4fee2e256d 100644 --- a/maven-core/src/main/java/org/apache/maven/monitor/logging/DefaultLog.java +++ b/maven-core/src/main/java/org/apache/maven/monitor/logging/DefaultLog.java @@ -19,19 +19,113 @@ package org.apache.maven.monitor.logging; * under the License. */ +import org.apache.maven.plugin.logging.Log; import org.codehaus.plexus.logging.Logger; /** * @author jdcasey - * @deprecated use {@link org.apache.maven.core.monitor.logging.DefaultLog} */ public class DefaultLog - extends org.apache.maven.core.monitor.logging.DefaultLog + implements Log { + private final Logger logger; + public DefaultLog( Logger logger ) { - super( logger ); + this.logger = logger; + } + + public void debug( CharSequence content ) + { + logger.debug( toString( content ) ); + } + + private String toString( CharSequence content ) + { + if ( content == null ) + { + return ""; + } + else + { + return content.toString(); + } + } + + public void debug( CharSequence content, Throwable error ) + { + logger.debug( toString( content ), error ); + } + + public void debug( Throwable error ) + { + logger.debug( "", error ); + } + + public void info( CharSequence content ) + { + logger.info( toString( content ) ); + } + + public void info( CharSequence content, Throwable error ) + { + logger.info( toString( content ), error ); + } + + public void info( Throwable error ) + { + logger.info( "", error ); + } + + public void warn( CharSequence content ) + { + logger.warn( toString( content ) ); + } + + public void warn( CharSequence content, Throwable error ) + { + logger.warn( toString( content ), error ); + } + + public void warn( Throwable error ) + { + logger.warn( "", error ); + } + + public void error( CharSequence content ) + { + logger.error( toString( content ) ); + } + + public void error( CharSequence content, Throwable error ) + { + logger.error( toString( content ), error ); + } + + public void error( Throwable error ) + { + logger.error( "", error ); + } + + public boolean isDebugEnabled() + { + return logger.isDebugEnabled(); + } + + public boolean isInfoEnabled() + { + return logger.isInfoEnabled(); + } + + public boolean isWarnEnabled() + { + return logger.isWarnEnabled(); + } + + public boolean isErrorEnabled() + { + return logger.isErrorEnabled(); } } \ No newline at end of file diff --git a/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java b/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java index ae02b067a3..f18d04e5bb 100644 --- a/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java +++ b/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java @@ -37,7 +37,6 @@ import org.apache.maven.artifact.versioning.DefaultArtifactVersion; import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException; import org.apache.maven.artifact.versioning.VersionRange; import org.apache.maven.context.BuildContextManager; -import org.apache.maven.core.monitor.logging.DefaultLog; import org.apache.maven.execution.MavenSession; import org.apache.maven.execution.RuntimeInformation; import org.apache.maven.lifecycle.LifecycleExecutionContext; @@ -46,6 +45,7 @@ import org.apache.maven.model.Plugin; import org.apache.maven.model.ReportPlugin; import org.apache.maven.monitor.event.EventDispatcher; import org.apache.maven.monitor.event.MavenEvents; +import org.apache.maven.monitor.logging.DefaultLog; import org.apache.maven.plugin.descriptor.MojoDescriptor; import org.apache.maven.plugin.descriptor.Parameter; import org.apache.maven.plugin.descriptor.PluginDescriptor; diff --git a/maven-embedder/pom.xml b/maven-embedder/pom.xml index 563cd4a539..523c8fb3d9 100644 --- a/maven-embedder/pom.xml +++ b/maven-embedder/pom.xml @@ -30,7 +30,7 @@ under the License. maven-embedder Maven Embedder - 2.1.0.v20070320-1003 + 2.1.0.v20070601-0109 diff --git a/maven-embedder/src/main/java/org/apache/maven/embedder/MavenEmbedder.java b/maven-embedder/src/main/java/org/apache/maven/embedder/MavenEmbedder.java index b0209b0742..b132b4650f 100644 --- a/maven-embedder/src/main/java/org/apache/maven/embedder/MavenEmbedder.java +++ b/maven-embedder/src/main/java/org/apache/maven/embedder/MavenEmbedder.java @@ -20,6 +20,7 @@ package org.apache.maven.embedder; */ import org.apache.maven.Maven; +import org.apache.maven.SettingsConfigurationException; import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.factory.ArtifactFactory; import org.apache.maven.artifact.handler.ArtifactHandler; @@ -59,7 +60,6 @@ import org.apache.maven.project.MavenProjectBuilder; import org.apache.maven.project.ProjectBuildingException; import org.apache.maven.settings.MavenSettingsBuilder; import org.apache.maven.settings.Settings; -import org.apache.maven.settings.SettingsConfigurationException; import org.apache.maven.settings.io.jdom.SettingsJDOMWriter; import org.apache.maven.settings.io.xpp3.SettingsXpp3Reader; import org.apache.maven.settings.validation.DefaultSettingsValidator; diff --git a/maven-embedder/src/main/java/org/apache/maven/embedder/execution/DefaultMavenExecutionRequestDefaultsPopulator.java b/maven-embedder/src/main/java/org/apache/maven/embedder/execution/DefaultMavenExecutionRequestDefaultsPopulator.java index 03f4172922..e75c8c4f67 100644 --- a/maven-embedder/src/main/java/org/apache/maven/embedder/execution/DefaultMavenExecutionRequestDefaultsPopulator.java +++ b/maven-embedder/src/main/java/org/apache/maven/embedder/execution/DefaultMavenExecutionRequestDefaultsPopulator.java @@ -19,21 +19,21 @@ package org.apache.maven.embedder.execution; * under the License. */ +import org.apache.maven.SettingsConfigurationException; import org.apache.maven.wagon.repository.RepositoryPermissions; import org.apache.maven.artifact.manager.WagonManager; import org.apache.maven.artifact.repository.ArtifactRepositoryFactory; import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy; import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout; -import org.apache.maven.core.monitor.event.DefaultEventMonitor; import org.apache.maven.embedder.MavenEmbedder; import org.apache.maven.embedder.MavenEmbedderException; import org.apache.maven.execution.MavenExecutionRequest; +import org.apache.maven.monitor.event.DefaultEventMonitor; import org.apache.maven.plugin.Mojo; import org.apache.maven.settings.Mirror; import org.apache.maven.settings.Proxy; import org.apache.maven.settings.Server; import org.apache.maven.settings.Settings; -import org.apache.maven.settings.SettingsConfigurationException; import org.apache.maven.usability.SystemWarnings; import org.codehaus.plexus.PlexusConstants; import org.codehaus.plexus.PlexusContainer; diff --git a/maven-embedder/src/test/java/org/apache/maven/embedder/MavenEmbedderTest.java b/maven-embedder/src/test/java/org/apache/maven/embedder/MavenEmbedderTest.java index 709ba66a38..0bad15699d 100644 --- a/maven-embedder/src/test/java/org/apache/maven/embedder/MavenEmbedderTest.java +++ b/maven-embedder/src/test/java/org/apache/maven/embedder/MavenEmbedderTest.java @@ -20,6 +20,7 @@ package org.apache.maven.embedder; */ import junit.framework.TestCase; +import org.apache.maven.SettingsConfigurationException; import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.handler.ArtifactHandler; import org.apache.maven.execution.DefaultMavenExecutionRequest; @@ -33,7 +34,6 @@ import org.apache.maven.project.MavenProject; import org.apache.maven.settings.Profile; import org.apache.maven.settings.Repository; import org.apache.maven.settings.Settings; -import org.apache.maven.settings.SettingsConfigurationException; import org.apache.maven.settings.io.xpp3.SettingsXpp3Reader; import org.apache.maven.settings.io.xpp3.SettingsXpp3Writer; import org.codehaus.plexus.util.FileUtils; diff --git a/maven-project/pom.xml b/maven-project/pom.xml index 3af97c36a4..6b2c2c3217 100644 --- a/maven-project/pom.xml +++ b/maven-project/pom.xml @@ -19,9 +19,8 @@ specific language governing permissions and limitations under the License. --> - + maven org.apache.maven @@ -72,19 +71,4 @@ under the License. test - - - - - org.apache.felix - maven-bundle-plugin - - - - !org.apache.maven,* - - - - - diff --git a/maven-project/src/main/java/org/apache/maven/DefaultMavenTools.java b/maven-project/src/main/java/org/apache/maven/DefaultMavenTools.java index 31a8b86e40..fc50f753bd 100644 --- a/maven-project/src/main/java/org/apache/maven/DefaultMavenTools.java +++ b/maven-project/src/main/java/org/apache/maven/DefaultMavenTools.java @@ -1,70 +1,171 @@ package org.apache.maven; /* - * 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. + * 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 java.util.List; - import org.apache.maven.artifact.InvalidRepositoryException; import org.apache.maven.artifact.repository.ArtifactRepository; +import org.apache.maven.artifact.repository.ArtifactRepositoryFactory; +import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy; +import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout; import org.apache.maven.model.DeploymentRepository; import org.apache.maven.model.Repository; +import org.apache.maven.model.RepositoryBase; +import org.apache.maven.model.RepositoryPolicy; +import org.codehaus.plexus.PlexusConstants; +import org.codehaus.plexus.PlexusContainer; +import org.codehaus.plexus.component.repository.exception.ComponentLookupException; +import org.codehaus.plexus.context.Context; +import org.codehaus.plexus.context.ContextException; +import org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable; -/** - * @deprecated use {@link org.apache.maven.project.DefaultMavenTools} - * @author Jason van Zyl - */ +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +/** @author Jason van Zyl */ public class DefaultMavenTools - extends org.apache.maven.project.DefaultMavenTools - implements MavenTools + implements MavenTools, Contextualizable { - private org.apache.maven.project.MavenTools mavenTools; + private ArtifactRepositoryLayout repositoryLayout; + + private ArtifactRepositoryFactory artifactRepositoryFactory; + + private PlexusContainer container; + + // ---------------------------------------------------------------------------- + // Code snagged from ProjectUtils: this will have to be moved somewhere else + // but just trying to collect it all in one place right now. + // ---------------------------------------------------------------------------- - /** - * @see org.apache.maven.project.MavenTools#buildArtifactRepositories(java.util.List) - */ public List buildArtifactRepositories( List repositories ) throws InvalidRepositoryException { - return getMavenTools().buildArtifactRepositories( repositories ); + List repos = new ArrayList(); + + for ( Iterator i = repositories.iterator(); i.hasNext(); ) + { + Repository mavenRepo = (Repository) i.next(); + + ArtifactRepository artifactRepo = buildArtifactRepository( mavenRepo ); + + if ( !repos.contains( artifactRepo ) ) + { + repos.add( artifactRepo ); + } + } + return repos; } - /** - * @see org.apache.maven.project.MavenTools#buildArtifactRepository(org.apache.maven.model.Repository) - */ - public ArtifactRepository buildArtifactRepository( Repository repo ) - throws InvalidRepositoryException - { - return getMavenTools().buildArtifactRepository( repo ); - } - - /** - * @see org.apache.maven.project.MavenTools#buildDeploymentArtifactRepository(org.apache.maven.model.DeploymentRepository) - */ public ArtifactRepository buildDeploymentArtifactRepository( DeploymentRepository repo ) throws InvalidRepositoryException { - return getMavenTools().buildDeploymentArtifactRepository( repo ); + if ( repo != null ) + { + String id = repo.getId(); + String url = repo.getUrl(); + + // TODO: make this a map inside the factory instead, so no lookup needed + ArtifactRepositoryLayout layout = getRepositoryLayout( repo ); + + return artifactRepositoryFactory.createDeploymentArtifactRepository( id, url, layout, + repo.isUniqueVersion() ); + } + else + { + return null; + } } - private org.apache.maven.project.MavenTools getMavenTools() + public ArtifactRepository buildArtifactRepository( Repository repo ) + throws InvalidRepositoryException { - if ( mavenTools == null ) + if ( repo != null ) { - mavenTools = new org.apache.maven.project.DefaultMavenTools(); + String id = repo.getId(); + String url = repo.getUrl(); + + // TODO: make this a map inside the factory instead, so no lookup needed + ArtifactRepositoryLayout layout = getRepositoryLayout( repo ); + + ArtifactRepositoryPolicy snapshots = buildArtifactRepositoryPolicy( repo.getSnapshots() ); + + ArtifactRepositoryPolicy releases = buildArtifactRepositoryPolicy( repo.getReleases() ); + + return artifactRepositoryFactory.createArtifactRepository( id, url, layout, snapshots, releases ); } - return mavenTools; + else + { + return null; + } + } + + public ArtifactRepositoryPolicy buildArtifactRepositoryPolicy( RepositoryPolicy policy ) + { + boolean enabled = true; + + String updatePolicy = null; + + String checksumPolicy = null; + + if ( policy != null ) + { + enabled = policy.isEnabled(); + + if ( policy.getUpdatePolicy() != null ) + { + updatePolicy = policy.getUpdatePolicy(); + } + if ( policy.getChecksumPolicy() != null ) + { + checksumPolicy = policy.getChecksumPolicy(); + } + } + + return new ArtifactRepositoryPolicy( enabled, updatePolicy, checksumPolicy ); + } + + private ArtifactRepositoryLayout getRepositoryLayout( RepositoryBase mavenRepo ) + throws InvalidRepositoryException + { + String layout = mavenRepo.getLayout(); + + ArtifactRepositoryLayout repositoryLayout; + try + { + repositoryLayout = (ArtifactRepositoryLayout) container.lookup( ArtifactRepositoryLayout.ROLE, layout ); + } + catch ( ComponentLookupException e ) + { + throw new InvalidRepositoryException( "Cannot find layout implementation corresponding to: \'" + layout + + "\' for remote repository with id: \'" + mavenRepo.getId() + "\'.", e ); + } + return repositoryLayout; + } + + // ---------------------------------------------------------------------------- + // Lifecycle + // ---------------------------------------------------------------------------- + + public void contextualize( Context context ) + throws ContextException + { + container = (PlexusContainer) context.get( PlexusConstants.PLEXUS_KEY ); } } diff --git a/maven-project/src/main/java/org/apache/maven/MavenTools.java b/maven-project/src/main/java/org/apache/maven/MavenTools.java index ae0aba404e..ad34776674 100644 --- a/maven-project/src/main/java/org/apache/maven/MavenTools.java +++ b/maven-project/src/main/java/org/apache/maven/MavenTools.java @@ -19,11 +19,30 @@ package org.apache.maven; * under the License. */ +import org.apache.maven.artifact.InvalidRepositoryException; +import org.apache.maven.artifact.repository.ArtifactRepository; +import org.apache.maven.model.DeploymentRepository; +import org.apache.maven.model.Repository; + +import java.util.List; /** - * @deprecated use {@link org.apache.maven.project.MavenTools} * @author Jason van Zyl */ -public interface MavenTools extends org.apache.maven.project.MavenTools +public interface MavenTools { + String ROLE = MavenTools.class.getName(); + + // ---------------------------------------------------------------------------- + // Methods taken from ProjectUtils + // ---------------------------------------------------------------------------- + + List buildArtifactRepositories( List repositories ) + throws InvalidRepositoryException; + + ArtifactRepository buildDeploymentArtifactRepository( DeploymentRepository repo ) + throws InvalidRepositoryException; + + ArtifactRepository buildArtifactRepository( Repository repo ) + throws InvalidRepositoryException; } diff --git a/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java b/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java index a28a051d97..777c69a3d8 100644 --- a/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java +++ b/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java @@ -19,6 +19,7 @@ package org.apache.maven.project; * under the License. */ +import org.apache.maven.MavenTools; import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.ArtifactStatus; import org.apache.maven.artifact.ArtifactUtils; diff --git a/maven-project/src/main/java/org/apache/maven/project/DefaultMavenTools.java b/maven-project/src/main/java/org/apache/maven/project/DefaultMavenTools.java deleted file mode 100644 index 3906aec6db..0000000000 --- a/maven-project/src/main/java/org/apache/maven/project/DefaultMavenTools.java +++ /dev/null @@ -1,174 +0,0 @@ -package org.apache.maven.project; - -/* - * 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.artifact.InvalidRepositoryException; -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.artifact.repository.ArtifactRepositoryFactory; -import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy; -import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout; -import org.apache.maven.model.DeploymentRepository; -import org.apache.maven.model.Repository; -import org.apache.maven.model.RepositoryBase; -import org.apache.maven.model.RepositoryPolicy; -import org.codehaus.plexus.PlexusConstants; -import org.codehaus.plexus.PlexusContainer; -import org.codehaus.plexus.component.repository.exception.ComponentLookupException; -import org.codehaus.plexus.context.Context; -import org.codehaus.plexus.context.ContextException; -import org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -/** - * @author Jason van Zyl - * @since 2.1 - */ -public class DefaultMavenTools - implements MavenTools, Contextualizable -{ - private ArtifactRepositoryLayout repositoryLayout; - - private ArtifactRepositoryFactory artifactRepositoryFactory; - - private PlexusContainer container; - - // ---------------------------------------------------------------------------- - // Code snagged from ProjectUtils: this will have to be moved somewhere else - // but just trying to collect it all in one place right now. - // ---------------------------------------------------------------------------- - - public List buildArtifactRepositories( List repositories ) - throws InvalidRepositoryException - { - List repos = new ArrayList(); - - for ( Iterator i = repositories.iterator(); i.hasNext(); ) - { - Repository mavenRepo = (Repository) i.next(); - - ArtifactRepository artifactRepo = buildArtifactRepository( mavenRepo ); - - if ( !repos.contains( artifactRepo ) ) - { - repos.add( artifactRepo ); - } - } - return repos; - } - - public ArtifactRepository buildDeploymentArtifactRepository( DeploymentRepository repo ) - throws InvalidRepositoryException - { - if ( repo != null ) - { - String id = repo.getId(); - String url = repo.getUrl(); - - // TODO: make this a map inside the factory instead, so no lookup needed - ArtifactRepositoryLayout layout = getRepositoryLayout( repo ); - - return artifactRepositoryFactory.createDeploymentArtifactRepository( id, url, layout, - repo.isUniqueVersion() ); - } - else - { - return null; - } - } - - public ArtifactRepository buildArtifactRepository( Repository repo ) - throws InvalidRepositoryException - { - if ( repo != null ) - { - String id = repo.getId(); - String url = repo.getUrl(); - - // TODO: make this a map inside the factory instead, so no lookup needed - ArtifactRepositoryLayout layout = getRepositoryLayout( repo ); - - ArtifactRepositoryPolicy snapshots = buildArtifactRepositoryPolicy( repo.getSnapshots() ); - - ArtifactRepositoryPolicy releases = buildArtifactRepositoryPolicy( repo.getReleases() ); - - return artifactRepositoryFactory.createArtifactRepository( id, url, layout, snapshots, releases ); - } - else - { - return null; - } - } - - public ArtifactRepositoryPolicy buildArtifactRepositoryPolicy( RepositoryPolicy policy ) - { - boolean enabled = true; - - String updatePolicy = null; - - String checksumPolicy = null; - - if ( policy != null ) - { - enabled = policy.isEnabled(); - - if ( policy.getUpdatePolicy() != null ) - { - updatePolicy = policy.getUpdatePolicy(); - } - if ( policy.getChecksumPolicy() != null ) - { - checksumPolicy = policy.getChecksumPolicy(); - } - } - - return new ArtifactRepositoryPolicy( enabled, updatePolicy, checksumPolicy ); - } - - private ArtifactRepositoryLayout getRepositoryLayout( RepositoryBase mavenRepo ) - throws InvalidRepositoryException - { - String layout = mavenRepo.getLayout(); - - ArtifactRepositoryLayout repositoryLayout; - try - { - repositoryLayout = (ArtifactRepositoryLayout) container.lookup( ArtifactRepositoryLayout.ROLE, layout ); - } - catch ( ComponentLookupException e ) - { - throw new InvalidRepositoryException( "Cannot find layout implementation corresponding to: \'" + layout + - "\' for remote repository with id: \'" + mavenRepo.getId() + "\'.", e ); - } - return repositoryLayout; - } - - // ---------------------------------------------------------------------------- - // Lifecycle - // ---------------------------------------------------------------------------- - - public void contextualize( Context context ) - throws ContextException - { - container = (PlexusContainer) context.get( PlexusConstants.PLEXUS_KEY ); - } -} diff --git a/maven-project/src/main/java/org/apache/maven/project/MavenTools.java b/maven-project/src/main/java/org/apache/maven/project/MavenTools.java deleted file mode 100644 index 8adf5105b1..0000000000 --- a/maven-project/src/main/java/org/apache/maven/project/MavenTools.java +++ /dev/null @@ -1,49 +0,0 @@ -package org.apache.maven.project; - -/* - * 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.artifact.InvalidRepositoryException; -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.model.DeploymentRepository; -import org.apache.maven.model.Repository; - -import java.util.List; - -/** - * @author Jason van Zyl - * @since 2.1 - */ -public interface MavenTools -{ - String ROLE = MavenTools.class.getName(); - - // ---------------------------------------------------------------------------- - // Methods taken from ProjectUtils - // ---------------------------------------------------------------------------- - - List buildArtifactRepositories( List repositories ) - throws InvalidRepositoryException; - - ArtifactRepository buildDeploymentArtifactRepository( DeploymentRepository repo ) - throws InvalidRepositoryException; - - ArtifactRepository buildArtifactRepository( Repository repo ) - throws InvalidRepositoryException; -} diff --git a/maven-project/src/main/java/org/apache/maven/project/build/model/DefaultModelLineageBuilder.java b/maven-project/src/main/java/org/apache/maven/project/build/model/DefaultModelLineageBuilder.java index 8f33cfb1ac..d3b8db49e5 100644 --- a/maven-project/src/main/java/org/apache/maven/project/build/model/DefaultModelLineageBuilder.java +++ b/maven-project/src/main/java/org/apache/maven/project/build/model/DefaultModelLineageBuilder.java @@ -19,6 +19,7 @@ package org.apache.maven.project.build.model; * under the License. */ +import org.apache.maven.MavenTools; import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.InvalidRepositoryException; import org.apache.maven.artifact.factory.ArtifactFactory; @@ -31,7 +32,6 @@ import org.apache.maven.model.Model; import org.apache.maven.model.Parent; import org.apache.maven.model.io.xpp3.MavenXpp3Reader; import org.apache.maven.profiles.ProfileManager; -import org.apache.maven.project.MavenTools; import org.apache.maven.project.ProjectBuildingException; import org.apache.maven.project.build.ProjectBuildCache; import org.apache.maven.project.build.profile.ProfileAdvisor; diff --git a/maven-project/src/main/java/org/apache/maven/project/build/profile/DefaultProfileAdvisor.java b/maven-project/src/main/java/org/apache/maven/project/build/profile/DefaultProfileAdvisor.java index 0d0aa1dfde..0b94a2728a 100644 --- a/maven-project/src/main/java/org/apache/maven/project/build/profile/DefaultProfileAdvisor.java +++ b/maven-project/src/main/java/org/apache/maven/project/build/profile/DefaultProfileAdvisor.java @@ -19,6 +19,7 @@ package org.apache.maven.project.build.profile; * under the License. */ +import org.apache.maven.MavenTools; import org.apache.maven.artifact.ArtifactUtils; import org.apache.maven.artifact.InvalidRepositoryException; import org.apache.maven.artifact.repository.ArtifactRepository; @@ -31,7 +32,6 @@ import org.apache.maven.profiles.ProfileManager; import org.apache.maven.profiles.ProfilesConversionUtils; import org.apache.maven.profiles.ProfilesRoot; import org.apache.maven.profiles.activation.ProfileActivationException; -import org.apache.maven.project.MavenTools; import org.apache.maven.project.ProjectBuildingException; import org.apache.maven.project.injection.ProfileInjector; import org.codehaus.plexus.PlexusConstants; diff --git a/maven-project/src/main/resources/META-INF/plexus/components.xml b/maven-project/src/main/resources/META-INF/plexus/components.xml index 2cc949aefd..a29821cde1 100644 --- a/maven-project/src/main/resources/META-INF/plexus/components.xml +++ b/maven-project/src/main/resources/META-INF/plexus/components.xml @@ -58,7 +58,7 @@ under the License. org.apache.maven.project.build.profile.DefaultProfileAdvisor - org.apache.maven.project.MavenTools + org.apache.maven.MavenTools org.apache.maven.profiles.MavenProfilesBuilder @@ -85,7 +85,7 @@ under the License. org.apache.maven.artifact.factory.ArtifactFactory - org.apache.maven.project.MavenTools + org.apache.maven.MavenTools org.apache.maven.artifact.resolver.ArtifactResolver @@ -188,7 +188,7 @@ under the License. org.apache.maven.artifact.manager.WagonManager - org.apache.maven.project.MavenTools + org.apache.maven.MavenTools @@ -351,20 +351,9 @@ under the License. - org.apache.maven.MavenTools org.apache.maven.DefaultMavenTools - - - org.apache.maven.project.MavenTools - - - - - - org.apache.maven.project.MavenTools - org.apache.maven.project.DefaultMavenTools org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout diff --git a/maven-project/src/test/resources/org/apache/maven/project/ProjectClasspathTest.xml b/maven-project/src/test/resources/org/apache/maven/project/ProjectClasspathTest.xml index dfeec9d0b6..ecb2de7f00 100644 --- a/maven-project/src/test/resources/org/apache/maven/project/ProjectClasspathTest.xml +++ b/maven-project/src/test/resources/org/apache/maven/project/ProjectClasspathTest.xml @@ -44,7 +44,7 @@ under the License. org.apache.maven.project.build.profile.DefaultProfileAdvisor - org.apache.maven.project.MavenTools + org.apache.maven.MavenTools org.apache.maven.profiles.MavenProfilesBuilder @@ -117,7 +117,7 @@ under the License. default - org.apache.maven.project.MavenTools + org.apache.maven.MavenTools diff --git a/maven-project/src/test/resources/org/apache/maven/project/canonical/CanonicalProjectBuilderTest.xml b/maven-project/src/test/resources/org/apache/maven/project/canonical/CanonicalProjectBuilderTest.xml index de7a3f00b0..99e367931c 100644 --- a/maven-project/src/test/resources/org/apache/maven/project/canonical/CanonicalProjectBuilderTest.xml +++ b/maven-project/src/test/resources/org/apache/maven/project/canonical/CanonicalProjectBuilderTest.xml @@ -62,7 +62,7 @@ under the License. org.apache.maven.project.build.profile.DefaultProfileAdvisor - org.apache.maven.project.MavenTools + org.apache.maven.MavenTools org.apache.maven.profiles.MavenProfilesBuilder @@ -111,7 +111,7 @@ under the License. org.apache.maven.artifact.resolver.ArtifactResolver - org.apache.maven.project.MavenTools + org.apache.maven.MavenTools org.apache.maven.context.BuildContextManager diff --git a/maven-settings/pom.xml b/maven-settings/pom.xml index 999d304fe0..eb47e6e19f 100644 --- a/maven-settings/pom.xml +++ b/maven-settings/pom.xml @@ -47,16 +47,6 @@ under the License. - - org.apache.felix - maven-bundle-plugin - - - - !org.apache.maven,* - - - diff --git a/maven-settings/src/main/java/org/apache/maven/SettingsConfigurationException.java b/maven-settings/src/main/java/org/apache/maven/SettingsConfigurationException.java index e628db63eb..82af5a4797 100644 --- a/maven-settings/src/main/java/org/apache/maven/SettingsConfigurationException.java +++ b/maven-settings/src/main/java/org/apache/maven/SettingsConfigurationException.java @@ -21,15 +21,17 @@ package org.apache.maven; /** * If there was an error in the settings file. - * - * @deprecated use {@link org.apache.maven.settings.SettingsConfigurationException} * * @author Brett Porter * @version $Id$ */ public class SettingsConfigurationException - extends org.apache.maven.settings.SettingsConfigurationException + extends Exception { + private int lineNumber; + + private int columnNumber; + public SettingsConfigurationException( String message ) { super( message ); @@ -42,7 +44,21 @@ public class SettingsConfigurationException public SettingsConfigurationException( String message, Throwable cause, int lineNumber, int columnNumber ) { - super( message, cause, lineNumber, columnNumber ); + super( message + ( lineNumber > 0 ? "\n Line: " + lineNumber : "" ) + + ( columnNumber > 0 ? "\n Column: " + columnNumber : "" ), cause ); + this.lineNumber = lineNumber; + this.columnNumber = columnNumber; } + public int getColumnNumber() + { + return columnNumber; + } + + public int getLineNumber() + { + return lineNumber; + } + + } diff --git a/maven-settings/src/main/java/org/apache/maven/settings/SettingsConfigurationException.java b/maven-settings/src/main/java/org/apache/maven/settings/SettingsConfigurationException.java deleted file mode 100644 index 474d8f291c..0000000000 --- a/maven-settings/src/main/java/org/apache/maven/settings/SettingsConfigurationException.java +++ /dev/null @@ -1,65 +0,0 @@ -package org.apache.maven.settings; - -/* - * 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. - */ - -/** - * If there was an error in the settings file. - * - * @author Brett Porter - * @version $Id$ - * @since 2.1 - */ -public class SettingsConfigurationException - extends Exception -{ - private int lineNumber; - - private int columnNumber; - - public SettingsConfigurationException( String message ) - { - super( message ); - } - - public SettingsConfigurationException( String message, Throwable cause ) - { - super( message, cause ); - } - - public SettingsConfigurationException( String message, Throwable cause, int lineNumber, int columnNumber ) - { - super( message + ( lineNumber > 0 ? "\n Line: " + lineNumber : "" ) + - ( columnNumber > 0 ? "\n Column: " + columnNumber : "" ), cause ); - this.lineNumber = lineNumber; - this.columnNumber = columnNumber; - } - - public int getColumnNumber() - { - return columnNumber; - } - - public int getLineNumber() - { - return lineNumber; - } - - -} diff --git a/pom.xml b/pom.xml index a3fa37d9a9..14f70504a6 100644 --- a/pom.xml +++ b/pom.xml @@ -100,25 +100,21 @@ under the License. - - org.apache.felix - maven-bundle-plugin - - 0.9.0-incubator-SNAPSHOT - - - - manifest - - - - + org.apache.felix maven-bundle-plugin + 0.9.0-incubator-SNAPSHOT + + + + manifest + + +