Author: lcorneliussen
Date: Mon Dec 19 16:37:51 2011
New Revision: 1220834

URL: http://svn.apache.org/viewvc?rev=1220834&view=rev
Log:
[NPANDAY-488] Packaging for Web Applications (also Azure Web Roles)

o Initial msdeploy plugin and configuration for zero-classifier packaging

Added:
    incubator/npanday/trunk/plugins/msdeploy-maven-plugin/pom.xml
    incubator/npanday/trunk/plugins/msdeploy-maven-plugin/src/main/java/   
(with props)
    
incubator/npanday/trunk/plugins/msdeploy-maven-plugin/src/main/java/npanday.plugin.msdeploy/
   (with props)
    
incubator/npanday/trunk/plugins/msdeploy-maven-plugin/src/main/java/npanday.plugin.msdeploy/AbstractMsDeployMojo.java
    
incubator/npanday/trunk/plugins/msdeploy-maven-plugin/src/main/java/npanday.plugin.msdeploy/MsDeployCreatePackageMojo.java
    incubator/npanday/trunk/plugins/msdeploy-maven-plugin/src/main/resources/   
(with props)
    
incubator/npanday/trunk/plugins/msdeploy-maven-plugin/src/main/resources/META-INF/
   (with props)
    
incubator/npanday/trunk/plugins/msdeploy-maven-plugin/src/main/resources/META-INF/npanday/
   (with props)
    
incubator/npanday/trunk/plugins/msdeploy-maven-plugin/src/main/resources/META-INF/npanday/executable-plugins.xml
    incubator/npanday/trunk/plugins/msdeploy-maven-plugin/src/site/   (with 
props)
    incubator/npanday/trunk/plugins/msdeploy-maven-plugin/src/site/site.xml

Added: incubator/npanday/trunk/plugins/msdeploy-maven-plugin/pom.xml
URL: 
http://svn.apache.org/viewvc/incubator/npanday/trunk/plugins/msdeploy-maven-plugin/pom.xml?rev=1220834&view=auto
==============================================================================
--- incubator/npanday/trunk/plugins/msdeploy-maven-plugin/pom.xml (added)
+++ incubator/npanday/trunk/plugins/msdeploy-maven-plugin/pom.xml Mon Dec 19 
16:37:51 2011
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd"; 
xmlns="http://maven.apache.org/POM/4.0.0";
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <artifactId>maven-dotnet-plugins</artifactId>
+    <groupId>org.apache.npanday.plugins</groupId>
+    <version>1.5.0-incubating-SNAPSHOT</version>
+  </parent>
+  <groupId>org.apache.npanday.plugins</groupId>
+  <artifactId>msdeploy-maven-plugin</artifactId>
+  <packaging>maven-plugin</packaging>
+
+  <name>NPanday :: MSDeploy Maven Plugin</name>
+  <description>Maven Plugin for Microsoft Web Deploy</description>
+</project>

Propchange: incubator/npanday/trunk/plugins/msdeploy-maven-plugin/src/main/java/
------------------------------------------------------------------------------
    bugtraq:number = true

Propchange: 
incubator/npanday/trunk/plugins/msdeploy-maven-plugin/src/main/java/npanday.plugin.msdeploy/
------------------------------------------------------------------------------
    bugtraq:number = true

Added: 
incubator/npanday/trunk/plugins/msdeploy-maven-plugin/src/main/java/npanday.plugin.msdeploy/AbstractMsDeployMojo.java
URL: 
http://svn.apache.org/viewvc/incubator/npanday/trunk/plugins/msdeploy-maven-plugin/src/main/java/npanday.plugin.msdeploy/AbstractMsDeployMojo.java?rev=1220834&view=auto
==============================================================================
--- 
incubator/npanday/trunk/plugins/msdeploy-maven-plugin/src/main/java/npanday.plugin.msdeploy/AbstractMsDeployMojo.java
 (added)
+++ 
incubator/npanday/trunk/plugins/msdeploy-maven-plugin/src/main/java/npanday.plugin.msdeploy/AbstractMsDeployMojo.java
 Mon Dec 19 16:37:51 2011
