You are viewing a plain text version of this content. The canonical link for it is here.
Posted to npanday-commits@incubator.apache.org by lc...@apache.org on 2012/05/04 10:57:59 UTC
svn commit: r1333872 - in /incubator/npanday/trunk:
components/dotnet-core/src/main/java/npanday/resolver/
plugins/azure-maven-plugin/src/main/java/npanday/plugin/azure/
plugins/maven-aspx-plugin/src/main/java/npanday/plugin/aspx/
plugins/maven-aspx-pl...
Author: lcorneliussen
Date: Fri May 4 10:57:58 2012
New Revision: 1333872
URL: http://svn.apache.org/viewvc?rev=1333872&view=rev
Log:
[NPANDAY-231] Remove RDF repository and model
o replaced maven dependency resolution with custom in many places
o removed default lifecycle binding for resolver-plugin
o removed tests from aspx-plugin, since they were only testing things that are now others' responsibilities
Removed:
incubator/npanday/trunk/plugins/maven-aspx-plugin/src/test/
Modified:
incubator/npanday/trunk/components/dotnet-core/src/main/java/npanday/resolver/ArtifactResolvingContributor.java
incubator/npanday/trunk/plugins/azure-maven-plugin/src/main/java/npanday/plugin/azure/CreateCloudServicePackageMojo.java
incubator/npanday/trunk/plugins/azure-maven-plugin/src/main/java/npanday/plugin/azure/ResolveWorkerRoleFilesMojo.java
incubator/npanday/trunk/plugins/maven-aspx-plugin/src/main/java/npanday/plugin/aspx/AspxBinDependencyResolver.java
incubator/npanday/trunk/plugins/maven-aspx-plugin/src/main/resources/META-INF/plexus/components.xml
incubator/npanday/trunk/plugins/maven-compile-plugin/src/main/groovy/npanday/plugin/compile/CompileLifecycleMap.groovy
incubator/npanday/trunk/plugins/maven-ilmerge-plugin/src/main/java/npanday/plugin/ilmerge/AssemblyMerger.java
incubator/npanday/trunk/plugins/netplugins/NPanday.Plugin.Msbuild/javabinding/src/main/java/NPanday/Plugin/Msbuild/MsbuildMojo.java
Modified: incubator/npanday/trunk/components/dotnet-core/src/main/java/npanday/resolver/ArtifactResolvingContributor.java
URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/components/dotnet-core/src/main/java/npanday/resolver/ArtifactResolvingContributor.java?rev=1333872&r1=1333871&r2=1333872&view=diff
==============================================================================
--- incubator/npanday/trunk/components/dotnet-core/src/main/java/npanday/resolver/ArtifactResolvingContributor.java (original)
+++ incubator/npanday/trunk/components/dotnet-core/src/main/java/npanday/resolver/ArtifactResolvingContributor.java Fri May 4 10:57:58 2012
@@ -20,6 +20,7 @@
package npanday.resolver;
import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
import java.util.Set;
@@ -36,5 +37,5 @@ public interface ArtifactResolvingContri
*
* @param artifact
*/
- void contribute(Artifact artifact, Set<Artifact> additionalDependenciesCollector );
+ void contribute(Artifact artifact, Set<Artifact> additionalDependenciesCollector ) throws ArtifactNotFoundException;
}
Modified: incubator/npanday/trunk/plugins/azure-maven-plugin/src/main/java/npanday/plugin/azure/CreateCloudServicePackageMojo.java
URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/plugins/azure-maven-plugin/src/main/java/npanday/plugin/azure/CreateCloudServicePackageMojo.java?rev=1333872&r1=1333871&r2=1333872&view=diff
==============================================================================
--- incubator/npanday/trunk/plugins/azure-maven-plugin/src/main/java/npanday/plugin/azure/CreateCloudServicePackageMojo.java (original)
+++ incubator/npanday/trunk/plugins/azure-maven-plugin/src/main/java/npanday/plugin/azure/CreateCloudServicePackageMojo.java Fri May 4 10:57:58 2012
@@ -21,8 +21,12 @@ package npanday.plugin.azure;
import com.google.common.collect.Lists;
import npanday.ArtifactType;
+import npanday.LocalRepositoryUtil;
import npanday.PathUtil;
+import npanday.resolver.NPandayDependencyResolution;
import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.resolver.ArtifactResolutionException;
+import org.apache.maven.artifact.resolver.filter.ScopeArtifactFilter;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.codehaus.plexus.util.IOUtil;
@@ -40,7 +44,6 @@ import java.util.Set;
*
* @author <a href="mailto:lcorneliussen@apache.org">Lars Corneliussen</a>
* @goal create-package
- * TODO requiresDependencyResolution runtime
*/
public class CreateCloudServicePackageMojo
extends AbstractCSPackDeployMojo
@@ -61,6 +64,39 @@ public class CreateCloudServicePackageMo
*/
private boolean generateConfigurationFile;
+ /**
+ * @component
+ */
+ private NPandayDependencyResolution dependencyResolution;
+
+ /**
+ * The scope up to which dependencies should be included.
+ *
+ * @parameter default-value="runtime"
+ */
+ private String scope;
+
+ /**
+ * The location of the local Maven repository.
+ *
+ * @parameter expression="${settings.localRepository}"
+ */
+ private File localRepository;
+
+ private void resolveDependencies() throws MojoExecutionException
+ {
+ try
+ {
+ dependencyResolution.require( project, LocalRepositoryUtil.create( localRepository ), scope );
+ }
+ catch ( ArtifactResolutionException e )
+ {
+ throw new MojoExecutionException(
+ "NPANDAY-131-004: Could not satisfy required dependencies of scope " + scope, e
+ );
+ }
+ }
+
@Override
protected void afterCommandExecution() throws MojoExecutionException
{
@@ -129,10 +165,19 @@ public class CreateCloudServicePackageMo
commands.add( "/out:" + packageFile.getAbsolutePath() );
+ resolveDependencies();
+ ScopeArtifactFilter filter = new ScopeArtifactFilter( scope );
+
final Set projectDependencyArtifacts = project.getDependencyArtifacts();
for ( Object artifactAsObject : projectDependencyArtifacts )
{
Artifact artifact = (Artifact) artifactAsObject;
+
+ if (!filter.include( artifact ))
+ {
+ continue;
+ }
+
final boolean isWebRole = artifact.getType().equals(
ArtifactType.MSDEPLOY_PACKAGE.getPackagingType()
) || artifact.getType().equals(
Modified: incubator/npanday/trunk/plugins/azure-maven-plugin/src/main/java/npanday/plugin/azure/ResolveWorkerRoleFilesMojo.java
URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/plugins/azure-maven-plugin/src/main/java/npanday/plugin/azure/ResolveWorkerRoleFilesMojo.java?rev=1333872&r1=1333871&r2=1333872&view=diff
==============================================================================
--- incubator/npanday/trunk/plugins/azure-maven-plugin/src/main/java/npanday/plugin/azure/ResolveWorkerRoleFilesMojo.java (original)
+++ incubator/npanday/trunk/plugins/azure-maven-plugin/src/main/java/npanday/plugin/azure/ResolveWorkerRoleFilesMojo.java Fri May 4 10:57:58 2012
@@ -20,8 +20,12 @@
package npanday.plugin.azure;
import npanday.ArtifactType;
+import npanday.LocalRepositoryUtil;
import npanday.PathUtil;
+import npanday.resolver.NPandayDependencyResolution;
import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.resolver.ArtifactResolutionException;
+import org.apache.maven.artifact.resolver.filter.ScopeArtifactFilter;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.codehaus.plexus.archiver.ArchiverException;
@@ -38,8 +42,6 @@ import java.util.Set;
*
* @author <a href="mailto:lcorneliussen@apache.org">Lars Corneliussen</a>
* @goal resolve-worker-roles
- *
- * TODO requiresDependencyResolution runtime
*/
public class ResolveWorkerRoleFilesMojo
extends AbstractNPandayMojo
@@ -52,14 +54,56 @@ public class ResolveWorkerRoleFilesMojo
*/
private ZipUnArchiver unarchiver;
+ /**
+ * @component
+ */
+ private NPandayDependencyResolution dependencyResolution;
+
+ /**
+ * The scope up to which dependencies should be included.
+ *
+ * @parameter default-value="runtime"
+ */
+ private String scope;
+
+ /**
+ * The location of the local Maven repository.
+ *
+ * @parameter expression="${settings.localRepository}"
+ */
+ private File localRepository;
+
+ private void resolveDependencies() throws MojoExecutionException
+ {
+ try
+ {
+ dependencyResolution.require( project, LocalRepositoryUtil.create( localRepository ), scope );
+ }
+ catch ( ArtifactResolutionException e )
+ {
+ throw new MojoExecutionException(
+ "NPANDAY-131-004: Could not satisfy required dependencies of scope " + scope, e
+ );
+ }
+ }
+
public void execute() throws MojoExecutionException, MojoFailureException
{
+ resolveDependencies();
+
super.execute();
+ ScopeArtifactFilter filter = new ScopeArtifactFilter( scope );
+
final Set projectDependencyArtifacts = project.getDependencyArtifacts();
for ( Object artifactAsObject : projectDependencyArtifacts )
{
Artifact artifact = (Artifact) artifactAsObject;
+ if (!filter.include( artifact ))
+ {
+ continue;
+ }
+
if ( artifact.getType().equals( ArtifactType.DOTNET_APPLICATION.getPackagingType() )
|| artifact.getType().equals( ArtifactType.DOTNET_APPLICATION.getExtension() ) )
{
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=1333872&r1=1333871&r2=1333872&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 10:57:58 2012
@@ -19,11 +19,16 @@ package npanday.plugin.aspx;
* under the License.
*/
+import npanday.LocalRepositoryUtil;
import npanday.PathUtil;
+import npanday.resolver.NPandayDependencyResolution;
import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.resolver.ArtifactResolutionException;
+import org.apache.maven.artifact.resolver.filter.ScopeArtifactFilter;
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;
@@ -55,25 +60,69 @@ public class AspxBinDependencyResolver
*/
private File binDir;
+ /**
+ * @component
+ */
+ private NPandayDependencyResolution dependencyResolution;
+
+ /**
+ * The scope up to which dependencies should be included.
+ *
+ * @parameter default-value="runtime"
+ */
+ private String scope;
+
+ /**
+ * The location of the local Maven repository.
+ *
+ * @parameter expression="${settings.localRepository}"
+ */
+ private File localRepository;
+
+ /**
+ * The maven project.
+ *
+ * @parameter expression="${project}"
+ * @required
+ */
+ protected MavenProject project;
+
+ private void resolveDependencies() throws MojoExecutionException
+ {
+ try
+ {
+ dependencyResolution.require( project, LocalRepositoryUtil.create( localRepository ), scope );
+ }
+ catch ( ArtifactResolutionException e )
+ {
+ throw new MojoExecutionException(
+ "NPANDAY-157-003: Could not satisfy required dependencies of scope " + scope, e
+ );
+ }
+ }
+
public void execute()
throws MojoExecutionException, MojoFailureException {
+
+ resolveDependencies();
+
+ ScopeArtifactFilter filter = new ScopeArtifactFilter( scope );
+
for (Artifact dependency : dependencies) {
- try {
- String filename = dependency.getArtifactId() + "." + dependency.getArtifactHandler().getExtension();
- File targetFile = new File(binDir, filename);
- if (!targetFile.exists()) {
- getLog().debug("NPANDAY-000-0001: copy dependency: typeof:" + dependency.getClass());
- getLog().debug("NPANDAY-000-0001: copy dependency: " + dependency);
- getLog().debug("NPANDAY-000-0002: copying " + dependency.getFile().getAbsolutePath() + " to " + targetFile);
- File sourceFile = PathUtil.getGACFile4Artifact(dependency);
+ if (!filter.include( dependency )){
+ continue;
+ }
- FileUtils.copyFile(sourceFile, targetFile);
-
+ try {
+ File targetFile = new File(binDir, PathUtil.getPlainArtifactFileName(dependency));
+ if (!targetFile.exists()) {
+ getLog().debug("NPANDAY-157-001: copy dependency " + dependency + " to " + targetFile);
+ FileUtils.copyFile(dependency.getFile(), targetFile);
}
}
catch (IOException ioe) {
- throw new MojoExecutionException("NPANDAY-000-00002: Error copying dependency " + dependency, ioe);
+ throw new MojoExecutionException("NPANDAY-157-002: Error copying dependency " + dependency, ioe);
}
}
Modified: incubator/npanday/trunk/plugins/maven-aspx-plugin/src/main/resources/META-INF/plexus/components.xml
URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/plugins/maven-aspx-plugin/src/main/resources/META-INF/plexus/components.xml?rev=1333872&r1=1333871&r2=1333872&view=diff
==============================================================================
--- incubator/npanday/trunk/plugins/maven-aspx-plugin/src/main/resources/META-INF/plexus/components.xml (original)
+++ incubator/npanday/trunk/plugins/maven-aspx-plugin/src/main/resources/META-INF/plexus/components.xml Fri May 4 10:57:58 2012
@@ -28,7 +28,6 @@
<phases>
<validate>
org.apache.npanday.plugins:maven-compile-plugin:initialize,
- org.apache.npanday.plugins:maven-resolver-plugin:resolve,
org.apache.npanday.plugins:NPanday.Plugin.Settings.JavaBinding:generate-settings
</validate>
<generate-sources>
Modified: incubator/npanday/trunk/plugins/maven-compile-plugin/src/main/groovy/npanday/plugin/compile/CompileLifecycleMap.groovy
URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/plugins/maven-compile-plugin/src/main/groovy/npanday/plugin/compile/CompileLifecycleMap.groovy?rev=1333872&r1=1333871&r2=1333872&view=diff
==============================================================================
--- incubator/npanday/trunk/plugins/maven-compile-plugin/src/main/groovy/npanday/plugin/compile/CompileLifecycleMap.groovy (original)
+++ incubator/npanday/trunk/plugins/maven-compile-plugin/src/main/groovy/npanday/plugin/compile/CompileLifecycleMap.groovy Fri May 4 10:57:58 2012
@@ -37,7 +37,6 @@ class CompileLifecycleMap extends Lifecy
def np_generate_settings = "org.apache.npanday.plugins:NPanday.Plugin.Settings.JavaBinding:$npandayVersion:generate-settings"
def np_compile_init = "org.apache.npanday.plugins:maven-compile-plugin:$npandayVersion:initialize"
- def np_resolve = "org.apache.npanday.plugins:maven-resolver-plugin:$npandayVersion:resolve"
def np_generate_assemblyinfo = "org.apache.npanday.plugins:maven-compile-plugin:$npandayVersion:generate-assembly-info"
def np_compile_process_sources = "org.apache.npanday.plugins:maven-compile-plugin:$npandayVersion:process-sources"
def np_compile_process_test_sources = "org.apache.npanday.plugins:maven-compile-plugin:$npandayVersion:process-test-sources"
@@ -48,7 +47,7 @@ class CompileLifecycleMap extends Lifecy
def np_test_compile = "org.apache.npanday.plugins:maven-compile-plugin:$npandayVersion:testCompile"
def np_test = "org.apache.npanday.plugins:maven-test-plugin:$npandayVersion:test"
- def default_validate = [np_compile_init, np_resolve, np_generate_settings]
+ def default_validate = [np_compile_init, np_generate_settings]
def default_generate_sources = [np_generate_assemblyinfo]
def default_process_resources = [np_resgen_copy, np_resgen_generate, np_resgen_resx]
def default_process_sources = [np_compile_process_sources, np_compile_process_test_sources]
Modified: incubator/npanday/trunk/plugins/maven-ilmerge-plugin/src/main/java/npanday/plugin/ilmerge/AssemblyMerger.java
URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/plugins/maven-ilmerge-plugin/src/main/java/npanday/plugin/ilmerge/AssemblyMerger.java?rev=1333872&r1=1333871&r2=1333872&view=diff
==============================================================================
--- incubator/npanday/trunk/plugins/maven-ilmerge-plugin/src/main/java/npanday/plugin/ilmerge/AssemblyMerger.java (original)
+++ incubator/npanday/trunk/plugins/maven-ilmerge-plugin/src/main/java/npanday/plugin/ilmerge/AssemblyMerger.java Fri May 4 10:57:58 2012
@@ -19,6 +19,7 @@
package npanday.plugin.ilmerge;
import npanday.ArtifactType;
+import npanday.LocalRepositoryUtil;
import npanday.PlatformUnsupportedException;
import npanday.executable.ExecutableRequirement;
import npanday.executable.ExecutionException;
@@ -27,9 +28,11 @@ import npanday.executable.compiler.Compi
import npanday.executable.compiler.CompilerRequirement;
import npanday.executable.compiler.KeyInfo;
import npanday.registry.RepositoryRegistry;
+import npanday.resolver.NPandayDependencyResolution;
import npanday.vendor.SettingsUtil;
import npanday.vendor.Vendor;
import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.resolver.ArtifactResolutionException;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
@@ -54,8 +57,6 @@ import java.util.Set;
*
* @phase package
* @goal merge-assemblies
- *
- * TODO requiresDependencyResolution runtime
*/
public class AssemblyMerger extends AbstractMojo
{
@@ -229,7 +230,19 @@ public class AssemblyMerger extends Abst
*/
private boolean mergedArtifactReplacesProjectArtifact;
- /**
+ /**
+ * @component
+ */
+ private NPandayDependencyResolution dependencyResolution;
+
+ /**
+ * The scope up to which dependencies should be resolved.
+ *
+ * @parameter default-value="runtime"
+ */
+ private String requiredScope;
+
+ /**
* Merges the specified assemblies into a primary assembly with classifier "merged".
*/
public void execute()
@@ -237,6 +250,8 @@ public class AssemblyMerger extends Abst
{
SettingsUtil.applyCustomSettings( getLog(), repositoryRegistry, settingsPath );
+ resolveDependencies();
+
try
{
// ilmerge.exe
@@ -294,7 +309,7 @@ public class AssemblyMerger extends Abst
candidateArtifacts.addAll(project.getAttachedArtifacts());
ArtifactSelector internalizeArtifactSelector = new ArtifactSelector( internalizeSet, null );
-
+
Set internalizeArtifacts = new HashSet();
for ( Iterator it = candidateArtifacts.iterator(); it.hasNext(); )
@@ -441,13 +456,27 @@ public class AssemblyMerger extends Abst
catch ( PlatformUnsupportedException e )
{
throw new MojoExecutionException( "NPANDAY-1501-003: Platform Unsupported", e );
- }
+ }
catch ( IOException e )
{
throw new MojoExecutionException( "NPANDAY-1501-004: Unable to overwrite default artifact file", e );
- }
+ }
}
-
+
+ private void resolveDependencies() throws MojoExecutionException
+ {
+ try
+ {
+ dependencyResolution.require( project, LocalRepositoryUtil.create( localRepository ), requiredScope );
+ }
+ catch ( ArtifactResolutionException e )
+ {
+ throw new MojoExecutionException(
+ "NPANDAY-1501-012: Could not satisfy required dependencies of scope " + requiredScope, e
+ );
+ }
+ }
+
private String getFileNameMinusExtension(File file)
{
if (file==null) return null;
Modified: incubator/npanday/trunk/plugins/netplugins/NPanday.Plugin.Msbuild/javabinding/src/main/java/NPanday/Plugin/Msbuild/MsbuildMojo.java
URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/plugins/netplugins/NPanday.Plugin.Msbuild/javabinding/src/main/java/NPanday/Plugin/Msbuild/MsbuildMojo.java?rev=1333872&r1=1333871&r2=1333872&view=diff
==============================================================================
--- incubator/npanday/trunk/plugins/netplugins/NPanday.Plugin.Msbuild/javabinding/src/main/java/NPanday/Plugin/Msbuild/MsbuildMojo.java (original)
+++ incubator/npanday/trunk/plugins/netplugins/NPanday.Plugin.Msbuild/javabinding/src/main/java/NPanday/Plugin/Msbuild/MsbuildMojo.java Fri May 4 10:57:58 2012
@@ -25,10 +25,13 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import npanday.LocalRepositoryUtil;
import npanday.plugin.FieldAnnotation;
+import npanday.resolver.NPandayDependencyResolution;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.ArtifactUtils;
import org.apache.maven.artifact.factory.ArtifactFactory;
+import org.apache.maven.artifact.resolver.ArtifactResolutionException;
import org.apache.maven.model.Resource;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
@@ -38,8 +41,6 @@ import org.codehaus.plexus.util.FileUtil
/**
* @phase validate
* @goal compile
- *
- * TODO requiresDependencyResolution test
*/
public class MsbuildMojo
extends npanday.plugin.AbstractMojo
@@ -121,6 +122,11 @@ public class MsbuildMojo
*/
private ArtifactFactory artifactFactory;
+ /**
+ * @component
+ */
+ private NPandayDependencyResolution dependencyResolution;
+
public String getMojoArtifactId()
{
return "NPanday.Plugin.Msbuild";
@@ -175,6 +181,17 @@ public class MsbuildMojo
public boolean preExecute()
throws MojoExecutionException, MojoFailureException
{
+ try
+ {
+ dependencyResolution.require( project, LocalRepositoryUtil.create( localRepository ), "test" );
+ }
+ catch ( ArtifactResolutionException e )
+ {
+ throw new MojoExecutionException(
+ "NPANDAY-154-010: Could not satisfy required dependencies of scope test", e
+ );
+ }
+
if ( copyReferences )
{
Map<String,MavenProject> projects = new HashMap<String,MavenProject>();