| 34 | | /** |
| 35 | | * @parameter expression="${project}" |
| 36 | | * @required |
| 37 | | * @readonly |
| 38 | | */ |
| 39 | | private MavenProject project; |
| 40 | | |
| 41 | | /** |
| 42 | | * The local repository, from which to delete artifacts. |
| 43 | | * |
| 44 | | * @parameter default-value="${localRepository}" |
| 45 | | * @required |
| 46 | | * @readonly |
| 47 | | */ |
| 48 | | private ArtifactRepository localRepository; |
| 49 | | |
| 50 | | /** |
| 51 | | * The artifact resolver used to re-resolve dependencies, if that option is |
| 52 | | * enabled. |
| 53 | | * |
| 54 | | * @component |
| 55 | | */ |
| 56 | | private ArtifactResolver resolver; |
| 57 | | |
| 58 | | /** |
| 59 | | * The artifact metadata source used to resolve dependencies |
| 60 | | * |
| 61 | | * @component |
| 62 | | */ |
| 63 | | private ArtifactMetadataSource source; |
| 64 | | |
| 65 | | private static final String JYTHON_PLUGIN_ARTIFACT_ID = "maven-jython-plugin"; |
| 100 | | /** |
| 101 | | * @param artifactFile |
| 102 | | * @throws MojoExecutionException |
| 103 | | */ |
| 104 | | @SuppressWarnings("unchecked") |
| 105 | | protected List<File> getPluginArtifactLiblary() |
| 106 | | throws MojoExecutionException { |
| 107 | | List<File> artifactList = new ArrayList<File>(); |
| 108 | | Set<Artifact> pluginDependencyArtifacts = new HashSet<Artifact>(); |
| 109 | | for (Artifact artifact : (Set<Artifact>) project.getPluginArtifacts()) { |
| 110 | | if (artifact.getArtifactId().equals(JYTHON_PLUGIN_ARTIFACT_ID)) { |
| 111 | | pluginDependencyArtifacts.add(artifact); |
| 112 | | } |
| 113 | | } |
| 114 | | try { |
| 115 | | ArtifactResolutionResult result = resolver.resolveTransitively( |
| 116 | | pluginDependencyArtifacts, project.getArtifact(), |
| 117 | | Collections.EMPTY_LIST, localRepository, source); |
| 118 | | for (Artifact artifact : (Set<Artifact>) result.getArtifacts()) { |
| 119 | | artifactList.add(artifact.getFile()); |
| 120 | | } |
| 121 | | } catch (Exception e) { |
| 122 | | e.printStackTrace(); |
| 123 | | throw new MojoExecutionException("Exception occured.:", e); |
| 124 | | } |
| 125 | | return artifactList; |
| 126 | | } |
| | 41 | |
| 132 | | public void setProject(MavenProject project) { |
| 133 | | this.project = project; |
| 134 | | } |
| 135 | | |
| 136 | | /** |
| 137 | | * @return the localRepository |
| 138 | | */ |
| 139 | | public ArtifactRepository getLocalRepository() { |
| 140 | | return localRepository; |
| 141 | | } |
| 142 | | |
| 143 | | /** |
| 144 | | * @param localRepository |
| 145 | | * the localRepository to set |
| 146 | | */ |
| 147 | | public void setLocalRepository(ArtifactRepository localRepository) { |
| 148 | | this.localRepository = localRepository; |
| 149 | | } |
| 150 | | |
| 151 | | /** |
| 152 | | * @return the resolver |
| 153 | | */ |
| 154 | | public ArtifactResolver getResolver() { |
| 155 | | return resolver; |
| 156 | | } |
| 157 | | |
| 158 | | /** |
| 159 | | * @param resolver |
| 160 | | * the resolver to set |
| 161 | | */ |
| 162 | | public void setResolver(ArtifactResolver resolver) { |
| 163 | | this.resolver = resolver; |
| 164 | | } |
| 165 | | |
| 166 | | /** |
| 167 | | * @return the source |
| 168 | | */ |
| 169 | | public ArtifactMetadataSource getSource() { |
| 170 | | return source; |
| 171 | | } |
| 172 | | |
| 173 | | /** |
| 174 | | * @param source |
| 175 | | * the source to set |
| 176 | | */ |
| 177 | | public void setSource(ArtifactMetadataSource source) { |
| 178 | | this.source = source; |
| 179 | | } |