@@ -0,0 +1,137 @@
+/*
+ * 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.msdeploy;
+
+import npanday.PlatformUnsupportedException;
+import npanday.executable.ExecutableRequirement;
+import npanday.executable.ExecutionException;
+import npanday.executable.NetExecutable;
+import npanday.registry.RepositoryRegistry;
+import npanday.vendor.SettingsUtil;
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.project.MavenProjectHelper;
+
+import java.util.List;
+
+
+/**
+ * @author <a href="mailto:lcornelius...@apache.org";>Lars Corneliussen</a>
+ */
+public abstract class AbstractMsDeployMojo
+    extends AbstractMojo
+{
+    /**
+     * @parameter expression="${npanday.settings}" 
default-value="${user.home}/.m2"
+     */
+    private String settingsPath;
+
+
+    /**
+     * The vendor of the framework, the executable is provided by or 
compatible with.
+     *
+     * @parameter expression="${vendor}"
+     */
+    private String vendor;
+
+    /**
+     * The version of the framework vendor, the executable is provided by or 
compatible with.
+     *
+     * @parameter expression="${vendor}"
+     */
+    private String vendorVersion;
+
+    /**
+     * The framework version, the executable is compatible with.
+     *
+     * @parameter expression = "${frameworkVersion}"
+     */
+    private String frameworkVersion;
+
+    /**
+     * The configured profile, from executable-plugins.xml, to be used.
+     *
+     * @parameter expression = "${profile}" default-value = "MSDEPLOY"
+     */
+    private String profile;
+
+    /**
+     * @component
+     */
+    private RepositoryRegistry repositoryRegistry;
+
+    /**
+     * @component
+     */
+    private npanday.executable.NetExecutableFactory netExecutableFactory;
+
+    /**
+     * The maven project.
+     *
+     * @parameter expression="${project}"
+     * @required
+     */
+    protected MavenProject project;
+
+    /**
+     * The maven project helper.
+     *
+     * @component
+     */
+    protected MavenProjectHelper projectHelper;
+
+    public void execute() throws MojoExecutionException
+    {
+        SettingsUtil.applyCustomSettings( getLog(), repositoryRegistry, 
settingsPath );
+
+        beforeCommandExecution();
+
+        try
+        {
+            final NetExecutable executable = 
netExecutableFactory.getNetExecutableFor(
+                new ExecutableRequirement( vendor, vendorVersion, 
frameworkVersion, profile ), getCommands(), null
+            );
+            executable.execute();
+        }
+        catch ( ExecutionException e )
+        {
+            throw new MojoExecutionException(
+                "NPANDAY-120-000: Unable to execute profile '" + profile + "' 
for vendor " + vendor + " v"
+                    + vendorVersion + " and frameworkVersion = " + 
frameworkVersion, e
+            );
+        }
+        catch ( PlatformUnsupportedException e )
+        {
+            throw new MojoExecutionException(
+                "NPANDAY-120-001: Unsupported platform configuration. Could 
not find profile '" + profile
+                    + "' for vendor " + vendor + " v" + vendorVersion + " and 
frameworkVersion = " +
+                    frameworkVersion, e
+            );
+        }
+
+        afterCommandExecution();
+    }
+
+    protected abstract void afterCommandExecution() throws 
MojoExecutionException;
+
+    protected abstract void beforeCommandExecution();
+
+    abstract List<String> getCommands() throws MojoExecutionException;
+}

Added: 
incubator/npanday/trunk/plugins/msdeploy-maven-plugin/src/main/java/npanday.plugin.msdeploy/MsDeployCreatePackageMojo.java
URL: 
http://svn.apache.org/viewvc/incubator/npanday/trunk/plugins/msdeploy-maven-plugin/src/main/java/npanday.plugin.msdeploy/MsDeployCreatePackageMojo.java?rev=1220834&view=auto
==============================================================================
--- 
incubator/npanday/trunk/plugins/msdeploy-maven-plugin/src/main/java/npanday.plugin.msdeploy/MsDeployCreatePackageMojo.java
 (added)
+++ 
incubator/npanday/trunk/plugins/msdeploy-maven-plugin/src/main/java/npanday.plugin.msdeploy/MsDeployCreatePackageMojo.java
 Mon Dec 19 16:37:51 2011
