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
This commit is contained in:
Jason van Zyl 2007-06-02 15:35:57 +00:00
parent 6d3984551c
commit cc5f2f954b
27 changed files with 324 additions and 606 deletions

View File

@ -11,5 +11,5 @@ mv target/maven-2.1-SNAPSHOT-sources.jar $dir/maven-embedder-$ds-depsrc.zip
cd maven-embedder
sed "s@<bundleVersion>.*</bundleVersion>@<bundleVersion>$ds</bundleVersion>@" 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
)

View File

@ -150,18 +150,4 @@ under the License.
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<configuration>
<instructions>
<!-- do not export deprecated packages -->
<Export-Package>!org.apache.maven.monitor.*,*</Export-Package>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@ -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 + "]" );
}
}

View File

@ -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();
}
}

View File

@ -89,6 +89,7 @@ public interface MavenExecutionRequest
// Properties
MavenExecutionRequest setProperties( Properties properties );
MavenExecutionRequest setProperty( String key, String value );
Properties getProperties();
// Reactor

View File

@ -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 + "]" );
}
}

View File

@ -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();
}
}

View File

@ -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;

View File

@ -30,7 +30,7 @@ under the License.
<artifactId>maven-embedder</artifactId>
<name>Maven Embedder</name>
<properties>
<bundleVersion>2.1.0.v20070320-1003</bundleVersion>
<bundleVersion>2.1.0.v20070601-0109</bundleVersion>
</properties>
<build>
<resources>

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -19,9 +19,8 @@ specific language governing permissions and limitations
under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<artifactId>maven</artifactId>
<groupId>org.apache.maven</groupId>
@ -72,19 +71,4 @@ under the License.
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<configuration>
<instructions>
<!-- do not export deprecated packages -->
<Export-Package>!org.apache.maven,*</Export-Package>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@ -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 );
}
}

View File

@ -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;
}

View File

@ -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;

View File

@ -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 );
}
}

View File

@ -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;
}

View File

@ -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;

View File

@ -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;

View File

@ -58,7 +58,7 @@ under the License.
<implementation>org.apache.maven.project.build.profile.DefaultProfileAdvisor</implementation>
<requirements>
<requirement>
<role>org.apache.maven.project.MavenTools</role>
<role>org.apache.maven.MavenTools</role>
</requirement>
<requirement>
<role>org.apache.maven.profiles.MavenProfilesBuilder</role>
@ -85,7 +85,7 @@ under the License.
<role>org.apache.maven.artifact.factory.ArtifactFactory</role>
</requirement>
<requirement>
<role>org.apache.maven.project.MavenTools</role>
<role>org.apache.maven.MavenTools</role>
</requirement>
<requirement>
<role>org.apache.maven.artifact.resolver.ArtifactResolver</role>
@ -188,7 +188,7 @@ under the License.
<role>org.apache.maven.artifact.manager.WagonManager</role>
</requirement>
<requirement>
<role>org.apache.maven.project.MavenTools</role>
<role>org.apache.maven.MavenTools</role>
</requirement>
</requirements>
</component>
@ -351,20 +351,9 @@ under the License.
</requirements>
</component>
<!-- @deprecated use org.apache.maven.project.MavenTools -->
<component>
<role>org.apache.maven.MavenTools</role>
<implementation>org.apache.maven.DefaultMavenTools</implementation>
<requirements>
<requirement>
<role>org.apache.maven.project.MavenTools</role>
</requirement>
</requirements>
</component>
<component>
<role>org.apache.maven.project.MavenTools</role>
<implementation>org.apache.maven.project.DefaultMavenTools</implementation>
<requirements>
<requirement>
<role>org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout</role>

View File

@ -44,7 +44,7 @@ under the License.
<implementation>org.apache.maven.project.build.profile.DefaultProfileAdvisor</implementation>
<requirements>
<requirement>
<role>org.apache.maven.project.MavenTools</role>
<role>org.apache.maven.MavenTools</role>
</requirement>
<requirement>
<role>org.apache.maven.profiles.MavenProfilesBuilder</role>
@ -117,7 +117,7 @@ under the License.
<role-hint>default</role-hint>
</requirement>
<requirement>
<role>org.apache.maven.project.MavenTools</role>
<role>org.apache.maven.MavenTools</role>
</requirement>
</requirements>
</component>

View File

@ -62,7 +62,7 @@ under the License.
<implementation>org.apache.maven.project.build.profile.DefaultProfileAdvisor</implementation>
<requirements>
<requirement>
<role>org.apache.maven.project.MavenTools</role>
<role>org.apache.maven.MavenTools</role>
</requirement>
<requirement>
<role>org.apache.maven.profiles.MavenProfilesBuilder</role>
@ -111,7 +111,7 @@ under the License.
<role>org.apache.maven.artifact.resolver.ArtifactResolver</role>
</requirement>
<requirement>
<role>org.apache.maven.project.MavenTools</role>
<role>org.apache.maven.MavenTools</role>
</requirement>
<requirement>
<role>org.apache.maven.context.BuildContextManager</role>

View File

@ -47,16 +47,6 @@ under the License.
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<configuration>
<instructions>
<!-- do not export deprecated packages -->
<Export-Package>!org.apache.maven,*</Export-Package>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>

View File

@ -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 <a href="mailto:brett@apache.org">Brett Porter</a>
* @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;
}
}

View File

@ -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 <a href="mailto:brett@apache.org">Brett Porter</a>
* @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;
}
}

22
pom.xml
View File

@ -100,25 +100,21 @@ under the License.
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<!-- if plugin not released at maven release time the manifests generated could be checked in by hand -->
<version>0.9.0-incubator-SNAPSHOT</version>
<executions>
<execution>
<goals>
<goal>manifest</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<!-- if plugin not released at maven release time the manifests generated could be checked in by hand -->
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>0.9.0-incubator-SNAPSHOT</version>
<executions>
<execution>
<goals>
<goal>manifest</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- Needed for including the manifest, see MJAR-71 -->
<plugin>