cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject [13/19] git commit: Only support maven 3+
Date Thu, 30 Oct 2014 19:29:02 GMT
Only support maven 3+


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/c1c9562b
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/c1c9562b
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/c1c9562b

Branch: refs/heads/master
Commit: c1c9562bb13eeacdd9dae5a46c513e9e03625698
Parents: 695fe06
Author: Daniel Kulp <dkulp@apache.org>
Authored: Thu Oct 30 13:05:31 2014 -0400
Committer: Daniel Kulp <dkulp@apache.org>
Committed: Thu Oct 30 14:18:06 2014 -0400

----------------------------------------------------------------------
 maven-plugins/codegen-plugin/pom.xml            |   5 -
 .../cxf/maven_plugin/AbstractCodegenMoho.java   |  80 +++++---------
 .../cxf/maven_plugin/ClassLoaderSwitcher.java   |   1 +
 maven-plugins/corba/pom.xml                     |  12 +--
 .../corba/maven/plugins/WSDLToIDLPlugin.java    |   2 +-
 maven-plugins/java2wadl-plugin/pom.xml          |   7 +-
 .../javatowadl/ParseJavaDocMojo.java            |  13 ++-
 maven-plugins/java2ws-plugin/pom.xml            |  10 +-
 .../cxf/maven_plugin/ClassLoaderSwitcher.java   |   1 +
 maven-plugins/wadl2java-plugin/pom.xml          |   5 -
 .../common/ClassLoaderSwitcher.java             |   1 +
 .../wadlto/AbstractCodeGeneratorMojo.java       | 107 ++++++-------------
 .../cxf/maven_plugin/wadlto/OptionLoader.java   |   1 -
 maven-plugins/wsdl-validator-plugin/pom.xml     |   5 -
 parent/pom.xml                                  |  19 ++--
 15 files changed, 80 insertions(+), 189 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/c1c9562b/maven-plugins/codegen-plugin/pom.xml
----------------------------------------------------------------------
diff --git a/maven-plugins/codegen-plugin/pom.xml b/maven-plugins/codegen-plugin/pom.xml
index cacee8c..e19027f 100644
--- a/maven-plugins/codegen-plugin/pom.xml
+++ b/maven-plugins/codegen-plugin/pom.xml
@@ -56,11 +56,6 @@
             <scope>provided</scope>
         </dependency>
         <dependency>
-            <groupId>org.apache.maven</groupId>
-            <artifactId>maven-project</artifactId>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
             <groupId>org.codehaus.plexus</groupId>
             <artifactId>plexus-utils</artifactId>
             <version>2.0.5</version>

http://git-wip-us.apache.org/repos/asf/cxf/blob/c1c9562b/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/AbstractCodegenMoho.java
----------------------------------------------------------------------
diff --git a/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/AbstractCodegenMoho.java
b/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/AbstractCodegenMoho.java
index 03c0a1c..33f7c10 100644
--- a/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/AbstractCodegenMoho.java
+++ b/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/AbstractCodegenMoho.java
@@ -43,19 +43,15 @@ import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.helpers.FileUtils;
 import org.apache.maven.ProjectDependenciesResolver;
 import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.InvalidRepositoryException;
-import org.apache.maven.artifact.factory.ArtifactFactory;
-import org.apache.maven.artifact.repository.ArtifactRepository;
-import org.apache.maven.artifact.repository.ArtifactRepositoryFactory;
 import org.apache.maven.artifact.resolver.AbstractArtifactResolutionException;
-import org.apache.maven.artifact.resolver.ArtifactResolver;
+import org.apache.maven.artifact.resolver.ArtifactResolutionRequest;
+import org.apache.maven.artifact.resolver.ArtifactResolutionResult;
 import org.apache.maven.execution.MavenSession;
-import org.apache.maven.model.Repository;
 import org.apache.maven.model.Resource;
 import org.apache.maven.plugin.AbstractMojo;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.project.MavenProject;
-import org.apache.maven.project.ProjectUtils;
+import org.apache.maven.repository.RepositorySystem;
 import org.apache.maven.settings.Proxy;
 import org.codehaus.plexus.archiver.jar.JarArchiver;
 import org.codehaus.plexus.archiver.jar.Manifest;
