Author: lcorneliussen
Date: Fri May  4 14:14:55 2012
New Revision: 1333977

URL: http://svn.apache.org/viewvc?rev=1333977&view=rev
Log:
[NPANDAY-231] Remove RDF repository and model

o created own (quite simple!) impl of copy-dependencies
o refactored from intercepting ArtifactFilter to ResolutionListener
o resolving 'test' in compile:initialize; sadly

Added:
    
incubator/npanday/trunk/components/dotnet-core/src/main/java/npanday/resolver/NPandayResolutionListener.java
    
incubator/npanday/trunk/components/dotnet-core/src/main/java/npanday/resolver/filter/
    
incubator/npanday/trunk/components/dotnet-core/src/main/java/npanday/resolver/filter/DotnetExecutableArtifactFilter.java
    
incubator/npanday/trunk/components/dotnet-core/src/main/java/npanday/resolver/filter/DotnetLibraryArtifactFilter.java
    
incubator/npanday/trunk/components/dotnet-core/src/main/java/npanday/resolver/filter/OrArtifactFilter.java
    
incubator/npanday/trunk/plugins/maven-resolver-plugin/src/main/java/npanday/plugin/resolver/CopyDependenciesMojo.java
    
incubator/npanday/trunk/plugins/maven-resolver-plugin/src/main/java/npanday/plugin/resolver/ResolveMojo.java
   (contents, props changed)
      - copied, changed from r1333351, 
incubator/npanday/trunk/plugins/maven-resolver-plugin/src/main/java/npanday/plugin/resolver/NPandayEarlyResolverMojo.java
Removed:
    
incubator/npanday/trunk/plugins/maven-resolver-plugin/src/main/java/npanday/plugin/resolver/NPandayEarlyResolverMojo.java
Modified:
    
incubator/npanday/trunk/components/dotnet-core/src/main/java/npanday/resolver/DefaultNPandayArtifactResolver.java
    
incubator/npanday/trunk/components/dotnet-core/src/main/java/npanday/resolver/NPandayDependencyResolution.java
    
incubator/npanday/trunk/components/dotnet-core/src/main/java/npanday/resolver/resolvers/GacResolver.java
    
incubator/npanday/trunk/plugins/maven-aspx-plugin/src/main/java/npanday/plugin/aspx/AspxBinDependencyResolver.java
    
incubator/npanday/trunk/plugins/maven-compile-plugin/src/main/java/npanday/plugin/compile/ComponentInitializerMojo.java

Modified: 
incubator/npanday/trunk/components/dotnet-core/src/main/java/npanday/resolver/DefaultNPandayArtifactResolver.java
URL: 
http://svn.apache.org/viewvc/incubator/npanday/trunk/components/dotnet-core/src/main/java/npanday/resolver/DefaultNPandayArtifactResolver.java?rev=1333977&r1=1333976&r2=1333977&view=diff
==============================================================================
--- 
incubator/npanday/trunk/components/dotnet-core/src/main/java/npanday/resolver/DefaultNPandayArtifactResolver.java
 (original)
+++ 
incubator/npanday/trunk/components/dotnet-core/src/main/java/npanday/resolver/DefaultNPandayArtifactResolver.java
 Fri May  4 14:14:55 2012
@@ -19,6 +19,7 @@
 
 package npanday.resolver;
 
+import com.google.common.collect.Lists;
 import com.google.common.collect.Sets;
 import npanday.resolver.resolvers.GacResolver;
 import org.apache.maven.artifact.Artifact;
@@ -29,6 +30,7 @@ import org.apache.maven.artifact.resolve
 import org.apache.maven.artifact.resolver.ArtifactResolutionResult;
 import org.apache.maven.artifact.resolver.ArtifactResolver;
 import org.apache.maven.artifact.resolver.DebugResolutionListener;
