Author: lcorneliussen
Date: Wed Dec 28 10:44:45 2011
New Revision: 1225158
URL: http://svn.apache.org/viewvc?rev=1225158&view=rev
Log:
[NPANDAY-480] Support Windows Azure Cloud Service Project and Packaging (CCPack)
o Added lifecycle definition
Added:
incubator/npanday/trunk/plugins/azure-maven-plugin/src/main/groovy/
incubator/npanday/trunk/plugins/azure-maven-plugin/src/main/groovy/npanday/
incubator/npanday/trunk/plugins/azure-maven-plugin/src/main/groovy/npanday/plugin/
incubator/npanday/trunk/plugins/azure-maven-plugin/src/main/groovy/npanday/plugin/azure/
incubator/npanday/trunk/plugins/azure-maven-plugin/src/main/groovy/npanday/plugin/azure/AzureLifecycleMap.groovy
(contents, props changed)
- copied, changed from r1224892,
incubator/npanday/trunk/plugins/custom-lifecycle-maven-plugin/src/main/groovy/npanday/plugin/customlifecycle/CustomLifecycleMap.groovy
incubator/npanday/trunk/plugins/azure-maven-plugin/src/main/groovy/npanday/plugin/azure/DescribeMojo.groovy
(contents, props changed)
- copied, changed from r1224892,
incubator/npanday/trunk/plugins/custom-lifecycle-maven-plugin/src/main/groovy/npanday/plugin/customlifecycle/DescribeMojo.groovy
incubator/npanday/trunk/plugins/azure-maven-plugin/src/main/java/npanday.plugin.azure/AbstractNPandayMojo.java
incubator/npanday/trunk/plugins/azure-maven-plugin/src/main/java/npanday.plugin.azure/ResolveWorkerRoleFilesMojo.java
incubator/npanday/trunk/plugins/azure-maven-plugin/src/main/resources/META-INF/plexus/
incubator/npanday/trunk/plugins/azure-maven-plugin/src/main/resources/META-INF/plexus/components.xml
- copied, changed from r1224892,
incubator/npanday/trunk/plugins/custom-lifecycle-maven-plugin/src/main/resources/META-INF/plexus/components.xml
incubator/npanday/trunk/plugins/azure-maven-plugin/src/main/script/
incubator/npanday/trunk/plugins/azure-maven-plugin/src/main/script/plexus_component_xml.groovy
Modified:
incubator/npanday/trunk/plugins/azure-maven-plugin/pom.xml
incubator/npanday/trunk/plugins/azure-maven-plugin/src/main/java/npanday.plugin.azure/AbstractCSPackDeployMojo.java
incubator/npanday/trunk/plugins/azure-maven-plugin/src/main/java/npanday.plugin.azure/AbstractNPandaySettingsAwareMojo.java
incubator/npanday/trunk/plugins/azure-maven-plugin/src/main/java/npanday.plugin.azure/ProcessCloudServiceConfigurationMojo.java
Modified: incubator/npanday/trunk/plugins/azure-maven-plugin/pom.xml
URL:
http://svn.apache.org/viewvc/incubator/npanday/trunk/plugins/azure-maven-plugin/pom.xml?rev=1225158&r1=1225157&r2=1225158&view=diff
==============================================================================
--- incubator/npanday/trunk/plugins/azure-maven-plugin/pom.xml (original)
+++ incubator/npanday/trunk/plugins/azure-maven-plugin/pom.xml Wed Dec 28
10:44:45 2011
@@ -32,4 +32,52 @@
<name>NPanday :: Azure Maven Plugin</name>
<description>Maven Plugin for packaging of Azure Cloud Services</description>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.gmaven</groupId>
+ <artifactId>gmaven-plugin</artifactId>
+ <executions>
+ <!-- tests are yet included by super pom -->
+ <execution>
+ <id>grovy-main</id>
+ <goals>
+ <goal>generateStubs</goal>
+ <goal>compile</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>generate-plexus-config</id>
+ <phase>prepare-package</phase>
+ <goals>
+ <goal>execute</goal>
+ </goals>
+ <configuration>
+
<source>file:///${pom.basedir}/src/main/script/plexus_component_xml.groovy</source>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.codehaus.gmaven</groupId>
+ <artifactId>gmaven-mojo</artifactId>
+ <version>1.2</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>groovy-all-minimal</artifactId>
+ <groupId>org.codehaus.groovy</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-utils</artifactId>
+ <version>${plexus.utils.version}</version>
+ </dependency>
+ </dependencies>
</project>
Copied:
incubator/npanday/trunk/plugins/azure-maven-plugin/src/main/groovy/npanday/plugin/azure/AzureLifecycleMap.groovy
(from r1224892,
incubator/npanday/trunk/plugins/custom-lifecycle-maven-plugin/src/main/groovy/npanday/plugin/customlifecycle/CustomLifecycleMap.groovy)
URL:
http://svn.apache.org/viewvc/incubator/npanday/trunk/plugins/azure-maven-plugin/src/main/groovy/npanday/plugin/azure/AzureLifecycleMap.groovy?p2=incubator/npanday/trunk/plugins/azure-maven-plugin/src/main/groovy/npanday/plugin/azure/AzureLifecycleMap.groovy&p1=incubator/npanday/trunk/plugins/custom-lifecycle-maven-plugin/src/main/groovy/npanday/plugin/customlifecycle/CustomLifecycleMap.groovy&r1=1224892&r2=1225158&rev=1225158&view=diff
==============================================================================
---
incubator/npanday/trunk/plugins/custom-lifecycle-maven-plugin/src/main/groovy/npanday/plugin/customlifecycle/CustomLifecycleMap.groovy
(original)
+++
incubator/npanday/trunk/plugins/azure-maven-plugin/src/main/groovy/npanday/plugin/azure/AzureLifecycleMap.groovy
Wed Dec 28 10:44:45 2011
@@ -16,40 +16,37 @@
* specific language governing permissions and limitations
* under the License.
*/
-package npanday.plugin.customlifecycle;
-import org.apache.maven.lifecycle.Lifecycle;
-import npanday.lifecycle.LifecycleMapping;
-import npanday.lifecycle.LifecycleMappingBuilder;
-import npanday.lifecycle.LifecyclePhase;
-import npanday.lifecycle.LifecycleMap;
-import npanday.ArtifactType;
+package npanday.plugin.azure;
import static LifecycleMappingBuilder.build as forType
+
+import npanday.lifecycle.LifecycleMap
+import npanday.lifecycle.LifecycleMappingBuilder
+
/**
- * The mapping of all types to an almost empty lifecycle. It only recognizes
the main
- * artifact in package and executes the default install and deploy plugins
- * in the corresponding phases.
- *
+ * Definition of the azure cloud service lifecycle.
+ *
* @author Lars Corneliussen
*/
-class CustomLifecycleMap extends LifecycleMap
+class AzureLifecycleMap extends LifecycleMap
{
void defineMappings(String npandayVersion) {
- def self_setArtifact =
"org.apache.npanday.plugins:custom-lifecycle-maven-plugin:$npandayVersion:set-artifact"
+ def azure =
"org.apache.npanday.plugins:azure-maven-plugin:$npandayVersion"
+ def msdeploy =
"org.apache.npanday.plugins:msdeploy-maven-plugin:$npandayVersion"
+
def mv_install =
"org.apache.maven.plugins:maven-install-plugin:install"
def mv_deploy = "org.apache.maven.plugins:maven-deploy-plugin:deploy"
- def phases = {LifecycleMappingBuilder b ->
- b._package( self_setArtifact )
+ add(forType(npanday.ArtifactType.AZURE_CLOUD_SERVICE,
{LifecycleMappingBuilder b ->
+ b.prepare_package(
+ "$azure:resolve-worker-roles",
+ "$msdeploy:unpack-dependencies",
+ "$azure:process-cloud-service-configuration"
+ )
+ b._package( "$azure:create-cloud-service-package" )
b.install( mv_install )
b.deploy( mv_deploy )
- }
-
- ArtifactType.values()
- .findAll{ArtifactType type -> type != npanday.ArtifactType.NULL}
- .each{
- add(forType(it, phases))
- }
+ }))
}
}
Propchange:
incubator/npanday/trunk/plugins/azure-maven-plugin/src/main/groovy/npanday/plugin/azure/AzureLifecycleMap.groovy
------------------------------------------------------------------------------
svn:eol-style = native
Copied:
incubator/npanday/trunk/plugins/azure-maven-plugin/src/main/groovy/npanday/plugin/azure/DescribeMojo.groovy
(from r1224892,
incubator/npanday/trunk/plugins/custom-lifecycle-maven-plugin/src/main/groovy/npanday/plugin/customlifecycle/DescribeMojo.groovy)
URL:
http://svn.apache.org/viewvc/incubator/npanday/trunk/plugins/azure-maven-plugin/src/main/groovy/npanday/plugin/azure/DescribeMojo.groovy?p2=incubator/npanday/trunk/plugins/azure-maven-plugin/src/main/groovy/npanday/plugin/azure/DescribeMojo.groovy&p1=incubator/npanday/trunk/plugins/custom-lifecycle-maven-plugin/src/main/groovy/npanday/plugin/customlifecycle/DescribeMojo.groovy&r1=1224892&r2=1225158&rev=1225158&view=diff
==============================================================================
---
incubator/npanday/trunk/plugins/custom-lifecycle-maven-plugin/src/main/groovy/npanday/plugin/customlifecycle/DescribeMojo.groovy
(original)
+++
incubator/npanday/trunk/plugins/azure-maven-plugin/src/main/groovy/npanday/plugin/azure/DescribeMojo.groovy
Wed Dec 28 10:44:45 2011
@@ -1,3 +1,4 @@
+package npanday.plugin.azure
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -16,12 +17,15 @@
* specific language governing permissions and limitations
* under the License.
*/
-package npanday.plugin.customlifecycle;
-import npanday.lifecycle.LifecyclePrinter;
+;
+
+
+import npanday.lifecycle.LifecyclePrinter
+import org.apache.maven.project.MavenProject
import org.codehaus.gmaven.mojo.GroovyMojo
-import org.apache.maven.project.MavenProject;
+
/**
* @author Lars Corneliussen
* @goal describe
@@ -39,6 +43,6 @@ class DescribeMojo
protected MavenProject project;
void execute() {
- LifecyclePrinter.printAll(CustomLifecycleMap, project.version,
{getLog().info(it)})
+
LifecyclePrinter.printAll(npanday.plugin.customlifecycle.CustomLifecycleMap,
project.version, {getLog().info(it)})
}
}
Propchange:
incubator/npanday/trunk/plugins/azure-maven-plugin/src/main/groovy/npanday/plugin/azure/DescribeMojo.groovy
------------------------------------------------------------------------------
svn:eol-style = native
Modified:
incubator/npanday/trunk/plugins/azure-maven-plugin/src/main/java/npanday.plugin.azure/AbstractCSPackDeployMojo.java
URL:
http://svn.apache.org/viewvc/incubator/npanday/trunk/plugins/azure-maven-plugin/src/main/java/npanday.plugin.azure/AbstractCSPackDeployMojo.java?rev=1225158&r1=1225157&r2=1225158&view=diff
==============================================================================
---
incubator/npanday/trunk/plugins/azure-maven-plugin/src/main/java/npanday.plugin.azure/AbstractCSPackDeployMojo.java
(original)
+++
incubator/npanday/trunk/plugins/azure-maven-plugin/src/main/java/npanday.plugin.azure/AbstractCSPackDeployMojo.java
Wed Dec 28 10:44:45 2011
@@ -58,8 +58,11 @@ public abstract class AbstractCSPackDepl
*/
private String executableProfile;
- public void innerExecute() throws MojoExecutionException,
MojoFailureException
+ @Override
+ public void execute() throws MojoExecutionException, MojoFailureException
{
+ super.execute();
+
beforeCommandExecution();
try
Added:
incubator/npanday/trunk/plugins/azure-maven-plugin/src/main/java/npanday.plugin.azure/AbstractNPandayMojo.java
URL:
http://svn.apache.org/viewvc/incubator/npanday/trunk/plugins/azure-maven-plugin/src/main/java/npanday.plugin.azure/AbstractNPandayMojo.java?rev=1225158&view=auto
==============================================================================
---
incubator/npanday/trunk/plugins/azure-maven-plugin/src/main/java/npanday.plugin.azure/AbstractNPandayMojo.java
(added)
+++
incubator/npanday/trunk/plugins/azure-maven-plugin/src/main/java/npanday.plugin.azure/AbstractNPandayMojo.java
Wed Dec 28 10:44:45 2011
@@ -0,0 +1,66 @@
+/*
+ * 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.azure;
+
+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.apache.maven.project.MavenProjectHelper;
+
+/**
+ * @author <a href="mailto:[email protected]">Lars Corneliussen</a>
+ */
+public abstract class AbstractNPandayMojo
+ extends AbstractMojo
+{
+ /**
+ * If the execution of this goal is to be skipped.
+ *
+ * @parameter
+ */
+ protected boolean skip;
+
+ /**
+ * The maven project.
+ *
+ * @parameter expression="${project}"
+ * @required
+ */
+ protected MavenProject project;
+
+ /**
+ * The maven project helper.
+ *
+ * @component
+ */
+ protected MavenProjectHelper projectHelper;
+
+ public void execute() throws MojoExecutionException, MojoFailureException
+ {
+ if ( skip )
+ {
+ getLog().info(
+ "NPANDAY-126-000: Execution of '" + getClass().getSimpleName()
+ "' was skipped by configuration."
+ );
+ return;
+ }
+ }
+}
Modified:
incubator/npanday/trunk/plugins/azure-maven-plugin/src/main/java/npanday.plugin.azure/AbstractNPandaySettingsAwareMojo.java
URL:
http://svn.apache.org/viewvc/incubator/npanday/trunk/plugins/azure-maven-plugin/src/main/java/npanday.plugin.azure/AbstractNPandaySettingsAwareMojo.java?rev=1225158&r1=1225157&r2=1225158&view=diff
==============================================================================
---
incubator/npanday/trunk/plugins/azure-maven-plugin/src/main/java/npanday.plugin.azure/AbstractNPandaySettingsAwareMojo.java
(original)
+++
incubator/npanday/trunk/plugins/azure-maven-plugin/src/main/java/npanday.plugin.azure/AbstractNPandaySettingsAwareMojo.java
Wed Dec 28 10:44:45 2011
@@ -21,24 +21,15 @@ package npanday.plugin.azure;
import npanday.registry.RepositoryRegistry;
import npanday.vendor.SettingsUtil;
-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.apache.maven.project.MavenProjectHelper;
/**
* @author <a href="mailto:[email protected]">Lars Corneliussen</a>
*/
public abstract class AbstractNPandaySettingsAwareMojo
- extends AbstractMojo
+ extends AbstractNPandayMojo
{
- /**
- * If the execution of this goal is to be skipped.
- *
- * @parameter
- */
- protected boolean skip;
/**
* @parameter expression="${npanday.settings}"
default-value="${user.home}/.m2"
@@ -76,35 +67,11 @@ public abstract class AbstractNPandaySet
*/
protected npanday.executable.NetExecutableFactory netExecutableFactory;
- /**
- * The maven project.
- *
- * @parameter expression="${project}"
- * @required
- */
- protected MavenProject project;
-
- /**
- * The maven project helper.
- *
- * @component
- */
- protected MavenProjectHelper projectHelper;
-
- public final void execute() throws MojoExecutionException,
MojoFailureException
+ @Override
+ public void execute() throws MojoExecutionException, MojoFailureException
{
- if ( skip )
- {
- getLog().info(
- "NPANDAY-126-000: Execution of " + getClass().getSimpleName()
+ " was skipped by configuration."
- );
- return;
- }
+ super.execute();
SettingsUtil.applyCustomSettings( getLog(), repositoryRegistry,
settingsPath );
-
- innerExecute();
}
-
- protected abstract void innerExecute() throws MojoExecutionException,
MojoFailureException;
}
Modified:
incubator/npanday/trunk/plugins/azure-maven-plugin/src/main/java/npanday.plugin.azure/ProcessCloudServiceConfigurationMojo.java
URL:
http://svn.apache.org/viewvc/incubator/npanday/trunk/plugins/azure-maven-plugin/src/main/java/npanday.plugin.azure/ProcessCloudServiceConfigurationMojo.java?rev=1225158&r1=1225157&r2=1225158&view=diff
==============================================================================
---
incubator/npanday/trunk/plugins/azure-maven-plugin/src/main/java/npanday.plugin.azure/ProcessCloudServiceConfigurationMojo.java
(original)
+++
incubator/npanday/trunk/plugins/azure-maven-plugin/src/main/java/npanday.plugin.azure/ProcessCloudServiceConfigurationMojo.java
Wed Dec 28 10:44:45 2011
@@ -47,8 +47,11 @@ public class ProcessCloudServiceConfigur
*/
private String serviceConfigurationClassifier;
- public void innerExecute() throws MojoExecutionException,
MojoFailureException
+ @Override
+ public void execute() throws MojoExecutionException, MojoFailureException
{
+ super.execute();
+
if ( !serviceConfigurationFile.exists() )
{
throw new MojoExecutionException(
Added:
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=1225158&view=auto
==============================================================================
---
incubator/npanday/trunk/plugins/azure-maven-plugin/src/main/java/npanday.plugin.azure/ResolveWorkerRoleFilesMojo.java
(added)
+++
incubator/npanday/trunk/plugins/azure-maven-plugin/src/main/java/npanday.plugin.azure/ResolveWorkerRoleFilesMojo.java
Wed Dec 28 10:44:45 2011
@@ -0,0 +1,42 @@
+/*
+ * 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.azure;
+
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+
+/**
+ *
+ *
+ * @author <a href="mailto:[email protected]">Lars Corneliussen</a>
+ * @goal resolve-worker-roles
+ *
+ * @requiresDependencyResolution runtime
+ */
+public class ResolveWorkerRoleFilesMojo
+ extends AbstractNPandayMojo
+{
+ public void execute() throws MojoExecutionException, MojoFailureException
+ {
+ super.execute();
+
+
+ }
+}
Copied:
incubator/npanday/trunk/plugins/azure-maven-plugin/src/main/resources/META-INF/plexus/components.xml
(from r1224892,
incubator/npanday/trunk/plugins/custom-lifecycle-maven-plugin/src/main/resources/META-INF/plexus/components.xml)
URL:
http://svn.apache.org/viewvc/incubator/npanday/trunk/plugins/azure-maven-plugin/src/main/resources/META-INF/plexus/components.xml?p2=incubator/npanday/trunk/plugins/azure-maven-plugin/src/main/resources/META-INF/plexus/components.xml&p1=incubator/npanday/trunk/plugins/custom-lifecycle-maven-plugin/src/main/resources/META-INF/plexus/components.xml&r1=1224892&r2=1225158&rev=1225158&view=diff
==============================================================================
---
incubator/npanday/trunk/plugins/custom-lifecycle-maven-plugin/src/main/resources/META-INF/plexus/components.xml
(original)
+++
incubator/npanday/trunk/plugins/azure-maven-plugin/src/main/resources/META-INF/plexus/components.xml
Wed Dec 28 10:44:45 2011
@@ -16,6 +16,7 @@
~ specific language governing permissions and limitations
~ under the License.
-->
+
<component-set>
<!--
The contents of this file are generated on generate-resources
Added:
incubator/npanday/trunk/plugins/azure-maven-plugin/src/main/script/plexus_component_xml.groovy
URL:
http://svn.apache.org/viewvc/incubator/npanday/trunk/plugins/azure-maven-plugin/src/main/script/plexus_component_xml.groovy?rev=1225158&view=auto
==============================================================================
---
incubator/npanday/trunk/plugins/azure-maven-plugin/src/main/script/plexus_component_xml.groovy
(added)
+++
incubator/npanday/trunk/plugins/azure-maven-plugin/src/main/script/plexus_component_xml.groovy
Wed Dec 28 10:44:45 2011
@@ -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.
+ */
+
+
+
+/**
+ * This script generates the plexus-configuration for registration
+ * of artifact handlers and lifecycles.
+ *
+ * @author <a href="mailto:[email protected]">Lars Corneliussen</a>
+ **/
+import npanday.lifecycle.LifecycleConfigurationGenerator
+
+def plexus = new File(project.build.outputDirectory, 'META-INF/plexus')
+plexus.mkdirs()
+
+def componentsXmlFile = new File(plexus, 'components.xml');
+
+LifecycleConfigurationGenerator
+
.persistAllTypesAndLifecycles(npanday.plugin.azure.AzureLifecycleMap,
project.version, componentsXmlFile)