@@ -186,22 +182,6 @@ public abstract class AbstractCodegenMoho extends AbstractMojo {
      * @since 2.4
      */
     private String additionalJvmArgs;
-    /**
-     * The local repository taken from Maven's runtime. Typically $HOME/.m2/repository.
-     * 
-     * @parameter expression="${localRepository}"
-     * @readonly
-     * @required
-     */
-    private ArtifactRepository localRepository;
-    /**
-     * Artifact factory, needed to create artifacts.
-     * 
-     * @component
-     * @readonly
-     * @required
-     */
-    private ArtifactFactory artifactFactory;
 
     /**
      * Sets the Java executable to use when fork parameter is <code>true</code>.
@@ -210,42 +190,35 @@ public abstract class AbstractCodegenMoho extends AbstractMojo {
      * @since 2.4
      */
     private String javaExecutable;
+
     /**
-     * The remote repositories used as specified in your POM.
+     * The Maven session.
      * 
-     * @parameter expression="${project.repositories}"
+     * @parameter expression="${session}"
      * @readonly
      * @required
      */
-    private List<Repository> repositories;
+    private MavenSession mavenSession;
     /**
-     * Artifact repository factory component.
-     * 
      * @component
      * @readonly
      * @required
      */
-    private ArtifactRepositoryFactory artifactRepositoryFactory;
+    private ProjectDependenciesResolver projectDependencyResolver;
+    
     /**
-     * The Maven session.
-     * 
-     * @parameter expression="${session}"
+     * @component
      * @readonly
      * @required
      */
-    private MavenSession mavenSession;
+    private RepositorySystem repositorySystem;
+    
     /**
      * @component
      * @readonly
      * @required
      */
-    private ProjectDependenciesResolver projectDependencyResolver;
-     /**
-      * @component
-      * @readonly
-      * @required
-      */
-    private ArtifactResolver artifactResolver;
+    private MavenSession session;
     
 
     public AbstractCodegenMoho() {
@@ -817,7 +790,7 @@ public abstract class AbstractCodegenMoho extends AbstractMojo {
             if (wsdlA == null) {
                 continue;
             }
-            Artifact wsdlArtifact = artifactFactory.createArtifactWithClassifier(wsdlA.getGroupId(),
+            Artifact wsdlArtifact = repositorySystem.createArtifactWithClassifier(wsdlA.getGroupId(),
                                                                         wsdlA.getArtifactId(),
                                                                         wsdlA.getVersion(),

                                                                         wsdlA.getType(),
@@ -880,7 +853,7 @@ public abstract class AbstractCodegenMoho extends AbstractMojo {
     }
 
     private Artifact resolveAttachedWsdl(Artifact artifact) {
-        List<MavenProject> rProjects = mavenSession.getSortedProjects();
+        List<MavenProject> rProjects = mavenSession.getProjects();
         List<Artifact> artifactList = new ArrayList<Artifact>();
         for (MavenProject rProject : rProjects) {
             List<Artifact> list = CastUtils.cast(rProject.getAttachedArtifacts());
@@ -892,18 +865,17 @@ public abstract class AbstractCodegenMoho extends AbstractMojo {
     }
 
     private Artifact resolveArbitraryWsdl(Artifact artifact) {
-        try {
-            @SuppressWarnings("rawtypes")
-            List remoteRepos = ProjectUtils.buildArtifactRepositories(repositories, 
-                                                                      artifactRepositoryFactory,
-                                                                 mavenSession.getContainer());
-            artifactResolver.resolve(artifact, remoteRepos, localRepository);
-        } catch (InvalidRepositoryException e) {
-            getLog().info("Error build repositories for remote wsdls.", e);
-        } catch (AbstractArtifactResolutionException e) {
-            getLog().info("Error resolving arbitrary wsdl artifact.", e);
-        }
-        return artifact;
+        ArtifactResolutionRequest request = new ArtifactResolutionRequest();
+        request.setArtifact(artifact);
+        request.setResolveRoot(true).setResolveTransitively(false);
+        request.setServers(session.getRequest().getServers());
+        request.setMirrors(session.getRequest().getMirrors());
+        request.setProxies(session.getRequest().getProxies());
+        request.setLocalRepository(session.getLocalRepository());
+        request.setRemoteRepositories(session.getRequest().getRemoteRepositories());    
       
+        ArtifactResolutionResult result = repositorySystem.resolve(request);
+            
+        return result.getOriginatingArtifact();
     }
 
     private Artifact findWsdlArtifact(Artifact targetArtifact, Collection<Artifact>
artifactSet) {

http://git-wip-us.apache.org/repos/asf/cxf/blob/c1c9562b/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/ClassLoaderSwitcher.java
----------------------------------------------------------------------
diff --git a/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/ClassLoaderSwitcher.java
b/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/ClassLoaderSwitcher.java
index b6fff97..a8a3fae 100644
--- a/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/ClassLoaderSwitcher.java
+++ b/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/ClassLoaderSwitcher.java
@@ -82,6 +82,7 @@ public class ClassLoaderSwitcher {
             ret.add(new File(project.getBuild().getOutputDirectory()).toURI());
             buf.append(File.pathSeparatorChar);
         }
+        @SuppressWarnings("deprecation")
         List<?> artifacts = useCompileClasspath ? project.getCompileArtifacts() : project.getTestArtifacts();
         for (Artifact a : CastUtils.cast(artifacts, Artifact.class)) {
             try {

http://git-wip-us.apache.org/repos/asf/cxf/blob/c1c9562b/maven-plugins/corba/pom.xml
----------------------------------------------------------------------
diff --git a/maven-plugins/corba/pom.xml b/maven-plugins/corba/pom.xml
index be947ab..bf21633 100644
--- a/maven-plugins/corba/pom.xml
+++ b/maven-plugins/corba/pom.xml
@@ -49,18 +49,12 @@
         </dependency>
         <dependency>
             <groupId>org.apache.maven</groupId>
-            <artifactId>maven-plugin-api</artifactId>
-            <scope>compile</scope>
-            <exclusions>
-                <exclusion>
-                    <groupId>junit</groupId>
-                    <artifactId>junit</artifactId>
-                </exclusion>
-            </exclusions>
+            <artifactId>maven-core</artifactId>
+            <scope>provided</scope>
         </dependency>
         <dependency>
             <groupId>org.apache.maven</groupId>
-            <artifactId>maven-project</artifactId>
+            <artifactId>maven-plugin-api</artifactId>
             <scope>compile</scope>
             <exclusions>
                 <exclusion>

http://git-wip-us.apache.org/repos/asf/cxf/blob/c1c9562b/maven-plugins/corba/src/main/java/org/apache/cxf/maven_plugin/corba/maven/plugins/WSDLToIDLPlugin.java
----------------------------------------------------------------------
diff --git a/maven-plugins/corba/src/main/java/org/apache/cxf/maven_plugin/corba/maven/plugins/WSDLToIDLPlugin.java
b/maven-plugins/corba/src/main/java/org/apache/cxf/maven_plugin/corba/maven/plugins/WSDLToIDLPlugin.java
index cad3894..efa047d 100644
--- a/maven-plugins/corba/src/main/java/org/apache/cxf/maven_plugin/corba/maven/plugins/WSDLToIDLPlugin.java
+++ b/maven-plugins/corba/src/main/java/org/apache/cxf/maven_plugin/corba/maven/plugins/WSDLToIDLPlugin.java
@@ -31,7 +31,6 @@ import org.apache.cxf.BusFactory;
 import org.apache.cxf.common.classloader.ClassLoaderUtils;
 import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.tools.corba.WSDLToIDL;
-
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.plugin.AbstractMojo;
 import org.apache.maven.plugin.MojoExecutionException;
@@ -96,6 +95,7 @@ public class WSDLToIDLPlugin extends AbstractMojo {
         buf.append(File.pathSeparatorChar);
 
 
+        @SuppressWarnings("deprecation")
         List<?> artifacts = useCompileClasspath ? project.getCompileArtifacts() : project.getTestArtifacts();
         for (Artifact a : CastUtils.cast(artifacts, Artifact.class)) {
             try {

http://git-wip-us.apache.org/repos/asf/cxf/blob/c1c9562b/maven-plugins/java2wadl-plugin/pom.xml
----------------------------------------------------------------------
diff --git a/maven-plugins/java2wadl-plugin/pom.xml b/maven-plugins/java2wadl-plugin/pom.xml
index 88767ed..ea02b34 100644
--- a/maven-plugins/java2wadl-plugin/pom.xml
+++ b/maven-plugins/java2wadl-plugin/pom.xml
@@ -55,17 +55,16 @@
         </dependency>
         <dependency>
             <groupId>org.apache.maven</groupId>
-            <artifactId>maven-artifact</artifactId>
-            <scope>provided</scope>
+            <artifactId>maven-compat</artifactId>
         </dependency>
         <dependency>
             <groupId>org.apache.maven</groupId>
-            <artifactId>maven-plugin-api</artifactId>
+            <artifactId>maven-artifact</artifactId>
             <scope>provided</scope>
         </dependency>
         <dependency>
             <groupId>org.apache.maven</groupId>
-            <artifactId>maven-project</artifactId>
+            <artifactId>maven-plugin-api</artifactId>
             <scope>provided</scope>
         </dependency>
         <dependency>

http://git-wip-us.apache.org/repos/asf/cxf/blob/c1c9562b/maven-plugins/java2wadl-plugin/src/main/java/org/apache/cxf/maven_plugin/javatowadl/ParseJavaDocMojo.java
----------------------------------------------------------------------
diff --git a/maven-plugins/java2wadl-plugin/src/main/java/org/apache/cxf/maven_plugin/javatowadl/ParseJavaDocMojo.java
b/maven-plugins/java2wadl-plugin/src/main/java/org/apache/cxf/maven_plugin/javatowadl/ParseJavaDocMojo.java
index a8fa254..9dd47f6 100644
--- a/maven-plugins/java2wadl-plugin/src/main/java/org/apache/cxf/maven_plugin/javatowadl/ParseJavaDocMojo.java
+++ b/maven-plugins/java2wadl-plugin/src/main/java/org/apache/cxf/maven_plugin/javatowadl/ParseJavaDocMojo.java
@@ -24,8 +24,6 @@ import java.util.List;
 import java.util.Locale;
 
 import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.factory.ArtifactFactory;
-import org.apache.maven.artifact.metadata.ArtifactMetadataSource;
 import org.apache.maven.artifact.repository.ArtifactRepository;
 import org.apache.maven.artifact.resolver.ArtifactResolver;
 import org.apache.maven.plugin.MojoExecutionException;
@@ -33,9 +31,7 @@ import org.apache.maven.plugin.MojoFailureException;
 import org.apache.maven.plugin.javadoc.AbstractJavadocMojo;
 import org.apache.maven.plugin.javadoc.options.DocletArtifact;
 import org.apache.maven.project.MavenProject;
-import org.apache.maven.project.MavenProjectBuilder;
 import org.apache.maven.reporting.MavenReportException;
-
 import org.apache.maven.toolchain.ToolchainManager;
 import org.codehaus.plexus.archiver.manager.ArchiverManager;
 
@@ -61,7 +57,8 @@ public class ParseJavaDocMojo extends AbstractJavadocMojo {
     /**
      * @component
      */
-    private ArtifactFactory mavenArtifactFactory;
+    @SuppressWarnings("deprecation")
+    private org.apache.maven.artifact.factory.ArtifactFactory mavenArtifactFactory;
 
     /**
      * @component
@@ -71,12 +68,14 @@ public class ParseJavaDocMojo extends AbstractJavadocMojo {
     /**
      * @component
      */
-    private MavenProjectBuilder mavenProjectBuilder;
+    @SuppressWarnings("deprecation")
+    private org.apache.maven.project.MavenProjectBuilder mavenProjectBuilder;
 
     /**
      * @component
      */
-    private ArtifactMetadataSource artifactMetadataSource;
+    @SuppressWarnings("deprecation")
+    private org.apache.maven.artifact.metadata.ArtifactMetadataSource artifactMetadataSource;
 
     /**
      * @component

http://git-wip-us.apache.org/repos/asf/cxf/blob/c1c9562b/maven-plugins/java2ws-plugin/pom.xml
----------------------------------------------------------------------
diff --git a/maven-plugins/java2ws-plugin/pom.xml b/maven-plugins/java2ws-plugin/pom.xml
index e6ced8f..73c8ede 100644
--- a/maven-plugins/java2ws-plugin/pom.xml
+++ b/maven-plugins/java2ws-plugin/pom.xml
@@ -42,18 +42,12 @@
         </dependency>
         <dependency>
             <groupId>org.apache.maven</groupId>
-            <artifactId>maven-project</artifactId>
+            <artifactId>maven-artifact</artifactId>
             <scope>provided</scope>
-            <exclusions>
-                <exclusion>
-                    <groupId>org.codehaus.plexus</groupId>
-                    <artifactId>plexus-utils</artifactId>
-                </exclusion>
-            </exclusions>
         </dependency>
         <dependency>
             <groupId>org.apache.maven</groupId>
-            <artifactId>maven-artifact</artifactId>
+            <artifactId>maven-core</artifactId>
             <scope>provided</scope>
         </dependency>
         <dependency>

http://git-wip-us.apache.org/repos/asf/cxf/blob/c1c9562b/maven-plugins/java2ws-plugin/src/main/java/org/apache/cxf/maven_plugin/ClassLoaderSwitcher.java
----------------------------------------------------------------------
diff --git a/maven-plugins/java2ws-plugin/src/main/java/org/apache/cxf/maven_plugin/ClassLoaderSwitcher.java
b/maven-plugins/java2ws-plugin/src/main/java/org/apache/cxf/maven_plugin/ClassLoaderSwitcher.java
index 0f8ca2c..d411616 100644
--- a/maven-plugins/java2ws-plugin/src/main/java/org/apache/cxf/maven_plugin/ClassLoaderSwitcher.java
+++ b/maven-plugins/java2ws-plugin/src/main/java/org/apache/cxf/maven_plugin/ClassLoaderSwitcher.java
@@ -76,6 +76,7 @@ public class ClassLoaderSwitcher {
         }
 
         buf.append(File.pathSeparatorChar);
+        @SuppressWarnings("deprecation")
         List<?> artifacts = useCompileClasspath ? project.getCompileArtifacts() : project.getTestArtifacts();
         for (Artifact a : CastUtils.cast(artifacts, Artifact.class)) {
             try {

http://git-wip-us.apache.org/repos/asf/cxf/blob/c1c9562b/maven-plugins/wadl2java-plugin/pom.xml
----------------------------------------------------------------------
diff --git a/maven-plugins/wadl2java-plugin/pom.xml b/maven-plugins/wadl2java-plugin/pom.xml
index 81f3dfd..ec501f3 100644
--- a/maven-plugins/wadl2java-plugin/pom.xml
+++ b/maven-plugins/wadl2java-plugin/pom.xml
@@ -56,11 +56,6 @@
             <scope>provided</scope>
         </dependency>
         <dependency>
-            <groupId>org.apache.maven</groupId>
-            <artifactId>maven-project</artifactId>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
             <groupId>org.codehaus.plexus</groupId>
             <artifactId>plexus-utils</artifactId>
             <version>2.0.5</version>

http://git-wip-us.apache.org/repos/asf/cxf/blob/c1c9562b/maven-plugins/wadl2java-plugin/src/main/java/org/apache/cxf/maven_plugin/common/ClassLoaderSwitcher.java
----------------------------------------------------------------------
diff --git a/maven-plugins/wadl2java-plugin/src/main/java/org/apache/cxf/maven_plugin/common/ClassLoaderSwitcher.java
b/maven-plugins/wadl2java-plugin/src/main/java/org/apache/cxf/maven_plugin/common/ClassLoaderSwitcher.java
index 21b13ef..9485fbd 100644
--- a/maven-plugins/wadl2java-plugin/src/main/java/org/apache/cxf/maven_plugin/common/ClassLoaderSwitcher.java
+++ b/maven-plugins/wadl2java-plugin/src/main/java/org/apache/cxf/maven_plugin/common/ClassLoaderSwitcher.java
@@ -84,6 +84,7 @@ public class ClassLoaderSwitcher {
             ret.add(new File(project.getBuild().getOutputDirectory()).toURI());
             buf.append(File.pathSeparatorChar);
         }
+        @SuppressWarnings("deprecation")
         List<?> artifacts = useCompileClasspath ? project.getCompileArtifacts() : project.getTestArtifacts();
         for (Artifact a : CastUtils.cast(artifacts, Artifact.class)) {
             try {

http://git-wip-us.apache.org/repos/asf/cxf/blob/c1c9562b/maven-plugins/wadl2java-plugin/src/main/java/org/apache/cxf/maven_plugin/wadlto/AbstractCodeGeneratorMojo.java
----------------------------------------------------------------------
diff --git a/maven-plugins/wadl2java-plugin/src/main/java/org/apache/cxf/maven_plugin/wadlto/AbstractCodeGeneratorMojo.java
b/maven-plugins/wadl2java-plugin/src/main/java/org/apache/cxf/maven_plugin/wadlto/AbstractCodeGeneratorMojo.java
index 9b06164..fe5454d 100644
--- a/maven-plugins/wadl2java-plugin/src/main/java/org/apache/cxf/maven_plugin/wadlto/AbstractCodeGeneratorMojo.java
+++ b/maven-plugins/wadl2java-plugin/src/main/java/org/apache/cxf/maven_plugin/wadlto/AbstractCodeGeneratorMojo.java
@@ -41,19 +41,14 @@ import org.apache.cxf.maven_plugin.common.ForkOnceCodeGenerator;
 import org.apache.cxf.tools.common.ToolContext;
 import org.apache.cxf.tools.wadlto.WADLToJava;
 import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.InvalidRepositoryException;
-import org.apache.maven.artifact.factory.ArtifactFactory;
-import org.apache.maven.artifact.repository.ArtifactRepository;
-import org.apache.maven.artifact.repository.ArtifactRepositoryFactory;
-import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
-import org.apache.maven.artifact.resolver.ArtifactResolutionException;
-import org.apache.maven.artifact.resolver.ArtifactResolver;
+import org.apache.maven.artifact.resolver.ArtifactResolutionRequest;
+import org.apache.maven.artifact.resolver.ArtifactResolutionResult;
 import org.apache.maven.execution.MavenSession;
 import org.apache.maven.model.Resource;
 import org.apache.maven.plugin.AbstractMojo;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.project.MavenProject;
-import org.apache.maven.project.ProjectUtils;
+import org.apache.maven.repository.RepositorySystem;
 import org.codehaus.plexus.archiver.jar.JarArchiver;
 import org.codehaus.plexus.archiver.jar.Manifest;
 import org.codehaus.plexus.archiver.jar.Manifest.Attribute;
@@ -159,42 +154,6 @@ public abstract class AbstractCodeGeneratorMojo extends AbstractMojo
{
     String fork;
     
     /**
-     * The local repository taken from Maven's runtime. Typically $HOME/.m2/repository.
-     * 
-     * @parameter expression="${localRepository}"
-     * @readonly
-     * @required
-     */
-    private ArtifactRepository localRepository;
-
-    /**
-     * Artifact factory, needed to create artifacts.
-     * 
-     * @component
-     * @readonly
-     * @required
-     */
-    private ArtifactFactory artifactFactory;
-
-    /**
-     * The remote repositories used as specified in your POM.
-     * 
-     * @parameter expression="${project.repositories}"
-     * @readonly
-     * @required
-     */
-    private List<?> repositories;
-
-    /**
-     * Artifact repository factory component.
-     * 
-     * @component
-     * @readonly
-     * @required
-     */
-    private ArtifactRepositoryFactory artifactRepositoryFactory;
-
-    /**
      * The Maven session.
      * 
      * @parameter expression="${session}"
@@ -204,13 +163,6 @@ public abstract class AbstractCodeGeneratorMojo extends AbstractMojo
{
     private MavenSession mavenSession;
 
     /**
-     * @component
-     * @readonly
-     * @required
-     */
-    private ArtifactResolver artifactResolver;
-
-    /**
      * The plugin dependencies, needed for the fork mode.
      *
      * @parameter expression="${plugin.artifacts}"
@@ -236,6 +188,14 @@ public abstract class AbstractCodeGeneratorMojo extends AbstractMojo
{
      */
     private String additionalJvmArgs;
     
+    /**
+     * @component
+     * @readonly
+     * @required
+     */
+    private RepositorySystem repositorySystem;
+    
+    
     private ClassLoader resourceClassLoader;
     
     /**
@@ -245,15 +205,14 @@ public abstract class AbstractCodeGeneratorMojo extends AbstractMojo
{
      * @param options
      */
     
-    @SuppressWarnings("unchecked")
-    private Artifact resolveRemoteWadlArtifact(List<?> remoteRepos, Artifact artifact)
+    private Artifact resolveRemoteWadlArtifact(Artifact artifact)
         throws MojoExecutionException {
         
         /**
          * First try to find the artifact in the reactor projects of the maven session.
          * So an artifact that is not yet built can be resolved
          */
-        List<MavenProject> rProjects = mavenSession.getSortedProjects();
+        List<MavenProject> rProjects = mavenSession.getProjects();
         for (MavenProject rProject : rProjects) {
             if (artifact.getGroupId().equals(rProject.getGroupId())
                 && artifact.getArtifactId().equals(rProject.getArtifactId()) 
@@ -267,38 +226,32 @@ public abstract class AbstractCodeGeneratorMojo extends AbstractMojo
{
             }
         }
         
-        /**
-         * If this did not work resolve the artifact using the artifactResolver
-         */
-        try {
-            artifactResolver.resolve(artifact, remoteRepos, localRepository);
-        } catch (ArtifactResolutionException e) {
-            throw new MojoExecutionException("Error downloading wadl artifact.", e);
-        } catch (ArtifactNotFoundException e) {
-            throw new MojoExecutionException("Resource can not be found.", e);
-        }
-        
-        return artifact;
+        ArtifactResolutionRequest request = new ArtifactResolutionRequest();
+        request.setArtifact(artifact);
+        request.setResolveRoot(true).setResolveTransitively(false);
+        request.setServers(mavenSession.getRequest().getServers());
+        request.setMirrors(mavenSession.getRequest().getMirrors());
+        request.setProxies(mavenSession.getRequest().getProxies());
+        request.setLocalRepository(mavenSession.getLocalRepository());
+        request.setRemoteRepositories(mavenSession.getRequest().getRemoteRepositories());
           
+        ArtifactResolutionResult result = repositorySystem.resolve(request);
+            
+        return result.getOriginatingArtifact();
     }
 
     protected void downloadRemoteDocs(List<WadlOption> effectiveOptions) throws MojoExecutionException
{
-        List<?> remoteRepos;
-        try {
-            remoteRepos = ProjectUtils.buildArtifactRepositories(repositories, artifactRepositoryFactory,
-                                                                 mavenSession.getContainer());
-        } catch (InvalidRepositoryException e) {
-            throw new MojoExecutionException("Error build repositories for remote wadls",
e);
-        }
         
         for (WadlOption option : effectiveOptions) {
             DocumentArtifact wadlA = option.getWadlArtifact();
             if (wadlA == null) {
                 return;
             }
-            Artifact wadlArtifact = artifactFactory.createArtifact(wadlA.getGroupId(), wadlA.getArtifactId(),
-                                                                   wadlA.getVersion(),
-                                                                   Artifact.SCOPE_COMPILE,
wadlA.getType());
-            wadlArtifact = resolveRemoteWadlArtifact(remoteRepos, wadlArtifact);
+            Artifact wadlArtifact = repositorySystem.createArtifact(wadlA.getGroupId(),
+                                                                    wadlA.getArtifactId(),
+                                                                    wadlA.getVersion(), 
+                                                                    wadlA.getType());
+
+            wadlArtifact = resolveRemoteWadlArtifact(wadlArtifact);
             if (wadlArtifact != null) {
                 String path = wadlArtifact.getFile().getAbsolutePath();
                 getLog().info("Resolved WADL artifact to file " + path);

http://git-wip-us.apache.org/repos/asf/cxf/blob/c1c9562b/maven-plugins/wadl2java-plugin/src/main/java/org/apache/cxf/maven_plugin/wadlto/OptionLoader.java
----------------------------------------------------------------------
diff --git a/maven-plugins/wadl2java-plugin/src/main/java/org/apache/cxf/maven_plugin/wadlto/OptionLoader.java
b/maven-plugins/wadl2java-plugin/src/main/java/org/apache/cxf/maven_plugin/wadlto/OptionLoader.java
index c94e7af..b789eb2 100644
--- a/maven-plugins/wadl2java-plugin/src/main/java/org/apache/cxf/maven_plugin/wadlto/OptionLoader.java
+++ b/maven-plugins/wadl2java-plugin/src/main/java/org/apache/cxf/maven_plugin/wadlto/OptionLoader.java
@@ -41,7 +41,6 @@ public final class OptionLoader {
     private OptionLoader() {
     }
     
-    @SuppressWarnings("unchecked")
     public static List<WadlOption> loadWsdlOptionsFromDependencies(MavenProject project,

                                                                    Option defaultOptions,
File outputDir) {
         List<WadlOption> options = new ArrayList<WadlOption>();

http://git-wip-us.apache.org/repos/asf/cxf/blob/c1c9562b/maven-plugins/wsdl-validator-plugin/pom.xml
----------------------------------------------------------------------
diff --git a/maven-plugins/wsdl-validator-plugin/pom.xml b/maven-plugins/wsdl-validator-plugin/pom.xml
index 77a8930..12658aa 100644
--- a/maven-plugins/wsdl-validator-plugin/pom.xml
+++ b/maven-plugins/wsdl-validator-plugin/pom.xml
@@ -42,11 +42,6 @@
         </dependency>
         <dependency>
             <groupId>org.apache.maven</groupId>
-            <artifactId>maven-project</artifactId>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.maven</groupId>
             <artifactId>maven-artifact</artifactId>
             <scope>provided</scope>
         </dependency>

http://git-wip-us.apache.org/repos/asf/cxf/blob/c1c9562b/parent/pom.xml
----------------------------------------------------------------------
diff --git a/parent/pom.xml b/parent/pom.xml
index 2439e10..2c7f787 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -114,7 +114,7 @@
         <cxf.jetty.osgi.version>[8.1,10)</cxf.jetty.osgi.version>
         <cxf.jibx.version>1.2.5</cxf.jibx.version>
         <cxf.junit.version>4.11</cxf.junit.version>
-        <cxf.maven.core.version>2.2.1</cxf.maven.core.version>
+        <cxf.maven.core.version>3.0.5</cxf.maven.core.version>
         <cxf.msv.version>2013.6.1</cxf.msv.version>
         <cxf.neethi.version>3.0.3</cxf.neethi.version>
         <cxf.netty.version>4.0.19.Final</cxf.netty.version>
@@ -697,6 +697,11 @@
             </dependency>
             <dependency>
                 <groupId>org.apache.maven</groupId>
+                <artifactId>maven-compat</artifactId>
+                <version>${cxf.maven.core.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.apache.maven</groupId>
                 <artifactId>maven-plugin-api</artifactId>
                 <version>${cxf.maven.core.version}</version>
                 <scope>provided</scope>
@@ -752,18 +757,6 @@
             </dependency>
             <dependency>
                 <groupId>org.apache.maven</groupId>
-                <artifactId>maven-project</artifactId>
-                <version>${cxf.maven.core.version}</version>
-                <scope>provided</scope>
-                <exclusions>
-                    <exclusion>
-                        <groupId>junit</groupId>
-                        <artifactId>junit</artifactId>
-                    </exclusion>
-                </exclusions>
-            </dependency>
-            <dependency>
-                <groupId>org.apache.maven</groupId>
                 <artifactId>maven-artifact</artifactId>
                 <scope>provided</scope>
                 <version>${cxf.maven.core.version}</version>


Mime
View raw message