+import org.apache.maven.artifact.resolver.ResolutionListener;
 import org.apache.maven.artifact.resolver.WarningResolutionListener;
 import org.apache.maven.artifact.resolver.filter.AndArtifactFilter;
 import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
@@ -64,6 +66,8 @@ public class DefaultNPandayArtifactResol
 
     private PlexusContainer container;
 
+    NPandayResolutionListener listener;
+
     private Set<Artifact> customResolveCache = Sets.newHashSet();
 
     public void resolve( Artifact artifact, List remoteRepositories, 
ArtifactRepository localRepository ) throws
@@ -94,7 +98,8 @@ public class DefaultNPandayArtifactResol
         ArtifactResolutionException,
         ArtifactNotFoundException
     {
-        filter = intercept( filter );
+        listeners = intercept( listeners );
+
 
         return original.resolveTransitively(
             artifacts, originatingArtifact, managedVersions, localRepository, 
remoteRepositories, source, filter,
@@ -102,7 +107,24 @@ public class DefaultNPandayArtifactResol
         );
     }
 
-    private void runCustomResolvers( Artifact artifact )
+
+
+    private List intercept( List listeners )
+    {
+        if (listeners == null)
+            listeners = Lists.newArrayList();
+
+        listeners.add( listener );
+
+        return listeners;
+    }
+
+    public void contextualize( Context context ) throws ContextException
+    {
+        container = (PlexusContainer) context.get( PlexusConstants.PLEXUS_KEY 
);
+    }
+
+    protected void runCustomResolvers( Artifact artifact ) throws 
ArtifactNotFoundException
     {
         if ( contributors == null || contributors.length == 0 )
         {
@@ -136,33 +158,11 @@ public class DefaultNPandayArtifactResol
         }
     }
 
