diff --git a/maven-core/src/main/java/org/apache/maven/listeners/BuildExtensionListener.java b/maven-core/src/main/java/org/apache/maven/listeners/BuildExtensionListener.java deleted file mode 100644 index 5937d3302b..0000000000 --- a/maven-core/src/main/java/org/apache/maven/listeners/BuildExtensionListener.java +++ /dev/null @@ -1,123 +0,0 @@ -package org.apache.maven.listeners; - -/* - * 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.ArrayList; -import java.util.List; - -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.execution.MavenSession; -import org.apache.maven.model.Extension; -import org.apache.maven.model.Model; -import org.codehaus.plexus.component.annotations.Component; -import org.codehaus.plexus.component.annotations.Configuration; - -/** - * This listener has two parts: the collection of the extension elements which happens during POM construction, - * and the processing of the build extensions once the construction is finished and the build plan is being - * created. The extensions that are found can be contributed to a Mercury session where a set of artifacts - * are retrieved and any number of extensions may be required. We don't want to load them as they are discovered - * because that prevents any sort of analysis so we collect, analyze and process. - * - * @author Jason van Zyl - * - */ -@Component(role = MavenModelEventListener.class, hint="extensions", instantiationStrategy="per-lookup" ) -public class BuildExtensionListener - implements MavenModelEventListener -{ - @Configuration(value = "true") - private boolean inBuild = true; - - //@Requirement - //PlexusPluginManager pluginManager; - - private List buildExtensions = new ArrayList(); - - public void fire(Model model) - { - buildExtensions.addAll(new ArrayList(model.getBuild().getExtensions())); - } - - /** - * Take the extension elements that were found during the POM construction process and now - * retrieve all the artifacts necessary, load them in a realm, and discovery the components - * that are in the realm. Any components that are discovered will be available to lookups - * in the container from any location and the right classloader will be used to execute - * any components discovered in the extension realm. - * - * @param session Maven session used as the execution context for the current Maven project. - */ - public void processModelContainers( MavenSession session ) - { - if(!inBuild) - { - return; - } - - for ( Extension be : buildExtensions ) - { - /* - PluginResolutionRequest request = new PluginResolutionRequest() - .setPluginMetadata( new PluginMetadata( be.getGroupId(), be.getArtifactId(), be.getVersion() ) ) - .addLocalRepository( session.getRequest().getLocalRepositoryPath() ) - .setRemoteRepositories( convertToMercuryRepositories( session.getRequest().getRemoteRepositories() ) ); - - PluginResolutionResult result = null; - - try - { - result = pluginManager.resolve( request ); - - ClassRealm realm = pluginManager.createClassRealm( result.getArtifacts() ); - - realm.display(); - - List> components = pluginManager.discoverComponents( realm ); - } - catch ( Exception e ) - { - e.printStackTrace(); - } - */ - } - } - - List convertToMercuryRepositories( List repositories ) - { - List repos = new ArrayList(); - - if ( repositories != null ) - { - for ( ArtifactRepository r : repositories ) - { - repos.add( r.getUrl() ); - } - } - else - { - // This will only ever be use for the test that I have. So yes this will break - // folks behind proxies until alpha-2. Such is life. - repos.add( "http://repo1.maven.org/maven2" ); - } - - return repos; - } -} diff --git a/maven-core/src/main/java/org/apache/maven/listeners/DefaultMavenModelEventProcessor.java b/maven-core/src/main/java/org/apache/maven/listeners/DefaultMavenModelEventProcessor.java deleted file mode 100644 index 219bd7bb94..0000000000 --- a/maven-core/src/main/java/org/apache/maven/listeners/DefaultMavenModelEventProcessor.java +++ /dev/null @@ -1,42 +0,0 @@ -package org.apache.maven.listeners; - -/* - * 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.execution.MavenSession; -import org.codehaus.plexus.component.annotations.Component; -import org.codehaus.plexus.component.annotations.Requirement; - -@Component(role = MavenModelEventProcessor.class) -public class DefaultMavenModelEventProcessor - implements MavenModelEventProcessor -{ - @Requirement - List listeners; - - public void processModelContainers( MavenSession session ) - { - for( MavenModelEventListener listener : listeners ) - { - listener.processModelContainers( session ); - } - } -} diff --git a/maven-core/src/main/java/org/apache/maven/listeners/MavenModelEventListener.java b/maven-core/src/main/java/org/apache/maven/listeners/MavenModelEventListener.java deleted file mode 100644 index b73c2fcb6a..0000000000 --- a/maven-core/src/main/java/org/apache/maven/listeners/MavenModelEventListener.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.apache.maven.listeners; - -/* - * 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.execution.MavenSession; -import org.apache.maven.model.building.ModelEventListener; - - -public interface MavenModelEventListener - extends ModelEventListener -{ - void processModelContainers( MavenSession session ); -} diff --git a/maven-core/src/main/java/org/apache/maven/listeners/MavenModelEventProcessor.java b/maven-core/src/main/java/org/apache/maven/listeners/MavenModelEventProcessor.java deleted file mode 100644 index 1d3b66e548..0000000000 --- a/maven-core/src/main/java/org/apache/maven/listeners/MavenModelEventProcessor.java +++ /dev/null @@ -1,27 +0,0 @@ -package org.apache.maven.listeners; - -/* - * 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.execution.MavenSession; - -public interface MavenModelEventProcessor -{ - void processModelContainers( MavenSession session ); -}