[Arakhnę-Dev] [274] * Bug fix: ClassCastException due to incompatible types between the Maven core API and Aether API .

[ Thread Index | Date Index | More arakhne.org/dev Archives ]


Revision: 274
Author:   galland
Date:     2011-08-24 22:59:29 +0200 (Wed, 24 Aug 2011)
Log Message:
-----------
* Bug fix: ClassCastException due to incompatible types between the Maven core API and Aether API.

Modified Paths:
--------------
    trunk/license-installer/src/main/java/org/arakhne/maven/plugins/licenseinstaller/InstallLicenseMojo.java
    trunk/maventools/src/main/java/org/arakhne/maven/AbstractArakhneMojo.java
    trunk/tag-replacer/src/main/java/org/arakhne/maven/plugins/tagreplacer/AbstractReplaceMojo.java

Modified: trunk/license-installer/src/main/java/org/arakhne/maven/plugins/licenseinstaller/InstallLicenseMojo.java
===================================================================
--- trunk/license-installer/src/main/java/org/arakhne/maven/plugins/licenseinstaller/InstallLicenseMojo.java	2011-08-24 20:28:32 UTC (rev 273)
+++ trunk/license-installer/src/main/java/org/arakhne/maven/plugins/licenseinstaller/InstallLicenseMojo.java	2011-08-24 20:59:29 UTC (rev 274)
@@ -165,7 +165,7 @@
 	/**
 	 * The project's remote repositories to use for the resolution of plugins and their dependencies.
 	 * 
-	 * @parameter default-value="${project.remotePluginRepositories}"
+	 * @parameter default-value="${project.remoteProjectRepositories}"
 	 * @readonly
 	 */
 	private List<RemoteRepository> remoteRepos;

Modified: trunk/maventools/src/main/java/org/arakhne/maven/AbstractArakhneMojo.java
===================================================================
--- trunk/maventools/src/main/java/org/arakhne/maven/AbstractArakhneMojo.java	2011-08-24 20:28:32 UTC (rev 273)
+++ trunk/maventools/src/main/java/org/arakhne/maven/AbstractArakhneMojo.java	2011-08-24 20:59:29 UTC (rev 274)
@@ -412,7 +412,7 @@
 	 * Replies the project's remote repositories to use for the resolution of plugins and their dependencies..
 	 * <p>
 	 * It is an attribute defined as: <code><pre>
-	 * <span>/</span>* <span>@</span>parameter default-value="&dollar;{project.remotePluginRepositories}"
+	 * <span>/</span>* <span>@</span>parameter default-value="&dollar;{project.remoteProjectRepositories}"
 	 * <span>*</span>/
 	 * private List<RemoteRepository> remoteRepos;
 	 * </pre></code>
@@ -421,7 +421,7 @@
 	 */
 	public abstract  List<RemoteRepository> getRemoteRepositoryList();
 	
-
+	
 	/**
 	 * Search and reply the maven artifact which is corresponding to the given file.
 	 * 
@@ -855,13 +855,13 @@
 		assert(mavenArtifact!=null);
 		ArtifactRequest request = new ArtifactRequest();
 		request.setArtifact(mavenArtifact);
-		request.setRepositories(this.getRemoteRepositoryList());
+		request.setRepositories(getRemoteRepositoryList());
 
 		this.info("Resolving artifact " + mavenArtifact.toString() + " from " + getRemoteRepositoryList());  //$NON-NLS-1$//$NON-NLS-2$
 
 		ArtifactResult result;
 		try {
-			result = this.getRepositorySystem().resolveArtifact(getRepositorySystemSession(), request);
+			result = getRepositorySystem().resolveArtifact(getRepositorySystemSession(), request);
 		} catch (ArtifactResolutionException e) {
 			throw new MojoExecutionException(e.getMessage(), e);
 		}
@@ -1193,10 +1193,12 @@
      */
 	public MavenProject getMavenProject(Artifact artifact) {
     	try {
+    		MavenSession session = getMavenSession();
+    		MavenProject current = session.getCurrentProject();
 			MavenProject prj = getMavenProjectBuilder().buildFromRepository(
 					artifact,
-					getRemoteRepositoryList(),
-					getMavenSession().getLocalRepository());
+					current.getRemoteArtifactRepositories(),
+					session.getLocalRepository());
 			return prj;
 		}
     	catch (ProjectBuildingException e) {
@@ -1213,9 +1215,10 @@
      */
     private class DependencyIterator implements Iterator<MavenProject> {
     	
+    	private final List<ArtifactRepository> remoteRepositiories;
+		private final boolean isTransitive;
 		private List<Dependency> dependencies = new ArrayList<Dependency>();
 		private Set<String> treated = new TreeSet<String>();
-		private final boolean isTransitive;
 		private MavenProject next;
 
 		/**
@@ -1226,6 +1229,7 @@
     	 */
 		public DependencyIterator(MavenProject project, boolean isTransitive) {
     		this.isTransitive = isTransitive;
+    		this.remoteRepositiories = project.getRemoteArtifactRepositories();
     		this.dependencies.addAll(project.getDependencies());
     		searchNext();
     	}
@@ -1246,9 +1250,10 @@
         							dependency.getScope(),
         							dependency.getType());
     						resolveArtifact(dependencyArtifact);
-    						MavenProject dependencyProject = getMavenProjectBuilder().buildFromRepository(
+    						MavenProjectBuilder builder = getMavenProjectBuilder();
+    						MavenProject dependencyProject = builder.buildFromRepository(
     								dependencyArtifact,
-    								getRemoteRepositoryList(),
+    								this.remoteRepositiories,
     								getMavenSession().getLocalRepository());
     						if (dependencyProject!=null) {
     							if (this.isTransitive) {

Modified: trunk/tag-replacer/src/main/java/org/arakhne/maven/plugins/tagreplacer/AbstractReplaceMojo.java
===================================================================
--- trunk/tag-replacer/src/main/java/org/arakhne/maven/plugins/tagreplacer/AbstractReplaceMojo.java	2011-08-24 20:28:32 UTC (rev 273)
+++ trunk/tag-replacer/src/main/java/org/arakhne/maven/plugins/tagreplacer/AbstractReplaceMojo.java	2011-08-24 20:59:29 UTC (rev 274)
@@ -218,7 +218,7 @@
 	/**
 	 * The project's remote repositories to use for the resolution of plugins and their dependencies.
 	 * 
-	 * @parameter default-value="${project.remotePluginRepositories}"
+	 * @parameter default-value="${project.remoteProjectRepositories}"
 	 * @readonly
 	 */
 	private List<RemoteRepository> remoteRepos;


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/