-    private ArtifactFilter intercept( ArtifactFilter filter )
-    {
-        AndArtifactFilter andArtifactFilter = new AndArtifactFilter();
-        if ( filter != null )
-        {
-            andArtifactFilter.add( filter );
-        }
-        andArtifactFilter.add(
-            new ArtifactFilter()
-            {
-                public boolean include( Artifact artifact )
-                {
-                    runCustomResolvers( artifact );
-                    return true;
-                }
-            }
-        );
-        return andArtifactFilter;
-    }
-
-    public void contextualize( Context context ) throws ContextException
-    {
-        container = (PlexusContainer) context.get( PlexusConstants.PLEXUS_KEY 
);
-    }
-
     public void initialize() throws InitializationException
     {
+        listener = new NPandayResolutionListener(this);
+        listener.enableLogging( getLogger() );
+
         try
         {
             List list = container.lookupList(

Modified: 
incubator/npanday/trunk/components/dotnet-core/src/main/java/npanday/resolver/NPandayDependencyResolution.java
URL: 
http://svn.apache.org/viewvc/incubator/npanday/trunk/components/dotnet-core/src/main/java/npanday/resolver/NPandayDependencyResolution.java?rev=1333977&r1=1333976&r2=1333977&view=diff
==============================================================================
--- 
incubator/npanday/trunk/components/dotnet-core/src/main/java/npanday/resolver/NPandayDependencyResolution.java
 (original)
+++ 
incubator/npanday/trunk/components/dotnet-core/src/main/java/npanday/resolver/NPandayDependencyResolution.java
 Fri May  4 14:14:55 2012
@@ -30,6 +30,7 @@ import org.apache.maven.artifact.reposit
 import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
 import org.apache.maven.artifact.resolver.ArtifactResolutionException;
 import org.apache.maven.artifact.resolver.ArtifactResolutionResult;
+import org.apache.maven.artifact.resolver.filter.AndArtifactFilter;
 import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
 import org.apache.maven.artifact.resolver.filter.ScopeArtifactFilter;
 import 
org.apache.maven.artifact.versioning.InvalidVersionSpecificationException;
@@ -54,9 +55,25 @@ public class NPandayDependencyResolution
     private ArtifactFactory artifactFactory;
     private ArtifactMetadataSource metaDataSource;
 
-    public void require(MavenProject project, ArtifactRepository 
localRepository, String scope) throws
+    public Set<Artifact> require(MavenProject project, ArtifactRepository 
localRepository, String scope) throws
         ArtifactResolutionException
     {
+        ArtifactFilter scopeFilter = null;
+        if ( !Strings.isNullOrEmpty( scope )){
+            scopeFilter = new ScopeArtifactFilter( scope );
+        }
+
+        return require( project, localRepository, scopeFilter );
+    }
+
+    public Set<Artifact> require(
+        MavenProject project, ArtifactRepository localRepository, 
ArtifactFilter filter ) throws
+        ArtifactResolutionException
+    {
+        if (getLogger().isDebugEnabled()) {
+            getLogger().debug( "NPANDAY-148-007: Resolving dependencies for " 
+ project.getArtifact() );
+        }
+
         try
         {
             if ( project.getDependencyArtifacts() == null )
@@ -64,15 +81,10 @@ public class NPandayDependencyResolution
                 createArtifactsForMaven2BackCompat( project );
             }
 
-            ArtifactFilter scopeFilter = null;
-            if ( !Strings.isNullOrEmpty( scope )){
-                scopeFilter = new ScopeArtifactFilter( scope );
-            }
-
             ArtifactResolutionResult result = 
artifactResolver.resolveTransitively(
                 project.getDependencyArtifacts(), project.getArtifact(), 
project.getManagedVersionMap(),
                 localRepository, project.getRemoteArtifactRepositories(), 
metaDataSource,
-                scopeFilter
+                filter
             );
 
             /*
@@ -82,6 +94,8 @@ public class NPandayDependencyResolution
             * */
 
             addResolvedSpecialsToProjectDependencies( project, result );
+
+            return result.getArtifacts();
         }
         catch ( ArtifactResolutionException e )
         {
@@ -109,19 +123,19 @@ public class NPandayDependencyResolution
             Artifact a = (Artifact) ao;
             if ( !project.getDependencyArtifacts().contains( a ) )
             {
-                getLogger().info( "NPANDAY-184-005: Adding custom resolved " + 
a + " to project.dependencyArtifacts" );
+                getLogger().info( "NPANDAY-148-005: Adding custom resolved " + 
a + " to project.dependencyArtifacts" );
 
                 project.getDependencyArtifacts().add( a );
             }
-            else
-            {
-                getLogger().info( "NPANDAY-184-006: " + a + " is yet in 
project.dependencyArtifacts" );
-            }
         }
     }
 
     private void createArtifactsForMaven2BackCompat( MavenProject project ) 
throws InvalidVersionSpecificationException
     {
+        if (getLogger().isDebugEnabled()) {
+            getLogger().debug( "NPANDAY-148-008: creating dependency 
collection for maven 2 projects" );
+        }
+
         project.setDependencyArtifacts( Sets.newHashSet() );
         for ( Object o : project.getDependencies() )
         {

Added: 
incubator/npanday/trunk/components/dotnet-core/src/main/java/npanday/resolver/NPandayResolutionListener.java
URL: 
http://svn.apache.org/viewvc/incubator/npanday/trunk/components/dotnet-core/src/main/java/npanday/resolver/NPandayResolutionListener.java?rev=1333977&view=auto
==============================================================================
--- 
incubator/npanday/trunk/components/dotnet-core/src/main/java/npanday/resolver/NPandayResolutionListener.java
 (added)
+++ 
incubator/npanday/trunk/components/dotnet-core/src/main/java/npanday/resolver/NPandayResolutionListener.java
 Fri May  4 14:14:55 2012
@@ -0,0 +1,93 @@
+/*
+ * 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.
+ */
+
+package npanday.resolver;
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
+import org.apache.maven.artifact.resolver.ResolutionListener;
+import org.apache.maven.artifact.versioning.VersionRange;
+import org.codehaus.plexus.logging.AbstractLogEnabled;
+
+/**
+ * @author <a href="mailto:[email protected]>Lars Corneliussen, Faktum 
Software</a>
+ */
+public class NPandayResolutionListener
+    extends AbstractLogEnabled
+    implements ResolutionListener
+{
+    private DefaultNPandayArtifactResolver resolver;
+
+    public NPandayResolutionListener( DefaultNPandayArtifactResolver resolver )
+    {
+        this.resolver = resolver;
+    }
+
+    public void testArtifact( Artifact node )
+    {
+        try
+        {
+            resolver.runCustomResolvers( node );
+        }
+        catch ( ArtifactNotFoundException e )
+        {
+            throw new RuntimeException( "NPANDAY-159-000: Error finding 
artifact " + node, e );
+        }
+    }
+
+    public void startProcessChildren( Artifact artifact )
+    {
+    }
+
+    public void endProcessChildren( Artifact artifact )
+    {
+    }
+
+    public void includeArtifact( Artifact artifact )
+    {
+    }
+
+    public void omitForNearer( Artifact omitted, Artifact kept )
+    {
+    }
+
+    public void updateScope( Artifact artifact, String scope )
+    {
+    }
+
+    public void manageArtifact( Artifact artifact, Artifact replacement )
+    {
+    }
+
+    public void omitForCycle( Artifact artifact )
+    {
+    }
+
+    public void updateScopeCurrentPom( Artifact artifact, String ignoredScope )
+    {
+    }
+
+    public void selectVersionFromRange( Artifact artifact )
+    {
+    }
+
+    public void restrictRange( Artifact artifact, Artifact replacement, 
VersionRange newRange )
+    {
+    }
+}

Added: 
incubator/npanday/trunk/components/dotnet-core/src/main/java/npanday/resolver/filter/DotnetExecutableArtifactFilter.java
URL: 
http://svn.apache.org/viewvc/incubator/npanday/trunk/components/dotnet-core/src/main/java/npanday/resolver/filter/DotnetExecutableArtifactFilter.java?rev=1333977&view=auto
==============================================================================
--- 
incubator/npanday/trunk/components/dotnet-core/src/main/java/npanday/resolver/filter/DotnetExecutableArtifactFilter.java
 (added)
+++ 
incubator/npanday/trunk/components/dotnet-core/src/main/java/npanday/resolver/filter/DotnetExecutableArtifactFilter.java
 Fri May  4 14:14:55 2012
@@ -0,0 +1,36 @@
+/*
+ * 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.
+ */
+
+package npanday.resolver.filter;
+
+import npanday.ArtifactTypeHelper;
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
+
+/**
+ * @author <a href="[email protected]">Lars Corneliussen, Faktum 
Software</a>
+ */
+public class DotnetExecutableArtifactFilter
+    implements ArtifactFilter
+{
+    public boolean include( Artifact artifact )
+    {
+        return ArtifactTypeHelper.isDotnetExecutable( artifact.getType() );
+    }
+}

Added: 
incubator/npanday/trunk/components/dotnet-core/src/main/java/npanday/resolver/filter/DotnetLibraryArtifactFilter.java
URL: 
http://svn.apache.org/viewvc/incubator/npanday/trunk/components/dotnet-core/src/main/java/npanday/resolver/filter/DotnetLibraryArtifactFilter.java?rev=1333977&view=auto
==============================================================================
--- 
incubator/npanday/trunk/components/dotnet-core/src/main/java/npanday/resolver/filter/DotnetLibraryArtifactFilter.java
 (added)
+++ 
incubator/npanday/trunk/components/dotnet-core/src/main/java/npanday/resolver/filter/DotnetLibraryArtifactFilter.java
 Fri May  4 14:14:55 2012
@@ -0,0 +1,36 @@
+/*
+ * 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.
+ */
+
+package npanday.resolver.filter;
+
+import npanday.ArtifactTypeHelper;
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
+
+/**
+ * @author <a href="[email protected]">Lars Corneliussen, Faktum 
Software</a>
+ */
+public class DotnetLibraryArtifactFilter
+    implements ArtifactFilter
+{
+    public boolean include( Artifact artifact )
+    {
+        return ArtifactTypeHelper.isDotnetLibrary( artifact.getType() );
+    }
+}

Added: 
incubator/npanday/trunk/components/dotnet-core/src/main/java/npanday/resolver/filter/OrArtifactFilter.java
URL: 
http://svn.apache.org/viewvc/incubator/npanday/trunk/components/dotnet-core/src/main/java/npanday/resolver/filter/OrArtifactFilter.java?rev=1333977&view=auto
==============================================================================
--- 
incubator/npanday/trunk/components/dotnet-core/src/main/java/npanday/resolver/filter/OrArtifactFilter.java
 (added)
+++ 
incubator/npanday/trunk/components/dotnet-core/src/main/java/npanday/resolver/filter/OrArtifactFilter.java
 Fri May  4 14:14:55 2012
@@ -0,0 +1,57 @@
+/*
+ * 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.
+ */
+
+package npanday.resolver.filter;
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * One of many must apply.
+ *
+ * @author <a href="[email protected]">Lars Corneliussen, Faktum 
Software</a>
+ */
+public class OrArtifactFilter
+    implements ArtifactFilter
+{
+    private final List filters = new ArrayList();
+
+    public boolean include( Artifact artifact )
+    {
+        for ( Object oFilter : filters )
+        {
+            ArtifactFilter filter = (ArtifactFilter) oFilter;
+            if ( filter.include( artifact ) )
+            {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    public void add( ArtifactFilter artifactFilter )
+    {
+        filters.add( artifactFilter );
+    }
+}
+

Modified: 
incubator/npanday/trunk/components/dotnet-core/src/main/java/npanday/resolver/resolvers/GacResolver.java
URL: 
http://svn.apache.org/viewvc/incubator/npanday/trunk/components/dotnet-core/src/main/java/npanday/resolver/resolvers/GacResolver.java?rev=1333977&r1=1333976&r2=1333977&view=diff
==============================================================================
--- 
incubator/npanday/trunk/components/dotnet-core/src/main/java/npanday/resolver/resolvers/GacResolver.java
 (original)
+++ 
incubator/npanday/trunk/components/dotnet-core/src/main/java/npanday/resolver/resolvers/GacResolver.java
 Fri May  4 14:14:55 2012
@@ -19,9 +19,9 @@
 
 package npanday.resolver.resolvers;
 
-import npanday.resolver.ArtifactResolvingContributor;
 import npanday.ArtifactTypeHelper;
 import npanday.PathUtil;
+import npanday.resolver.ArtifactResolvingContributor;
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
 
@@ -30,37 +30,41 @@ import java.util.Set;
 
 /**
  * @author <a href="mailto:[email protected]>Lars Corneliussen, Faktum 
Software</a>
- *
  */
 public class GacResolver
     implements ArtifactResolvingContributor
 {
-    public void contribute(Artifact artifact, Set<Artifact> 
additionalDependenciesCollector ) throws
+    public void contribute( Artifact artifact, Set<Artifact> 
additionalDependenciesCollector ) throws
         ArtifactNotFoundException
     {
 
         File artifactFile = null;
         String artifactType = artifact.getType();
 
-        if ( ArtifactTypeHelper.isDotnetAnyGac( artifactType ))
+        if ( ArtifactTypeHelper.isDotnetAnyGac( artifactType ) )
         {
-            if (!ArtifactTypeHelper.isDotnet4Gac(artifactType))
+            if ( !ArtifactTypeHelper.isDotnet4Gac( artifactType ) )
             {
-                artifactFile = PathUtil.getGlobalAssemblyCacheFileFor( 
artifact, new File( "C:\\WINDOWS\\assembly\\" ) );
+                artifactFile = PathUtil.getGlobalAssemblyCacheFileFor(
+                    artifact, new File( "C:\\WINDOWS\\assembly\\" )
+                );
             }
             else
             {
-                artifactFile = PathUtil.getGACFile4Artifact(artifact);
+                artifactFile = PathUtil.getGACFile4Artifact( artifact );
             }
-        }
 
-        if (artifactFile != null) {
-            if (artifactFile.exists()) {
+            if ( artifactFile.exists() )
+            {
                 artifact.setFile( artifactFile );
                 artifact.setResolved( true );
             }
-            else{
-               throw new ArtifactNotFoundException("NPANDAY-158-001: Could not 
resolve gac-dependency " + artifact + ", tried " + artifactFile, artifact);
+            else
+            {
+                throw new ArtifactNotFoundException(
+                    "NPANDAY-158-001: Could not resolve gac-dependency " + 
artifact + ", tried " + artifactFile,
+                    artifact
+                );
             }
         }
 

Modified: 
incubator/npanday/trunk/plugins/maven-aspx-plugin/src/main/java/npanday/plugin/aspx/AspxBinDependencyResolver.java
URL: 
http://svn.apache.org/viewvc/incubator/npanday/trunk/plugins/maven-aspx-plugin/src/main/java/npanday/plugin/aspx/AspxBinDependencyResolver.java?rev=1333977&r1=1333976&r2=1333977&view=diff
==============================================================================
--- 
incubator/npanday/trunk/plugins/maven-aspx-plugin/src/main/java/npanday/plugin/aspx/AspxBinDependencyResolver.java
 (original)
+++ 
incubator/npanday/trunk/plugins/maven-aspx-plugin/src/main/java/npanday/plugin/aspx/AspxBinDependencyResolver.java
 Fri May  4 14:14:55 2012
@@ -1,5 +1,3 @@
-package npanday.plugin.aspx;
-
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -19,6 +17,8 @@ package npanday.plugin.aspx;
  * under the License.
  */
 
+package npanday.plugin.aspx;
+
 import npanday.LocalRepositoryUtil;
 import npanday.PathUtil;
 import npanday.resolver.NPandayDependencyResolution;

Modified: 
incubator/npanday/trunk/plugins/maven-compile-plugin/src/main/java/npanday/plugin/compile/ComponentInitializerMojo.java
URL: 
http://svn.apache.org/viewvc/incubator/npanday/trunk/plugins/maven-compile-plugin/src/main/java/npanday/plugin/compile/ComponentInitializerMojo.java?rev=1333977&r1=1333976&r2=1333977&view=diff
==============================================================================
--- 
incubator/npanday/trunk/plugins/maven-compile-plugin/src/main/java/npanday/plugin/compile/ComponentInitializerMojo.java
 (original)
+++ 
incubator/npanday/trunk/plugins/maven-compile-plugin/src/main/java/npanday/plugin/compile/ComponentInitializerMojo.java
 Fri May  4 14:14:55 2012
@@ -20,7 +20,10 @@ package npanday.plugin.compile;
  */
 
 import npanday.InitializationException;
+import npanday.LocalRepositoryUtil;
 import npanday.assembler.AssemblerContext;
+import npanday.resolver.NPandayDependencyResolution;
+import org.apache.maven.artifact.resolver.ArtifactResolutionException;
 import org.apache.maven.plugin.AbstractMojo;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.project.MavenProject;
@@ -56,17 +59,30 @@ public class ComponentInitializerMojo
      */
     private File localRepository;
 
-
     /**
      * @component
      */
     private AssemblerContext assemblerContext;
 
+    /**
+     * @component
+     */
+    private NPandayDependencyResolution dependencyResolution;
+
     public void execute()
         throws MojoExecutionException
     {
-
-        getLog().warn( "NPANDAY-231: removed dependency resolution here!" );
+        // TODO: sadly we must resolve dependencies here because of 
'org.apache.maven.plugins:maven-remote-resources-plugin:1.2.1:process' running 
later
+        try
+        {
+            dependencyResolution.require( project, LocalRepositoryUtil.create( 
localRepository ), "test" );
+        }
+        catch ( ArtifactResolutionException e )
+        {
+            throw new MojoExecutionException(
+                "NPANDAY-901-003: Could not satisfy required dependencies for 
scope " + "test", e
+            );
+        }
 
         try
         {

Added: 
incubator/npanday/trunk/plugins/maven-resolver-plugin/src/main/java/npanday/plugin/resolver/CopyDependenciesMojo.java
URL: 
http://svn.apache.org/viewvc/incubator/npanday/trunk/plugins/maven-resolver-plugin/src/main/java/npanday/plugin/resolver/CopyDependenciesMojo.java?rev=1333977&view=auto
==============================================================================
--- 
incubator/npanday/trunk/plugins/maven-resolver-plugin/src/main/java/npanday/plugin/resolver/CopyDependenciesMojo.java
 (added)
+++ 
incubator/npanday/trunk/plugins/maven-resolver-plugin/src/main/java/npanday/plugin/resolver/CopyDependenciesMojo.java
 Fri May  4 14:14:55 2012
@@ -0,0 +1,165 @@
+/*
+ * 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.
+ */
+
+package npanday.plugin.resolver;
+
+import com.google.common.base.Strings;
+import npanday.LocalRepositoryUtil;
+import npanday.PathUtil;
+import npanday.registry.RepositoryRegistry;
+import npanday.resolver.NPandayDependencyResolution;
+import npanday.resolver.filter.DotnetExecutableArtifactFilter;
+import npanday.resolver.filter.DotnetLibraryArtifactFilter;
+import npanday.resolver.filter.OrArtifactFilter;
+import npanday.vendor.SettingsUtil;
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.resolver.ArtifactResolutionException;
+import org.apache.maven.artifact.resolver.filter.AndArtifactFilter;
+import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
+import org.apache.maven.artifact.resolver.filter.InversionArtifactFilter;
+import org.apache.maven.artifact.resolver.filter.ScopeArtifactFilter;
+import org.apache.maven.artifact.resolver.filter.TypeArtifactFilter;
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.project.MavenProject;
+import org.codehaus.plexus.util.FileUtils;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Set;
+
+/**
+ * Resolves and copies .NET assemblies.
+ *
+ * @author <a href="[email protected]">Lars Corneliussen, Faktum 
Software</a>
+ * @goal copy-dependencies
+ */
+public class CopyDependenciesMojo
+    extends AbstractMojo
+{
+    /**
+     * @parameter expression="${npanday.settings}" 
default-value="${user.home}/.m2"
+     */
+    private String settingsPath;
+
+    /**
+     * @component
+     */
+    private RepositoryRegistry repositoryRegistry;
+
+    /**
+     * The maven project.
+     *
+     * @parameter expression="${project}"
+     * @required
+     */
+    private MavenProject project;
+
+    /**
+     * The local Maven repository.
+     *
+     * @parameter expression="${settings.localRepository}"
+     */
+    private File localRepository;
+
+    /**
+     * @parameter default-value="compile"
+     */
+    private String includeScope;
+
+    /**
+     * @parameter
+     */
+    private String excludeScope;
+
+    /**
+     * @component
+     */
+    private NPandayDependencyResolution dependencyResolution;
+
+    /**
+     * @parameter default-value="${project.build.directory}\.dependencies"
+     */
+    private File outputDirectory;
+
+    /**
+     * @parameter default-value="false"
+     */
+    private boolean skip;
+
+    public void execute() throws MojoExecutionException, MojoFailureException
+    {
+        if ( skip )
+        {
+            getLog().info( "NPANDAY-158-001: Mojo for resolving dependencies 
was intentionally skipped" );
+            return;
+        }
+
+        SettingsUtil.applyCustomSettingsIfAvailable( getLog(), 
repositoryRegistry, settingsPath );
+
+        AndArtifactFilter includeFilter = new AndArtifactFilter();
+
+        OrArtifactFilter typeIncludes = new OrArtifactFilter();
+        typeIncludes.add( new DotnetExecutableArtifactFilter() );
+        typeIncludes.add( new DotnetLibraryArtifactFilter() );
+        includeFilter.add( typeIncludes );
+
+        if ( !Strings.isNullOrEmpty(includeScope))
+        {
+            includeFilter.add( new ScopeArtifactFilter( includeScope ) );
+        }
+
+        if ( !Strings.isNullOrEmpty(excludeScope))
+        {
+            includeFilter.add( new InversionArtifactFilter( new 
ScopeArtifactFilter( excludeScope ) ) );
+        }
+
+        Set<Artifact> artifacts;
+        try
+        {
+            artifacts = dependencyResolution.require(
+                project, LocalRepositoryUtil.create( localRepository ), 
includeFilter
+            );
+        }
+        catch ( ArtifactResolutionException e )
+        {
+            throw new MojoExecutionException( "NPANDAY-158-003: dependency 
resolution for scope " + includeScope + " failed!", e );
+        }
+
+
+        for (Artifact dependency : artifacts) {
+            if (!includeFilter.include( dependency )){
+                continue;
+            }
+
+            try {
+                File targetFile = new File(outputDirectory, 
PathUtil.getPlainArtifactFileName( dependency ));
+                if (!targetFile.exists()) {
+                    getLog().debug("NPANDAY-158-004: copy dependency " +  
dependency + " to " + targetFile);
+                    FileUtils.copyFile( dependency.getFile(), targetFile );
+                }
+            }
+            catch (IOException ioe) {
+                throw new MojoExecutionException("NPANDAY-158-005: Error 
copying dependency " + dependency, ioe);
+            }
+        }
+    }
+
+}

Copied: 
incubator/npanday/trunk/plugins/maven-resolver-plugin/src/main/java/npanday/plugin/resolver/ResolveMojo.java
 (from r1333351, 
incubator/npanday/trunk/plugins/maven-resolver-plugin/src/main/java/npanday/plugin/resolver/NPandayEarlyResolverMojo.java)
URL: 
http://svn.apache.org/viewvc/incubator/npanday/trunk/plugins/maven-resolver-plugin/src/main/java/npanday/plugin/resolver/ResolveMojo.java?p2=incubator/npanday/trunk/plugins/maven-resolver-plugin/src/main/java/npanday/plugin/resolver/ResolveMojo.java&p1=incubator/npanday/trunk/plugins/maven-resolver-plugin/src/main/java/npanday/plugin/resolver/NPandayEarlyResolverMojo.java&r1=1333351&r2=1333977&rev=1333977&view=diff
==============================================================================
--- 
incubator/npanday/trunk/plugins/maven-resolver-plugin/src/main/java/npanday/plugin/resolver/NPandayEarlyResolverMojo.java
 (original)
+++ 
incubator/npanday/trunk/plugins/maven-resolver-plugin/src/main/java/npanday/plugin/resolver/ResolveMojo.java
 Fri May  4 14:14:55 2012
@@ -52,7 +52,7 @@ import java.util.Set;
  * @author <a href="[email protected]">Lars Corneliussen, Faktum 
Software</a>
  * @goal resolve
  */
-public class NPandayEarlyResolverMojo
+public class ResolveMojo
     extends AbstractMojo
 {
     /**

Propchange: 
incubator/npanday/trunk/plugins/maven-resolver-plugin/src/main/java/npanday/plugin/resolver/ResolveMojo.java
------------------------------------------------------------------------------
    svn:eol-style = native


Reply via email to