@@ -0,0 +1,55 @@
+package npanday.plugin.msdeploy;
+
+import com.google.common.collect.Lists;
+import npanday.ArtifactType;
+import npanday.PathUtil;
+import org.apache.maven.plugin.MojoExecutionException;
+
+import java.io.File;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:lcornelius...@apache.org";>Lars Corneliussen</a>
+ * @goal create-package
+ */
+public class MsDeployCreatePackageMojo
+    extends AbstractMsDeployMojo
+{
+    private File packageFile;
+
+    @Override
+    protected void afterCommandExecution() throws MojoExecutionException
+    {
+        if ( !packageFile.exists() )
+        {
+            throw new MojoExecutionException(
+                "NPANDAY-121-001: MSDeploy seemed to fail on creating the 
package " + packageFile.getAbsolutePath()
+            );
+        }
+
+        projectHelper.attachArtifact( project, 
ArtifactType.MSDEPLOY_PACKAGE.getPackagingType(), packageFile );
+    }
+
+    @Override
+    protected void beforeCommandExecution()
+    {
+        packageFile = new File(
+            project.getBuild().getDirectory(),
+            project.getArtifactId() + "." + 
ArtifactType.MSDEPLOY_PACKAGE.getExtension()
+        );
+    }
+
+    @Override
+    List<String> getCommands() throws MojoExecutionException
+    {
+        List<String> commands = Lists.newArrayList();
+
+        File packageSource = PathUtil.getPreparedPackageFolder( project );
+
+        commands.add( "-verb:sync" );
+        commands.add( "-source:contentPath=" + packageSource.getAbsolutePath() 
);
+        commands.add( "-dest:package=" + packageFile.getAbsolutePath() );
+
+        return commands;
+    }
+}

Propchange: 
incubator/npanday/trunk/plugins/msdeploy-maven-plugin/src/main/resources/
------------------------------------------------------------------------------
    bugtraq:number = true

Propchange: 
incubator/npanday/trunk/plugins/msdeploy-maven-plugin/src/main/resources/META-INF/
------------------------------------------------------------------------------
    bugtraq:number = true

Propchange: 
incubator/npanday/trunk/plugins/msdeploy-maven-plugin/src/main/resources/META-INF/npanday/
------------------------------------------------------------------------------
    bugtraq:number = true

Added: 
incubator/npanday/trunk/plugins/msdeploy-maven-plugin/src/main/resources/META-INF/npanday/executable-plugins.xml
URL: 
http://svn.apache.org/viewvc/incubator/npanday/trunk/plugins/msdeploy-maven-plugin/src/main/resources/META-INF/npanday/executable-plugins.xml?rev=1220834&view=auto
==============================================================================
--- 
incubator/npanday/trunk/plugins/msdeploy-maven-plugin/src/main/resources/META-INF/npanday/executable-plugins.xml
 (added)
+++ 
incubator/npanday/trunk/plugins/msdeploy-maven-plugin/src/main/resources/META-INF/npanday/executable-plugins.xml
 Mon Dec 19 16:37:51 2011
@@ -0,0 +1,44 @@
+<!--
+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.
+-->
+<executablePlugins xmlns="http://npanday.apache.org/executables/1.5.0";>
+
+  <executablePlugin>
+    <profile>MSDEPLOY</profile>
+    <pluginClass>npanday.executable.impl.DefaultNetExecutable</pluginClass>
+
+    <vendor>MICROSOFT</vendor>
+    <executable>msdeploy</executable>
+    <frameworkVersions>
+      <frameworkVersion>4.0</frameworkVersion>
+      <frameworkVersion>3.5</frameworkVersion>
+      <frameworkVersion>2.0.50727</frameworkVersion>
+    </frameworkVersions>
+
+    <probingPaths>
+       <probingPath>${HKLM\SOFTWARE\Microsoft\IIS 
Extensions\MSDeploy\2@InstallPath}</probingPath>
+    </probingPaths>
+
+    <platforms>
+      <platform>
+        <operatingSystem>Windows</operatingSystem>
+      </platform>
+    </platforms>
+
+  </executablePlugin>
+</executablePlugins>

Propchange: incubator/npanday/trunk/plugins/msdeploy-maven-plugin/src/site/
------------------------------------------------------------------------------
    bugtraq:number = true

Added: incubator/npanday/trunk/plugins/msdeploy-maven-plugin/src/site/site.xml
URL: 
http://svn.apache.org/viewvc/incubator/npanday/trunk/plugins/msdeploy-maven-plugin/src/site/site.xml?rev=1220834&view=auto
==============================================================================
--- incubator/npanday/trunk/plugins/msdeploy-maven-plugin/src/site/site.xml 
(added)
+++ incubator/npanday/trunk/plugins/msdeploy-maven-plugin/src/site/site.xml Mon 
Dec 19 16:37:51 2011
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+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.
+-->
+<project xmlns="http://maven.apache.org/DECORATION/1.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://maven.apache.org/DECORATION/1.0.0 
http://maven.apache.org/xsd/decoration-1.0.0.xsd";>
+  <body>
+    <menu ref="parent" />
+
+    <menu name="Overview">
+      <item name="About" href="index.html"/>
+      <item name="Goals" href="plugin-info.html"/>
+    </menu>
+
+    <menu ref="reports" />
+  </body>
+</project>


Reply via email to