001 package org.apache.maven.project.artifact;
002
003 /*
004 * Licensed to the Apache Software Foundation (ASF) under one
005 * or more contributor license agreements. See the NOTICE file
006 * distributed with this work for additional information
007 * regarding copyright ownership. The ASF licenses this file
008 * to you under the Apache License, Version 2.0 (the
009 * "License"); you may not use this file except in compliance
010 * with the License. You may obtain a copy of the License at
011 *
012 * http://www.apache.org/licenses/LICENSE-2.0
013 *
014 * Unless required by applicable law or agreed to in writing,
015 * software distributed under the License is distributed on an
016 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
017 * KIND, either express or implied. See the License for the
018 * specific language governing permissions and limitations
019 * under the License.
020 */
021
022 import java.util.Collections;
023 import java.util.List;
024
025 import org.apache.maven.artifact.Artifact;
026 import org.apache.maven.artifact.DefaultArtifact;
027 import org.apache.maven.artifact.handler.ArtifactHandler;
028 import org.apache.maven.model.Dependency;
029 import org.apache.maven.model.Plugin;
030
031 public class PluginArtifact
032 extends DefaultArtifact
033 implements ArtifactWithDependencies
034 {
035 private Plugin plugin;
036
037 public PluginArtifact( Plugin plugin, Artifact pluginArtifact )
038 {
039 super( plugin.getGroupId(), plugin.getArtifactId(), plugin.getVersion(), null, "maven-plugin", null,
040 new PluginArtifactHandler() );
041 this.plugin = plugin;
042 setFile( pluginArtifact.getFile() );
043 setResolved( true );
044 }
045
046 public List<Dependency> getDependencies()
047 {
048 return plugin.getDependencies();
049 }
050
051 public List<Dependency> getManagedDependencies()
052 {
053 return Collections.emptyList();
054 }
055
056 static class PluginArtifactHandler
057 implements ArtifactHandler
058 {
059 public String getClassifier()
060 {
061 return null;
062 }
063
064 public String getDirectory()
065 {
066 return null;
067 }
068
069 public String getExtension()
070 {
071 return "jar";
072 }
073
074 public String getLanguage()
075 {
076 return "none";
077 }
078
079 public String getPackaging()
080 {
081 return "maven-plugin";
082 }
083
084 public boolean isAddedToClasspath()
085 {
086 return true;
087 }
088
089 public boolean isIncludesDependencies()
090 {
091 return false;
092 }
093 }
094 }