Author: brett
Date: Tue Mar 5 10:05:38 2013
New Revision: 1452714
URL: http://svn.apache.org/r1452714
Log:
[NPANDAY-480] allow mapping dependency role artifact names
Some roles may carry a different artifact ID to the name that needs to be
assigned to the role.
One particular case to consider is a Silverlight web application that uses RIA
services - it
requires that the msdeploy section be split out into a different project to
avoid creating a
circular dependency - however Azure needs the original role name of the web
project not the
packaging project that it consumes.
Modified:
incubator/npanday/trunk/plugins/azure-maven-plugin/src/main/java/npanday/plugin/azure/CreateCloudServicePackageMojo.java
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=1452714&r1=1452713&r2=1452714&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
Tue Mar 5 10:05:38 2013
@@ -97,6 +97,13 @@ public class CreateCloudServicePackageMo
}
}
+ /**
+ * Dependency aliases to use, in case they don't match the artifact ID.
+ *
+ * @parameter
+ */
+ private Properties aliases;
+
@Override
protected void afterCommandExecution() throws MojoExecutionException
{
@@ -190,10 +197,13 @@ public class CreateCloudServicePackageMo
ArtifactType.DOTNET_APPLICATION.getExtension()
);
+ // if the artifact ID is a key, replace it, otherwise use the
original
+ String dependencyArtifactId = aliases.getProperty(
artifact.getArtifactId(), artifact.getArtifactId() );
+
if ( !isWebRole && !isWorkerRole )
{
throw new MojoExecutionException(
- "NPANDAY-123-005: Artifact type " + artifact.getType() + "
of artifact " + artifact.getArtifactId()
+ "NPANDAY-123-005: Artifact type " + artifact.getType() + "
of artifact " + dependencyArtifactId
+ " is not supported for azure cloud
services.\n\nPlease use "
+ ArtifactType.DOTNET_APPLICATION.getPackagingType() +
" for worker roles, and "
+ ArtifactType.MSDEPLOY_PACKAGE.getPackagingType() + "
for web roles"
@@ -206,17 +216,17 @@ public class CreateCloudServicePackageMo
if ( isWebRole )
{
- getLog().debug( "NPANDAY-123-003: Found web role " +
artifact.getArtifactId() );
+ getLog().debug( "NPANDAY-123-003: Found web role " +
dependencyArtifactId );
}
else if ( isWorkerRole )
{
- getLog().debug( "NPANDAY-123-004: Found worker role " +
artifact.getArtifactId() );
+ getLog().debug( "NPANDAY-123-004: Found worker role " +
dependencyArtifactId );
}
if ( !roleRoot.exists() )
{
throw new MojoExecutionException(
- "NPANDAY-123-006: Could not find worker/web role root for
" + artifact.getArtifactId() + ": "
+ "NPANDAY-123-006: Could not find worker/web role root for
" + dependencyArtifactId + ": "
+ roleRoot
);
}
@@ -224,40 +234,40 @@ public class CreateCloudServicePackageMo
File entryPoint = null;
if ( isWebRole )
{
- String name = "bin" + File.separator +
artifact.getArtifactId() + ".dll";
+ String name = "bin" + File.separator + dependencyArtifactId +
".dll";
entryPoint = new File( roleRoot, name );
if ( entryPoint.exists() )
{
commands.add(
- "/role:" + artifact.getArtifactId() + ";" +
roleRoot.getAbsolutePath() + ";" + name
+ "/role:" + dependencyArtifactId + ";" +
roleRoot.getAbsolutePath() + ";" + name
);
}
else
{
getLog().warn( "NPANDAY-123-005: entry point '" +
entryPoint + "' could not be found" );
commands.add(
- "/role:" + artifact.getArtifactId() + ";" +
roleRoot.getAbsolutePath()
+ "/role:" + dependencyArtifactId + ";" +
roleRoot.getAbsolutePath()
);
}
// TODO: 'Web/' is hardcoded here; where to get it from?
commands.add(
- "/sitePhysicalDirectories:" + artifact.getArtifactId() +
";Web;" + canonical( roleRoot )
+ "/sitePhysicalDirectories:" + dependencyArtifactId +
";Web;" + canonical( roleRoot )
);
}
else if ( isWorkerRole )
{
- entryPoint = new File( roleRoot, artifact.getArtifactId() +
".dll" );
+ entryPoint = new File( roleRoot, dependencyArtifactId + ".dll"
);
if ( !entryPoint.exists() )
{
throw new MojoExecutionException(
- "NPANDAY-123-007: Could not find entry point dll for "
+ artifact.getArtifactId() + ": "
+ "NPANDAY-123-007: Could not find entry point dll for "
+ dependencyArtifactId + ": "
+ entryPoint
);
}
commands.add(
- "/role:" + artifact.getArtifactId() + ";" +
roleRoot.getAbsolutePath() + ";"
+ "/role:" + dependencyArtifactId + ";" +
roleRoot.getAbsolutePath() + ";"
+ entryPoint.getName()
);
}
@@ -271,7 +281,7 @@ public class CreateCloudServicePackageMo
properties.setProperty( "EntryPoint", entryPoint.getName() );
}
- File rolePropertiesFile = new
File(project.getBuild().getDirectory(), artifact.getArtifactId() +
".roleproperties");
+ File rolePropertiesFile = new
File(project.getBuild().getDirectory(), dependencyArtifactId +
".roleproperties");
PrintWriter writer = null;
try
{
@@ -283,13 +293,13 @@ public class CreateCloudServicePackageMo
}
commands.add(
- "/rolePropertiesFile:" + artifact.getArtifactId() + ";" +
rolePropertiesFile.getAbsolutePath()
+ "/rolePropertiesFile:" + dependencyArtifactId + ";" +
rolePropertiesFile.getAbsolutePath()
);
}
catch ( java.io.IOException e )
{
throw new MojoFailureException(
- "NPANDAY-123-008: Error while creating role properties
file for " + artifact.getArtifactId(), e );
+ "NPANDAY-123-008: Error while creating role properties
file for " + dependencyArtifactId, e );
}
finally
{