directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r616766 [1/4] - in /directory/studio/branches/studio-maven: studio-plugin/ studio-plugin/src/ studio-plugin/src/main/ studio-plugin/src/main/java/ studio-plugin/src/main/java/org/ studio-plugin/src/main/java/org/apache/ studio-plugin/src/ma...
Date Wed, 30 Jan 2008 13:59:42 GMT
Author: pamarcelot
Date: Wed Jan 30 05:59:34 2008
New Revision: 616766

URL: http://svn.apache.org/viewvc?rev=616766&view=rev
Log:
Added studio and studio-plugin projects.

Added:
    directory/studio/branches/studio-maven/studio/
    directory/studio/branches/studio-maven/studio-plugin/
    directory/studio/branches/studio-maven/studio-plugin/pom.xml
    directory/studio/branches/studio-maven/studio-plugin/src/
    directory/studio/branches/studio-maven/studio-plugin/src/main/
    directory/studio/branches/studio-maven/studio-plugin/src/main/java/
    directory/studio/branches/studio-maven/studio-plugin/src/main/java/org/
    directory/studio/branches/studio-maven/studio-plugin/src/main/java/org/apache/
    directory/studio/branches/studio-maven/studio-plugin/src/main/java/org/apache/directory/
    directory/studio/branches/studio-maven/studio-plugin/src/main/java/org/apache/directory/studio/
    directory/studio/branches/studio-maven/studio-plugin/src/main/java/org/apache/directory/studio/maven/
    directory/studio/branches/studio-maven/studio-plugin/src/main/java/org/apache/directory/studio/maven/plugins/
    directory/studio/branches/studio-maven/studio-plugin/src/main/java/org/apache/directory/studio/maven/plugins/AbstractStudioMojo.java
    directory/studio/branches/studio-maven/studio-plugin/src/main/java/org/apache/directory/studio/maven/plugins/ArtifactItem.java
    directory/studio/branches/studio-maven/studio-plugin/src/main/java/org/apache/directory/studio/maven/plugins/StudioCleanMojo.java
    directory/studio/branches/studio-maven/studio-plugin/src/main/java/org/apache/directory/studio/maven/plugins/StudioCopyEclipseDependencyMojo.java
    directory/studio/branches/studio-maven/studio-plugin/src/main/java/org/apache/directory/studio/maven/plugins/StudioEclipseMojo.java
    directory/studio/branches/studio-maven/studio-plugin/src/main/java/org/apache/directory/studio/maven/plugins/StudioPrepareJarPackageMojo.java
    directory/studio/branches/studio-maven/studio-plugin/src/main/java/org/apache/directory/studio/maven/plugins/StudioReplaceFileInJarMojo.java
    directory/studio/branches/studio-maven/studio-plugin/src/main/java/org/apache/directory/studio/maven/plugins/StudioUnpackPrefixedMojo.java
    directory/studio/branches/studio-maven/studio-plugin/src/site/
    directory/studio/branches/studio-maven/studio-plugin/src/site/apt/
    directory/studio/branches/studio-maven/studio-plugin/src/site/apt/examples/
    directory/studio/branches/studio-maven/studio-plugin/src/site/apt/examples/copy-eclipse-artifact.apt
    directory/studio/branches/studio-maven/studio-plugin/src/site/apt/examples/prepare-jar-package.apt
    directory/studio/branches/studio-maven/studio-plugin/src/site/apt/examples/replace-file-in-eclipse-artifact.apt
    directory/studio/branches/studio-maven/studio-plugin/src/site/apt/examples/unpack-with-artifactid-prefix.apt
    directory/studio/branches/studio-maven/studio-plugin/src/site/apt/index.apt
    directory/studio/branches/studio-maven/studio-plugin/src/site/apt/usage.apt
    directory/studio/branches/studio-maven/studio-plugin/src/site/fml/
    directory/studio/branches/studio-maven/studio-plugin/src/site/fml/faq.fml
    directory/studio/branches/studio-maven/studio-plugin/src/site/site.xml
    directory/studio/branches/studio-maven/studio-plugin/src/test/
    directory/studio/branches/studio-maven/studio-plugin/src/test/java/
    directory/studio/branches/studio-maven/studio-plugin/src/test/java/org/
    directory/studio/branches/studio-maven/studio-plugin/src/test/java/org/apache/
    directory/studio/branches/studio-maven/studio-plugin/src/test/java/org/apache/directory/
    directory/studio/branches/studio-maven/studio-plugin/src/test/java/org/apache/directory/studio/
    directory/studio/branches/studio-maven/studio-plugin/src/test/java/org/apache/directory/studio/maven/
    directory/studio/branches/studio-maven/studio-plugin/src/test/java/org/apache/directory/studio/maven/plugins/
    directory/studio/branches/studio-maven/studio-plugin/src/test/java/org/apache/directory/studio/maven/plugins/StudioCleanMojoTest.java
    directory/studio/branches/studio-maven/studio-plugin/src/test/java/org/apache/directory/studio/maven/plugins/StudioCopyEclipseDependencyMojoTest.java
    directory/studio/branches/studio-maven/studio-plugin/src/test/java/org/apache/directory/studio/maven/plugins/StudioUnpackPrefixedMojoTest.java
    directory/studio/branches/studio-maven/studio-plugin/src/test/java/org/apache/directory/studio/maven/plugins/stubs/
    directory/studio/branches/studio-maven/studio-plugin/src/test/java/org/apache/directory/studio/maven/plugins/stubs/StudioCleanProjectStub.java
    directory/studio/branches/studio-maven/studio-plugin/src/test/java/org/apache/directory/studio/maven/plugins/stubs/StudioCopyEclipseDependencyProjectStub.java
    directory/studio/branches/studio-maven/studio-plugin/src/test/java/org/apache/directory/studio/maven/plugins/stubs/StudioUnpackPrefixedProjectStub.java
    directory/studio/branches/studio-maven/studio-plugin/src/test/resources/
    directory/studio/branches/studio-maven/studio-plugin/src/test/resources/org/
    directory/studio/branches/studio-maven/studio-plugin/src/test/resources/org/apache/
    directory/studio/branches/studio-maven/studio-plugin/src/test/resources/org/apache/directory/
    directory/studio/branches/studio-maven/studio-plugin/src/test/resources/org/apache/directory/studio/
    directory/studio/branches/studio-maven/studio-plugin/src/test/resources/org/apache/directory/studio/maven/
    directory/studio/branches/studio-maven/studio-plugin/src/test/resources/org/apache/directory/studio/maven/plugins/
    directory/studio/branches/studio-maven/studio-plugin/src/test/resources/org/apache/directory/studio/maven/plugins/test-copy-repo/
    directory/studio/branches/studio-maven/studio-plugin/src/test/resources/org/apache/directory/studio/maven/plugins/test-copy-repo/org/
    directory/studio/branches/studio-maven/studio-plugin/src/test/resources/org/apache/directory/studio/maven/plugins/test-copy-repo/org/eclipse/
    directory/studio/branches/studio-maven/studio-plugin/src/test/resources/org/apache/directory/studio/maven/plugins/test-copy-repo/org/eclipse/core/
    directory/studio/branches/studio-maven/studio-plugin/src/test/resources/org/apache/directory/studio/maven/plugins/test-copy-repo/org/eclipse/core/commands/
    directory/studio/branches/studio-maven/studio-plugin/src/test/resources/org/apache/directory/studio/maven/plugins/test-copy-repo/org/eclipse/core/commands/3.3.0-I20070605-0010/
    directory/studio/branches/studio-maven/studio-plugin/src/test/resources/org/apache/directory/studio/maven/plugins/test-copy-repo/org/eclipse/core/commands/3.3.0-I20070605-0010/commands-3.3.0-I20070605-0010.jar   (with props)
    directory/studio/branches/studio-maven/studio-plugin/src/test/resources/org/apache/directory/studio/maven/plugins/test-copy-repo/org/eclipse/core/commands/3.3.0-I20070605-0010/commands-3.3.0-I20070605-0010.jar.sha1
    directory/studio/branches/studio-maven/studio-plugin/src/test/resources/org/apache/directory/studio/maven/plugins/test-copy-repo/org/eclipse/core/commands/3.3.0-I20070605-0010/commands-3.3.0-I20070605-0010.pom
    directory/studio/branches/studio-maven/studio-plugin/src/test/resources/org/apache/directory/studio/maven/plugins/test-copy-repo/org/eclipse/core/commands/3.3.0-I20070605-0010/commands-3.3.0-I20070605-0010.pom.sha1
    directory/studio/branches/studio-maven/studio-plugin/src/test/resources/org/apache/directory/studio/maven/plugins/test-copy-repo/org/eclipse/core/jobs/
    directory/studio/branches/studio-maven/studio-plugin/src/test/resources/org/apache/directory/studio/maven/plugins/test-copy-repo/org/eclipse/core/jobs/3.3.1-R33x_v20070709/
    directory/studio/branches/studio-maven/studio-plugin/src/test/resources/org/apache/directory/studio/maven/plugins/test-copy-repo/org/eclipse/core/jobs/3.3.1-R33x_v20070709/jobs-3.3.1-R33x_v20070709.jar   (with props)
    directory/studio/branches/studio-maven/studio-plugin/src/test/resources/org/apache/directory/studio/maven/plugins/test-copy-repo/org/eclipse/core/jobs/3.3.1-R33x_v20070709/jobs-3.3.1-R33x_v20070709.jar.sha1
    directory/studio/branches/studio-maven/studio-plugin/src/test/resources/org/apache/directory/studio/maven/plugins/test-copy-repo/org/eclipse/core/jobs/3.3.1-R33x_v20070709/jobs-3.3.1-R33x_v20070709.pom
    directory/studio/branches/studio-maven/studio-plugin/src/test/resources/org/apache/directory/studio/maven/plugins/test-copy-repo/org/eclipse/core/jobs/3.3.1-R33x_v20070709/jobs-3.3.1-R33x_v20070709.pom.sha1
    directory/studio/branches/studio-maven/studio-plugin/src/test/resources/org/apache/directory/studio/maven/plugins/test-copy-repo/repo-marker.txt
    directory/studio/branches/studio-maven/studio-plugin/src/test/resources/unit/
    directory/studio/branches/studio-maven/studio-plugin/src/test/resources/unit/basic-clean-test/
    directory/studio/branches/studio-maven/studio-plugin/src/test/resources/unit/basic-clean-test/.externalToolBuilders
    directory/studio/branches/studio-maven/studio-plugin/src/test/resources/unit/basic-clean-test/lib/
    directory/studio/branches/studio-maven/studio-plugin/src/test/resources/unit/basic-clean-test/lib/dummy.jar
    directory/studio/branches/studio-maven/studio-plugin/src/test/resources/unit/basic-clean-test/maven-eclipse.xml
    directory/studio/branches/studio-maven/studio-plugin/src/test/resources/unit/basic-clean-test/plugin-exception-pom.xml
    directory/studio/branches/studio-maven/studio-plugin/src/test/resources/unit/basic-clean-test/plugin-pom.xml
    directory/studio/branches/studio-maven/studio-plugin/src/test/resources/unit/basic-copy-test/
    directory/studio/branches/studio-maven/studio-plugin/src/test/resources/unit/basic-copy-test/plugin-pom.xml
    directory/studio/branches/studio-maven/studio-plugin/src/test/resources/unit/basic-unpack-test/
    directory/studio/branches/studio-maven/studio-plugin/src/test/resources/unit/basic-unpack-test/plugin-pom.xml
    directory/studio/branches/studio-maven/studio/pom.xml
    directory/studio/branches/studio-maven/studio/src/
    directory/studio/branches/studio-maven/studio/src/main/
    directory/studio/branches/studio-maven/studio/src/main/assembly/
    directory/studio/branches/studio-maven/studio/src/main/assembly/bin-linux-ppc.xml
    directory/studio/branches/studio-maven/studio/src/main/assembly/bin-linux-x86.xml
    directory/studio/branches/studio-maven/studio/src/main/assembly/bin-linux-x86_64.xml
    directory/studio/branches/studio-maven/studio/src/main/assembly/bin-macosx.xml
    directory/studio/branches/studio-maven/studio/src/main/assembly/bin-win32.xml
    directory/studio/branches/studio-maven/studio/src/main/configuration/
    directory/studio/branches/studio-maven/studio/src/main/configuration/config.ini
    directory/studio/branches/studio-maven/studio/src/main/configuration/org.eclipse.search/
    directory/studio/branches/studio-maven/studio/src/main/configuration/org.eclipse.search/plugin.xml
    directory/studio/branches/studio-maven/studio/src/main/configuration/org.eclipse.ui.editors/
    directory/studio/branches/studio-maven/studio/src/main/configuration/org.eclipse.ui.editors/plugin.xml
    directory/studio/branches/studio-maven/studio/src/main/configuration/org.eclipse.ui.ide/
    directory/studio/branches/studio-maven/studio/src/main/configuration/org.eclipse.ui.ide/plugin.xml
    directory/studio/branches/studio-maven/studio/src/main/configuration/studio.xpm

Added: directory/studio/branches/studio-maven/studio-plugin/pom.xml
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-maven/studio-plugin/pom.xml?rev=616766&view=auto
==============================================================================
--- directory/studio/branches/studio-maven/studio-plugin/pom.xml (added)
+++ directory/studio/branches/studio-maven/studio-plugin/pom.xml Wed Jan 30 05:59:34 2008
@@ -0,0 +1,229 @@
+<?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.
+-->
+<!--
+  @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+  <parent>
+    <groupId>org.apache.directory.project</groupId>
+    <version>9-SNAPSHOT</version>
+    <artifactId>project</artifactId>
+  </parent>
+
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.apache.directory.studio</groupId>
+  <artifactId>maven-studio-plugin</artifactId>
+  <packaging>maven-plugin</packaging>
+  <name>Apache Directory Studio Plugin</name>
+  <version>1.0-SNAPSHOT</version>
+  <description>Maven2 plugin with specific goals for the Apache Directory Studio project</description>
+  <url>http://directory.apache.org/studio/</url>
+  
+  <issueManagement>
+    <system>JIRA</system>
+    <url>http://issues.apache.org/jira/browse/DIRSTUDIO</url>
+  </issueManagement>
+
+  <inceptionYear>2007</inceptionYear>
+  
+  <mailingLists>
+    <mailingList>
+      <name>Directory Developers List</name>
+      <subscribe>dev-subscribe@directory.apache.org</subscribe>
+      <unsubscribe>dev-unsubscribe@directory.apache.org</unsubscribe>
+      <post>dev@directory.apache.org</post>
+      <archive>http://mail-archives.apache.org/mod_mbox/directory-dev</archive>
+    </mailingList>
+    <mailingList>
+      <name>Directory Users List</name>
+      <subscribe>users-subscribe@directory.apache.org</subscribe>
+      <unsubscribe>users-unsubscribe@directory.apache.org</unsubscribe>
+      <post>users@directory.apache.org</post>
+      <archive>http://mail-archives.apache.org/mod_mbox/directory-users</archive>
+    </mailingList>
+    <mailingList>
+      <name>Directory Commits (SVN) List</name>
+      <subscribe>commits-subscribe@directory.apache.org</subscribe>
+      <unsubscribe>commits-unsubscribe@directory.apache.org</unsubscribe>
+      <archive>http://mail-archives.apache.org/mod_mbox/directory-commits</archive>
+    </mailingList>
+  </mailingLists>
+
+  <scm>
+    <connection>scm:svn:https://svn.apache.org/repos/asf/directory/sandbox/felixk/studio-plugin/</connection>
+    <developerConnection>scm:svn:https://svn.apache.org/repos/asf/directory/sandbox/felixk/studio-plugin/</developerConnection>
+    <url>https://svn.apache.org/repos/asf/directory/sandbox/felixk/studio-plugin/</url>
+  </scm>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-eclipse-plugin</artifactId>
+        <configuration>
+          <skip>false</skip>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <version>2.3</version>
+      </plugin>
+    </plugins>
+  </build>
+
+  <dependencies>
+    <dependency>
+      <groupId>commons-lang</groupId>
+      <artifactId>commons-lang</artifactId>
+      <version>2.1</version>
+    </dependency>
+    <dependency>
+      <groupId>commons-io</groupId>
+      <artifactId>commons-io</artifactId>
+      <version>1.3.1</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-artifact</artifactId>
+      <version>2.0.7</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-model</artifactId>
+      <version>2.0.7</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-plugin-api</artifactId>
+      <version>2.0.7</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-project</artifactId>
+      <version>2.0.7</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven.shared</groupId>
+      <artifactId>maven-osgi</artifactId>
+      <version>0.2.0</version>
+    </dependency>
+    <dependency>
+      <groupId>org.codehaus.plexus</groupId>
+      <artifactId>plexus-archiver</artifactId>
+      <version>1.0-alpha-9</version>
+      <exclusions>
+        <exclusion>
+          <groupId>org.codehaus.plexus</groupId>
+          <artifactId>plexus-container-default</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.codehaus.plexus</groupId>
+          <artifactId>plexus-component-api</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+    <dependency>
+      <groupId>org.codehaus.plexus</groupId>
+      <artifactId>plexus-utils</artifactId>
+      <version>1.4.1</version>
+    </dependency>
+
+    <!-- Test -->
+    <dependency>
+      <groupId>org.apache.maven.shared</groupId>
+      <artifactId>maven-plugin-testing-harness</artifactId>
+      <version>1.1</version>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+
+  <reporting>
+    <excludeDefaults>true</excludeDefaults>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-javadoc-plugin</artifactId>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-jxr-plugin</artifactId>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-plugin-plugin</artifactId>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-pmd-plugin</artifactId>
+        <configuration>
+          <linkXref>true</linkXref>
+          <sourceEncoding>utf-8</sourceEncoding>
+          <minimumTokens>100</minimumTokens>
+          <targetJdk>1.5</targetJdk>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-project-info-reports-plugin</artifactId>
+        <reportSets>
+          <reportSet>
+            <reports>
+              <report>license</report>
+              <report>dependencies</report>
+              <report>mailing-list</report>
+              <report>cim</report>
+              <report>scm</report>
+              <report>issue-tracking</report>
+            </reports>
+          </reportSet>
+        </reportSets>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-surefire-report-plugin</artifactId>
+      </plugin>
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>cobertura-maven-plugin</artifactId>
+      </plugin>
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>taglist-maven-plugin</artifactId>
+        <configuration>
+          <tags>
+            <tag>TODO</tag>
+            <tag>@todo</tag>
+            <tag>@deprecated</tag>
+            <tag>FIXME</tag>
+          </tags>
+        </configuration>
+      </plugin>
+    </plugins>
+  </reporting>
+
+  <distributionManagement>
+    <site>
+      <id>felixknecht.ch</id>
+      <url>scpexe://felixknecht.ch/var/www/felixknecht.ch/htdocs/projects/studio-plugin/</url>
+    </site>
+  </distributionManagement>
+
+</project>

Added: directory/studio/branches/studio-maven/studio-plugin/src/main/java/org/apache/directory/studio/maven/plugins/AbstractStudioMojo.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-maven/studio-plugin/src/main/java/org/apache/directory/studio/maven/plugins/AbstractStudioMojo.java?rev=616766&view=auto
==============================================================================
--- directory/studio/branches/studio-maven/studio-plugin/src/main/java/org/apache/directory/studio/maven/plugins/AbstractStudioMojo.java (added)
+++ directory/studio/branches/studio-maven/studio-plugin/src/main/java/org/apache/directory/studio/maven/plugins/AbstractStudioMojo.java Wed Jan 30 05:59:34 2008
@@ -0,0 +1,559 @@
+/*
+ *  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 org.apache.directory.studio.maven.plugins;
+
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.metadata.ArtifactMetadataSource;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.resolver.ArtifactCollector;
+import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
+import org.apache.maven.artifact.resolver.ArtifactResolutionException;
+import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException;
+import org.apache.maven.artifact.versioning.VersionRange;
+import org.apache.maven.model.Dependency;
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.project.MavenProject;
+import org.codehaus.plexus.archiver.Archiver;
+import org.codehaus.plexus.archiver.ArchiverException;
+import org.codehaus.plexus.archiver.UnArchiver;
+import org.codehaus.plexus.archiver.manager.ArchiverManager;
+import org.codehaus.plexus.archiver.manager.NoSuchArchiverException;
+
+
+/**
+ * The abstract studio mojo
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public abstract class AbstractStudioMojo extends AbstractMojo
+{
+
+    /**
+     * To look up Archiver/UnArchiver implementations
+     * 
+     * @parameter expression="${component.org.codehaus.plexus.archiver.manager.ArchiverManager}"
+     * @required
+     * @readonly
+     */
+    protected ArchiverManager archiverManager;
+
+    /**
+     * Location of the file.
+     * 
+     * @parameter expression="${project.build.directory}"
+     * @required
+     * @readonly
+     */
+    protected String buildDirectory;
+
+    /**
+     * Used to look up Artifacts in the remote repository.
+     * 
+     * @parameter expression="${component.org.apache.maven.artifact.factory.ArtifactFactory}"
+     * @required
+     * @readonly
+     */
+    protected org.apache.maven.artifact.factory.ArtifactFactory factory;
+
+    /**
+     * Used to look up Artifacts in the remote repository.
+     * 
+     * @parameter expression="${component.org.apache.maven.artifact.resolver.ArtifactResolver}"
+     * @required
+     * @readonly
+     */
+    protected org.apache.maven.artifact.resolver.ArtifactResolver resolver;
+
+    /**
+     * Flag if execution shall be skipped. Defaults to true.
+     * 
+     * @parameter expression="true"
+     * @required
+     */
+    protected boolean skip;
+
+    /**
+     * Relativ Path to copy libraries to. Defaults to lib
+     * 
+     * @parameter expression="lib"
+     * @required
+     * @readonly
+     */
+    protected String libraryPath;
+
+    /**
+     * Artifact collector, needed to resolve dependencies.
+     * 
+     * @component role="org.apache.maven.artifact.resolver.ArtifactCollector"
+     * @required
+     * @readonly
+     */
+    protected ArtifactCollector artifactCollector;
+
+    /**
+     * @component role="org.apache.maven.artifact.metadata.ArtifactMetadataSource"
+     *            hint="maven"
+     * @required
+     * @readonly
+     */
+    protected ArtifactMetadataSource artifactMetadataSource;
+
+    /**
+     * Location of the local repository.
+     * 
+     * @parameter expression="${localRepository}"
+     * @readonly
+     * @required
+     */
+    protected org.apache.maven.artifact.repository.ArtifactRepository local;
+
+    /**
+     * List of Remote Repositories used by the resolver
+     * 
+     * @parameter expression="${project.remoteArtifactRepositories}"
+     * @readonly
+     * @required
+     */
+    protected List<ArtifactRepository> remoteRepos;
+
+    /**
+     * POM
+     * 
+     * @parameter expression="${project}"
+     * @readonly
+     * @required
+     */
+    protected MavenProject project;
+
+    /**
+     * Output absolute filename for resolved artifacts
+     * 
+     * @optional
+     * @since 2.0
+     * @parameter expression="${outputAbsoluteArtifactFilename}"
+     *            default-value="false"
+     */
+    protected boolean outputAbsoluteArtifactFilename;
+
+
+    /**
+     * Unpack a file to a location
+     * 
+     * @param location
+     *            The location to unpack the file to
+     * @param file
+     *            The file to unpack
+     */
+    protected void unpackToLocation( final File location, final File file ) throws Exception
+    {
+        try
+        {
+            getLog().info( "Unpacking " + file + " to\n                 " + location );
+            location.mkdirs();
+            UnArchiver unArchiver = archiverManager.getUnArchiver( file );
+            unArchiver.setSourceFile( file );
+            unArchiver.setDestDirectory( location );
+            unArchiver.extract();
+        }
+        catch ( NoSuchArchiverException e )
+        {
+            throw new MojoExecutionException( "Unknown archiver type", e );
+        }
+        catch ( ArchiverException e )
+        {
+            e.printStackTrace();
+            throw new MojoExecutionException( "Error unpacking file: " + file + " to: " + location + "\r\n"
+                + e.toString(), e );
+        }
+    }
+
+
+    /**
+     * Pack a given location into a file
+     * 
+     * @param location
+     *            A location to pack
+     * @param file
+     *            The file to pack the location into
+     * @throws Exception
+     *             If an error occurs
+     */
+    protected void packFromLocation( final File location, final File file ) throws MojoExecutionException
+    {
+        try
+        {
+            getLog().info( "Packing " + location + " to\n               " + file );
+            Archiver archiver = archiverManager.getArchiver( file );
+            archiver.setDestFile( file );
+            archiver.setIncludeEmptyDirs( true );
+            archiver.addDirectory( location );
+            archiver.createArchive();
+        }
+        catch ( NoSuchArchiverException e )
+        {
+            throw new MojoExecutionException( "Unknown archiver type", e );
+        }
+        catch ( IOException e )
+        {
+            throw new MojoExecutionException( "Error creating archive", e );
+        }
+        catch ( ArchiverException e )
+        {
+            e.printStackTrace();
+            throw new MojoExecutionException( "Error packing file: " + file + " to: " + location + "\r\n"
+                + e.toString(), e );
+        }
+    }
+
+
+    /**
+     * Resolves the Artifact from the remote repository if nessessary. If no
+     * version is specified, it will be retrieved from the dependency list or
+     * from the DependencyManagement section of the pom.
+     * 
+     * @param artifactItem
+     *            containing information about artifact from plugin
+     *            configuration.
+     * @return Artifact object representing the specified file.
+     * 
+     * @throws MojoExecutionException
+     *             with a message if the version can't be found in
+     *             DependencyManagement.
+     */
+    protected Artifact getArtifact( ArtifactItem artifactItem ) throws MojoExecutionException
+    {
+        Artifact artifact;
+
+        VersionRange vr;
+        try
+        {
+            vr = VersionRange.createFromVersionSpec( artifactItem.getVersion() );
+        }
+        catch ( InvalidVersionSpecificationException e1 )
+        {
+            e1.printStackTrace();
+            vr = VersionRange.createFromVersion( artifactItem.getVersion() );
+        }
+
+        if ( StringUtils.isEmpty( artifactItem.getClassifier() ) )
+        {
+            artifact = factory.createDependencyArtifact( artifactItem.getGroupId(), artifactItem.getArtifactId(), vr,
+                artifactItem.getType(), null, Artifact.SCOPE_COMPILE );
+        }
+        else
+        {
+            artifact = factory.createDependencyArtifact( artifactItem.getGroupId(), artifactItem.getArtifactId(), vr,
+                artifactItem.getType(), artifactItem.getClassifier(), Artifact.SCOPE_COMPILE );
+        }
+
+        try
+        {
+            resolver.resolve( artifact, remoteRepos, local );
+        }
+        catch ( ArtifactResolutionException e )
+        {
+            throw new MojoExecutionException( "Unable to resolve artifact.", e );
+        }
+        catch ( ArtifactNotFoundException e )
+        {
+            throw new MojoExecutionException( "Unable to find artifact.", e );
+        }
+
+        return artifact;
+    }
+
+
+    /**
+     * Tries to find missing version from dependancy list and dependency
+     * management. If found, the artifact is updated with the correct version.
+     * 
+     * It will first look for an exact match on
+     * artifactId/groupId/classifier/type and if it doesn't find a match, it
+     * will try again looking for artifactId and groupId only.
+     * 
+     * @param artifact
+     *            representing configured file.
+     * @throws MojoExecutionException
+     */
+    protected void fillMissingArtifactVersion( ArtifactItem artifact ) throws MojoExecutionException
+    {
+        if ( !findDependencyVersion( artifact, project.getDependencies(), false )
+            && ( project.getDependencyManagement() == null || !findDependencyVersion( artifact, project
+                .getDependencyManagement().getDependencies(), false ) )
+            && !findDependencyVersion( artifact, project.getDependencies(), true )
+            && ( project.getDependencyManagement() == null || !findDependencyVersion( artifact, project
+                .getDependencyManagement().getDependencies(), true ) ) )
+        {
+            throw new MojoExecutionException( "Unable to find artifact version of " + artifact.getGroupId() + ":"
+                + artifact.getArtifactId() + " in either dependency list or in project's dependency management." );
+        }
+    }
+
+
+    /**
+     * Tries to find missing version from a list of dependencies. If found, the
+     * artifact is updated with the correct version.
+     * 
+     * @param artifact
+     *            representing configured file.
+     * @param list
+     *            list of dependencies to search.
+     * @param looseMatch
+     *            only look at artifactId and groupId
+     * @return the found dependency
+     */
+    protected boolean findDependencyVersion( ArtifactItem artifact, List<Dependency> list, boolean looseMatch )
+    {
+        boolean result = false;
+
+        for ( int i = 0; i < list.size(); i++ )
+        {
+            Dependency dependency = list.get( i );
+            if ( StringUtils.equals( dependency.getArtifactId(), artifact.getArtifactId() )
+                && StringUtils.equals( dependency.getGroupId(), artifact.getGroupId() )
+                && ( looseMatch || StringUtils.equals( dependency.getClassifier(), artifact.getClassifier() ) )
+                && ( looseMatch || StringUtils.equals( dependency.getType(), artifact.getType() ) ) )
+            {
+
+                artifact.setVersion( dependency.getVersion() );
+                result = true;
+                break;
+            }
+        }
+        return result;
+    }
+
+
+    /**
+     * Complete the artifacts in the artifactItems list (e.g. complete with
+     * version number)
+     * 
+     * @throws MojoExecutionException
+     */
+    protected void completeArtifactItems( List<ArtifactItem> artifactItems ) throws MojoExecutionException
+    {
+        try
+        {
+            // Get and complete artifacts
+            for ( Iterator<ArtifactItem> artifactItem = artifactItems.iterator(); artifactItem.hasNext(); )
+            {
+                ArtifactItem item = artifactItem.next();
+                // make sure we have a version.
+                if ( StringUtils.isEmpty( item.getVersion() ) )
+                {
+                    fillMissingArtifactVersion( item );
+                }
+                item.setArtifact( this.getArtifact( item ) );
+            }
+        }
+        catch ( Exception e )
+        {
+            throw new MojoExecutionException( "", e );
+        }
+    }
+
+
+    /**
+     * Delete a directory
+     * 
+     * @param path
+     * @return
+     */
+    protected static boolean deleteDirectory( File path )
+    {
+        if ( path.exists() && path.isDirectory() )
+        {
+            for ( File file : path.listFiles() )
+            {
+                if ( file.isDirectory() )
+                {
+                    deleteDirectory( file );
+                }
+                else
+                {
+                    file.delete();
+                }
+            }
+        }
+        return ( path.delete() );
+    }
+
+
+    /**
+     * Return a list of artifacts nonscoped "provided"
+     * 
+     * @return
+     */
+    protected List<Artifact> createArtifactList()
+    {
+        List<Artifact> list = new ArrayList<Artifact>();
+        for ( Iterator<Artifact> artifactItem = project.getArtifacts().iterator(); artifactItem.hasNext(); )
+        {
+            Artifact artifact = ( Artifact ) artifactItem.next();
+            if ( !artifact.getScope().equalsIgnoreCase( "provided" ) )
+            {
+                list.add( artifact );
+            }
+        }
+        return list;
+    }
+
+
+    /**
+     * @return Returns the factory.
+     */
+    public org.apache.maven.artifact.factory.ArtifactFactory getFactory()
+    {
+        return this.factory;
+    }
+
+
+    /**
+     * @param factory
+     *            The factory to set.
+     */
+    public void setFactory( org.apache.maven.artifact.factory.ArtifactFactory factory )
+    {
+        this.factory = factory;
+    }
+
+
+    /**
+     * @return Returns the project.
+     */
+    public MavenProject getProject()
+    {
+        return this.project;
+    }
+
+
+    /**
+     * @return Returns the local.
+     */
+    public org.apache.maven.artifact.repository.ArtifactRepository getLocal()
+    {
+        return this.local;
+    }
+
+
+    /**
+     * @param local
+     *            The local to set.
+     */
+    public void setLocal( org.apache.maven.artifact.repository.ArtifactRepository local )
+    {
+        this.local = local;
+    }
+
+
+    /**
+     * @return Returns the remoteRepos.
+     */
+    public List<ArtifactRepository> getRemoteRepos()
+    {
+        return this.remoteRepos;
+    }
+
+
+    /**
+     * @param remoteRepos
+     *            The remoteRepos to set.
+     */
+    public void setRemoteRepos( List<ArtifactRepository> remoteRepos )
+    {
+        this.remoteRepos = remoteRepos;
+    }
+
+
+    /**
+     * @return Returns the resolver.
+     */
+    public org.apache.maven.artifact.resolver.ArtifactResolver getResolver()
+    {
+        return this.resolver;
+    }
+
+
+    /**
+     * @param resolver
+     *            The resolver to set.
+     */
+    public void setResolver( org.apache.maven.artifact.resolver.ArtifactResolver resolver )
+    {
+        this.resolver = resolver;
+    }
+
+
+    /**
+     * @return Returns the artifactCollector.
+     */
+    public ArtifactCollector getArtifactCollector()
+    {
+        return this.artifactCollector;
+    }
+
+
+    /**
+     * @param theArtifactCollector
+     *            The artifactCollector to set.
+     */
+    public void setArtifactCollector( ArtifactCollector theArtifactCollector )
+    {
+        this.artifactCollector = theArtifactCollector;
+    }
+
+
+    /**
+     * @return Returns the artifactMetadataSource.
+     */
+    public ArtifactMetadataSource getArtifactMetadataSource()
+    {
+        return this.artifactMetadataSource;
+    }
+
+
+    /**
+     * @param theArtifactMetadataSource
+     *            The artifactMetadataSource to set.
+     */
+    public void setArtifactMetadataSource( ArtifactMetadataSource theArtifactMetadataSource )
+    {
+        this.artifactMetadataSource = theArtifactMetadataSource;
+    }
+
+
+    /**
+     * @param libraryPath
+     *            the libraryPath to set
+     */
+    public void setLibraryPath( String pLibraryPath )
+    {
+        this.libraryPath = pLibraryPath;
+    }
+}
\ No newline at end of file

Added: directory/studio/branches/studio-maven/studio-plugin/src/main/java/org/apache/directory/studio/maven/plugins/ArtifactItem.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-maven/studio-plugin/src/main/java/org/apache/directory/studio/maven/plugins/ArtifactItem.java?rev=616766&view=auto
==============================================================================
--- directory/studio/branches/studio-maven/studio-plugin/src/main/java/org/apache/directory/studio/maven/plugins/ArtifactItem.java (added)
+++ directory/studio/branches/studio-maven/studio-plugin/src/main/java/org/apache/directory/studio/maven/plugins/ArtifactItem.java Wed Jan 30 05:59:34 2008
@@ -0,0 +1,236 @@
+/*
+ *  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 org.apache.directory.studio.maven.plugins;
+
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.maven.artifact.Artifact;
+
+
+/**
+ * ArtifactItem represents information specified in the plugin configuration
+ * section for each artifact.
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class ArtifactItem
+{
+    /**
+     * Group Id of Artifact
+     * 
+     * @parameter
+     * @required
+     */
+    private String groupId;
+
+    /**
+     * Name of Artifact
+     * 
+     * @parameter
+     * @required
+     */
+    private String artifactId;
+
+    /**
+     * Version of Artifact
+     * 
+     * @parameter
+     */
+    private String version = null;
+
+    /**
+     * Type of Artifact (War,Jar,etc)
+     * 
+     * @parameter
+     * @required
+     */
+    private String type = "jar";
+
+    /**
+     * Classifier for Artifact (tests,sources,etc)
+     * 
+     * @parameter
+     */
+    private String classifier;
+
+    /**
+     * Artifact Item
+     */
+    private Artifact artifact;
+
+
+    public ArtifactItem()
+    {
+        // default constructor
+    }
+
+
+    public ArtifactItem( Artifact artifact )
+    {
+        this.setArtifact( artifact );
+        this.setArtifactId( artifact.getArtifactId() );
+        this.setClassifier( artifact.getClassifier() );
+        this.setGroupId( artifact.getGroupId() );
+        this.setType( artifact.getType() );
+        this.setVersion( artifact.getVersion() );
+    }
+
+
+    private String filterEmptyString( String in )
+    {
+        if ( in == null || in.equals( "" ) )
+        {
+            return null;
+        }
+        else
+        {
+            return in;
+        }
+    }
+
+
+    /**
+     * @return Returns the artifactId.
+     */
+    public String getArtifactId()
+    {
+        return artifactId;
+    }
+
+
+    /**
+     * @param artifactId
+     *            The artifactId to set.
+     */
+    public void setArtifactId( String artifact )
+    {
+        this.artifactId = filterEmptyString( artifact );
+    }
+
+
+    /**
+     * @return Returns the groupId.
+     */
+    public String getGroupId()
+    {
+        return groupId;
+    }
+
+
+    /**
+     * @param groupId
+     *            The groupId to set.
+     */
+    public void setGroupId( String groupId )
+    {
+        this.groupId = filterEmptyString( groupId );
+    }
+
+
+    /**
+     * @return Returns the type.
+     */
+    public String getType()
+    {
+        return type;
+    }
+
+
+    /**
+     * @param type
+     *            The type to set.
+     */
+    public void setType( String type )
+    {
+        this.type = filterEmptyString( type );
+    }
+
+
+    /**
+     * @return Returns the version.
+     */
+    public String getVersion()
+    {
+        return version;
+    }
+
+
+    /**
+     * @param version
+     *            The version to set.
+     */
+    public void setVersion( String version )
+    {
+        this.version = filterEmptyString( version );
+    }
+
+
+    /**
+     * @return Classifier.
+     */
+    public String getClassifier()
+    {
+        return classifier;
+    }
+
+
+    /**
+     * @param classifier
+     *            Classifier.
+     */
+    public void setClassifier( String classifier )
+    {
+        this.classifier = filterEmptyString( classifier );
+    }
+
+
+    public String toString()
+    {
+        if ( this.classifier == null )
+        {
+            return groupId + ":" + artifactId + ":" + StringUtils.defaultString( version, "?" ) + ":" + type;
+        }
+        else
+        {
+            return groupId + ":" + artifactId + ":" + classifier + ":" + StringUtils.defaultString( version, "?" )
+                + ":" + type;
+        }
+    }
+
+
+    /**
+     * @return Returns the artifact.
+     */
+    public Artifact getArtifact()
+    {
+        return this.artifact;
+    }
+
+
+    /**
+     * @param artifact
+     *            The artifact to set.
+     */
+    public void setArtifact( Artifact artifact )
+    {
+        this.artifact = artifact;
+    }
+
+}

Added: directory/studio/branches/studio-maven/studio-plugin/src/main/java/org/apache/directory/studio/maven/plugins/StudioCleanMojo.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-maven/studio-plugin/src/main/java/org/apache/directory/studio/maven/plugins/StudioCleanMojo.java?rev=616766&view=auto
==============================================================================
--- directory/studio/branches/studio-maven/studio-plugin/src/main/java/org/apache/directory/studio/maven/plugins/StudioCleanMojo.java (added)
+++ directory/studio/branches/studio-maven/studio-plugin/src/main/java/org/apache/directory/studio/maven/plugins/StudioCleanMojo.java Wed Jan 30 05:59:34 2008
@@ -0,0 +1,63 @@
+/*
+ *  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 org.apache.directory.studio.maven.plugins;
+
+
+import java.io.File;
+
+import org.apache.maven.plugin.MojoExecutionException;
+
+
+/**
+ * Clean stuff generated by studio:eclipse
+ * 
+ * @goal clean
+ * @execute phase="generate-resources"
+ * @description Clean stuff generated by studio:eclipse
+ * @requiresProject
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class StudioCleanMojo extends AbstractStudioMojo
+{
+
+    private final String MAVEN_ECLIPSE_XML = "maven-eclipse.xml";
+    private final String EXTERNAL_TOOL_BUILDERS_DIR = ".externalToolBuilders";
+
+    public void execute() throws MojoExecutionException
+    {
+        try
+        {
+            File file = new File( project.getBasedir(), MAVEN_ECLIPSE_XML );
+            getLog().info( "Deleting " + file );
+            file.delete();
+            file = new File( project.getBasedir(), EXTERNAL_TOOL_BUILDERS_DIR );
+            getLog().info( "Deleting " + file );
+            deleteDirectory( file );
+            file = new File( project.getBasedir(), libraryPath );
+            getLog().info( "Deleting " + file );
+            deleteDirectory( file );
+        }
+        catch ( Exception e )
+        {
+            getLog().error( e );
+        }
+    }
+}

Added: directory/studio/branches/studio-maven/studio-plugin/src/main/java/org/apache/directory/studio/maven/plugins/StudioCopyEclipseDependencyMojo.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-maven/studio-plugin/src/main/java/org/apache/directory/studio/maven/plugins/StudioCopyEclipseDependencyMojo.java?rev=616766&view=auto
==============================================================================
--- directory/studio/branches/studio-maven/studio-plugin/src/main/java/org/apache/directory/studio/maven/plugins/StudioCopyEclipseDependencyMojo.java (added)
+++ directory/studio/branches/studio-maven/studio-plugin/src/main/java/org/apache/directory/studio/maven/plugins/StudioCopyEclipseDependencyMojo.java Wed Jan 30 05:59:34 2008
@@ -0,0 +1,116 @@
+/*
+ *  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 org.apache.directory.studio.maven.plugins;
+
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Iterator;
+
+import org.apache.commons.io.FileUtils;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.shared.osgi.DefaultMaven2OsgiConverter;
+import org.apache.maven.shared.osgi.Maven2OsgiConverter;
+
+
+/**
+ * Copy a set of artifacts to a configured output directory by replacing the
+ * separator between artifactId and version by an underscore instead of a dash.
+ * 
+ * @goal copy-eclipse-artifact
+ * @description Replace the separator between artifactId and version by an
+ *              underscore instead of a dash and copy the artifact to a given
+ *              destination directory
+ * @requiresProject
+ * @requiresDependencyResolution runtime
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class StudioCopyEclipseDependencyMojo extends AbstractStudioMojo
+{
+
+    /**
+     * Collection of ArtifactItems to work on. (ArtifactItem contains groupId,
+     * artifactId, version, type, classifier, location, destFile, markerFile and
+     * overwrite.) See "Usage" and "Javadoc" for details.
+     * 
+     * @parameter
+     * @required
+     */
+    protected ArrayList<ArtifactItem> artifactItems;
+
+    /**
+     * Location of the file.
+     * 
+     * @parameter expression="${project.build.directory}"
+     * @required
+     */
+    private File destinationDirectory;
+
+
+    /**
+     * @param destinationDirectory
+     *            the destinationDirectory to set
+     */
+    public void setDestinationDirectory( File destinationDirectory )
+    {
+        this.destinationDirectory = destinationDirectory;
+    }
+
+
+    public void execute() throws MojoExecutionException
+    {
+        final Maven2OsgiConverter maven2OsgiConverter = new DefaultMaven2OsgiConverter();
+        completeArtifactItems( artifactItems );
+
+        if ( !destinationDirectory.exists() && !destinationDirectory.mkdirs() )
+        {
+            throw new MojoExecutionException( "Can't create directory " + destinationDirectory );
+        }
+
+        for ( Iterator<ArtifactItem> artifactItem = artifactItems.iterator(); artifactItem.hasNext(); )
+        {
+            ArtifactItem item = artifactItem.next();
+            final File destFile = new File( destinationDirectory.getAbsoluteFile() + File.separator
+                + maven2OsgiConverter.getBundleFileName( item.getArtifact() ) );
+            getLog().info(
+                "Copying artifact " + item.getArtifactId() + " to\n               " + destFile.getAbsolutePath() );
+            try
+            {
+                FileUtils.copyFile( item.getArtifact().getFile(), destFile );
+            }
+            catch ( IOException ioe )
+            {
+                throw new MojoExecutionException( "Can't copy file.", ioe );
+            }
+        }
+    }
+
+
+    /**
+     * @param artifactItems
+     *            the artifactItems to set
+     */
+    public void setArtifactItems( ArrayList<ArtifactItem> artifactItems )
+    {
+        this.artifactItems = artifactItems;
+    }
+}

Added: directory/studio/branches/studio-maven/studio-plugin/src/main/java/org/apache/directory/studio/maven/plugins/StudioEclipseMojo.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-maven/studio-plugin/src/main/java/org/apache/directory/studio/maven/plugins/StudioEclipseMojo.java?rev=616766&view=auto
==============================================================================
--- directory/studio/branches/studio-maven/studio-plugin/src/main/java/org/apache/directory/studio/maven/plugins/StudioEclipseMojo.java (added)
+++ directory/studio/branches/studio-maven/studio-plugin/src/main/java/org/apache/directory/studio/maven/plugins/StudioEclipseMojo.java Wed Jan 30 05:59:34 2008
@@ -0,0 +1,348 @@
+/*
+ *  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 org.apache.directory.studio.maven.plugins;
+
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStreamWriter;
+import java.io.Writer;
+import java.util.List;
+
+import org.apache.commons.io.FileUtils;
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.shared.osgi.DefaultMaven2OsgiConverter;
+import org.apache.maven.shared.osgi.Maven2OsgiConverter;
+import org.codehaus.plexus.util.xml.PrettyPrintXMLWriter;
+import org.codehaus.plexus.util.xml.Xpp3Dom;
+import org.codehaus.plexus.util.xml.Xpp3DomBuilder;
+import org.codehaus.plexus.util.xml.Xpp3DomWriter;
+import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
+
+
+/**
+ * Prepares for eclipse: 
+ * <p>
+ * <ul>
+ * <li>Copy artifacts nonscoped "provided" to ${basedir}/lib</li>
+ * <li>Add artifacts nonscoped "provided" to Bundle-ClassPath ind MANIFEST.MF</li>
+ * <li>Adapt ${basedir}/.classpath for artifacts nonscoped "provided"</li>
+ * </ul>
+ * </p>
+ * 
+ * @goal eclipse
+ * @execute phase="generate-resources"
+ * @description Copy artifacts nonscoped "provided" to libraryPath, Add
+ *              artifacts nonscoped "provided" to Bundle-ClassPath and
+ *              MANIFEST.MF, Adapt ${basedir}/.classpath for artifacts nonscoped
+ *              "provided"
+ * @requiresProject
+ * @requiresDependencyResolution runtime
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class StudioEclipseMojo extends AbstractStudioMojo
+{
+
+    /**
+     * Constant used for newline.
+     */
+    private static final String NEWLINE = "\n";
+
+    /**
+     * Bundle-ClassPath: updated with the list of dependencies.
+     */
+    public final static String ENTRY_BUNDLE_CLASSPATH = "Bundle-ClassPath:";
+
+    /**
+     * Bundle symbolic name: updated with the artifact id.
+     */
+    public final static String ENTRY_BUNDLE_SYMBOLICNAME = "Bundle-SymbolicName:";
+
+
+    public void execute() throws MojoExecutionException
+    {
+        if ( !skip )
+        {
+            try
+            {
+                // Create list of used artifacts
+                final List<Artifact> artifactList = createArtifactList();
+
+                // copy Artifacts
+                copyArtifacts( artifactList );
+
+                // Update Bundle-Classpath in MANIFEST.MF
+                updateManifest( artifactList );
+
+                // Update .classpath
+                updateDotClasspath( artifactList );
+
+                updateDotProject();
+                removeMavenEclipseXml();
+                removeDotExternalToolBuilders();
+
+            } catch (FileNotFoundException e)
+            {
+                getLog().error("Please run eclipse:eclipse first to create .classpath, e.g. mvn eclipse:eclipse studio:eclipse.", e);
+            }
+            catch ( Exception e )
+            {
+                getLog().error( e );
+            }
+        }
+    }
+
+
+    /**
+     * Copy artifacts to ${basedir}/lib
+     * 
+     * @param list
+     * @throws IOException
+     */
+    private void copyArtifacts( final List<Artifact> list ) throws IOException
+    {
+        // Only proceed when we have artifacts to process
+        if ( !list.isEmpty() )
+        {
+            final File copyDir = new File( project.getBasedir(), libraryPath );
+
+            if ( !copyDir.exists() )
+                copyDir.mkdirs();
+
+            for ( Artifact artifact : list )
+            {
+                if ( !artifact.getScope().equalsIgnoreCase( "test" ) )
+                {
+                    final File destFile = new File( copyDir, artifact.getFile().getName() );
+                    FileUtils.copyFile( artifact.getFile(), destFile );
+                    getLog().info( "Copying " + artifact.getFile() + " to " + destFile );
+                }
+            }
+        }
+    }
+
+
+    /**
+     * Updates the Bundle-ClassPath entry in the manifest file
+     * 
+     * @param list
+     * @throws FileNotFoundException
+     * @throws IOException
+     */
+    private void updateManifest( final List<Artifact> list ) throws FileNotFoundException, IOException
+    {
+        final Maven2OsgiConverter maven2OsgiConverter = new DefaultMaven2OsgiConverter();
+        final File manifestFile = new File( project.getBasedir(), "META-INF/MANIFEST.MF" );
+        getLog().info( "Update Bundle-Classpath in " + manifestFile );
+
+        // Build Bundle-ClassPath entry
+        final StringBuilder bundleClasspath = new StringBuilder( " ." );
+        for ( Artifact artifact : list )
+        {
+            if ( !artifact.getScope().equalsIgnoreCase( "test" ) )
+            {
+                bundleClasspath.append( "," ).append( NEWLINE ).append( " " ).append( libraryPath ).append(
+                    File.separator ).append( artifact.getFile().getName() );
+            }
+        }
+
+        boolean inBundleClasspathEntry = false;
+
+        // Read existing MANIFEST.MF and add existing entries
+        // to StringBuilder exept Bundle-ClassPath entry
+        StringBuilder manifestSb = new StringBuilder();
+        BufferedReader in = new BufferedReader( new InputStreamReader( new FileInputStream( manifestFile ), "UTF-8" ) );
+        String line;
+        while ( ( line = in.readLine() ) != null )
+        {
+            if ( inBundleClasspathEntry && line.indexOf( ":" ) > -1 )
+            {
+                inBundleClasspathEntry = false;
+            }
+            else if ( inBundleClasspathEntry )
+            {
+                continue;
+            }
+
+            String name = line.substring( 0, line.indexOf( ":" ) + 1 );
+
+            if ( !name.equalsIgnoreCase( ENTRY_BUNDLE_CLASSPATH ) )
+            {
+                if ( name.equalsIgnoreCase( ENTRY_BUNDLE_SYMBOLICNAME ) )
+                {
+                    // get OSGI Bundle Name
+                    manifestSb.append( ENTRY_BUNDLE_SYMBOLICNAME );
+                    manifestSb.append( " " );
+                    manifestSb.append( maven2OsgiConverter.getBundleSymbolicName( project.getArtifact() ) );
+                    manifestSb.append( ";singleton:=true" );
+                    manifestSb.append( NEWLINE );
+                }
+                else
+                {
+                    manifestSb.append( line ).append( NEWLINE );
+                }
+            }
+            else
+            {
+                inBundleClasspathEntry = true;
+            }
+        }
+
+        // Add Bundle-ClassPath entry
+        manifestSb.append( ENTRY_BUNDLE_CLASSPATH ).append( bundleClasspath ).append( NEWLINE );
+
+        // Write MANIFEST.MF
+        Writer out = new OutputStreamWriter( new FileOutputStream( manifestFile ), "UTF-8" );
+        out.write( manifestSb.toString() );
+        out.flush();
+        out.close();
+    }
+
+
+    /**
+     * Adapt the ${basedir}/.classpath
+     * 
+     * @param list
+     */
+    private void updateDotClasspath( List<Artifact> list ) throws IOException, XmlPullParserException
+    {
+        getLog().info( "Update .classpath in " + project.getBasedir() );
+        final InputStream is = new FileInputStream( new File( project.getBasedir(), ".classpath" ) );
+        Xpp3Dom dom = Xpp3DomBuilder.build( is, "UTF-8" );
+        int cnt = 0;
+        for ( Xpp3Dom cpEntry : dom.getChildren( "classpathentry" ) )
+        {
+            if ( cpEntry.getAttribute( "kind" ).equals( "lib" ) )
+            {
+                dom.removeChild( cnt );
+                cnt--;
+            }
+            cnt++;
+        }
+
+        Xpp3Dom entry;
+        for ( Artifact artifact : list )
+        {
+            if ( artifact.getScope().equalsIgnoreCase( "test" ) )
+            {
+                entry = new Xpp3Dom( "classpathentry" );
+                entry.setAttribute( "kind", "lib" );
+                entry.setAttribute( "path", ( new StringBuilder() ).append( libraryPath ).append( File.separator )
+                    .append( artifact.getFile().getName() ).toString() );
+            }
+            else
+            {
+                entry = new Xpp3Dom( "classpathentry" );
+                entry.setAttribute( "exported", "true" );
+                entry.setAttribute( "kind", "lib" );
+                entry.setAttribute( "path", ( new StringBuilder() ).append( libraryPath ).append( File.separator )
+                    .append( artifact.getFile().getName() ).toString() );
+            }
+            dom.addChild( entry );
+        }
+
+        is.close();
+        Writer w = new OutputStreamWriter( new FileOutputStream( new File( project.getBasedir(), ".classpath" ) ),
+            "UTF-8" );
+        org.codehaus.plexus.util.xml.XMLWriter writer = new PrettyPrintXMLWriter( w );
+        Xpp3DomWriter.write( writer, dom );
+        w.flush();
+        w.close();
+    }
+
+
+    /**
+     * Adapt the ${basedir}/.project
+     * 
+     * @param list
+     */
+    private void updateDotProject() throws IOException, XmlPullParserException
+    {
+        getLog().info( "Update .project in " + project.getBasedir() );
+        InputStream is = new FileInputStream( new File( project.getBasedir(), ".project" ) );
+        Xpp3Dom dom = Xpp3DomBuilder.build( is, "UTF-8" );
+        int cnt = 0;
+        for ( Xpp3Dom cpEntry : dom.getChild( "buildSpec" ).getChildren( "buildCommand" ) )
+        {
+            if ( cpEntry.getChild( "name" ).getValue().equals( "org.eclipse.ui.externaltools.ExternalToolBuilder" ) )
+            {
+                dom.getChild( "buildSpec" ).removeChild( cnt );
+                cnt--;
+            }
+            cnt++;
+        }
+
+        removeChildFromDom( dom, "linkedResources" );
+        removeChildFromDom( dom, "projects" );
+
+        is.close();
+        Writer w = new OutputStreamWriter( new FileOutputStream( new File( project.getBasedir(), ".project" ) ),
+            "UTF-8" );
+        org.codehaus.plexus.util.xml.XMLWriter writer = new PrettyPrintXMLWriter( w );
+        Xpp3DomWriter.write( writer, dom );
+        w.flush();
+        w.close();
+    }
+
+
+    /**
+     * remove ${basedir}/maven-eclipse.xml
+     */
+    void removeMavenEclipseXml()
+    {
+        File file = new File( project.getBasedir(), "maven-eclipse.xml" );
+        if ( file.exists() )
+            file.delete();
+    }
+
+
+    /**
+     * Adapt the ${basedir}/.externalToolBuilders
+     */
+    void removeDotExternalToolBuilders()
+    {
+        File file = new File( project.getBasedir(), ".externalToolBuilders" );
+        if ( file.exists() )
+            deleteDirectory( file );
+    }
+
+
+    private void removeChildFromDom( Xpp3Dom dom, String childName )
+    {
+        int cnt = 0;
+        for ( Xpp3Dom child : dom.getChildren() )
+        {
+            if ( child.getName().equals( childName ) )
+            {
+                dom.removeChild( cnt );
+                cnt -= 1;
+            }
+            cnt += 1;
+        }
+    }
+}

Added: directory/studio/branches/studio-maven/studio-plugin/src/main/java/org/apache/directory/studio/maven/plugins/StudioPrepareJarPackageMojo.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-maven/studio-plugin/src/main/java/org/apache/directory/studio/maven/plugins/StudioPrepareJarPackageMojo.java?rev=616766&view=auto
==============================================================================
--- directory/studio/branches/studio-maven/studio-plugin/src/main/java/org/apache/directory/studio/maven/plugins/StudioPrepareJarPackageMojo.java (added)
+++ directory/studio/branches/studio-maven/studio-plugin/src/main/java/org/apache/directory/studio/maven/plugins/StudioPrepareJarPackageMojo.java Wed Jan 30 05:59:34 2008
@@ -0,0 +1,101 @@
+/*
+ *  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 org.apache.directory.studio.maven.plugins;
+
+
+import java.io.File;
+import java.io.IOException;
+import java.util.List;
+
+import org.apache.commons.io.FileUtils;
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.plugin.MojoExecutionException;
+
+
+/**
+ * Prepares for jar: Copy artifacts nonscoped "provided" to
+ * ${project.build.outputDirectory}/libraryPath
+ * 
+ * @goal prepare-jar-package
+ * @phase process-resources
+ * @aggregate
+ * @description Prepares for jar: Copy artifacts nonscoped "provided" to
+ *              ${project.build.outputDirectory}/libraryPath
+ * @requiresProject
+ * @requiresDependencyResolution runtime
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class StudioPrepareJarPackageMojo extends AbstractStudioMojo
+{
+
+    /**
+     * Directory containing the classes.
+     * 
+     * @parameter expression="${project.build.outputDirectory}"
+     * @readonly
+     * @required
+     */
+    private File classesOutDir;
+
+
+    public void execute() throws MojoExecutionException
+    {
+        try
+        {
+            // Create list of used artifacts
+            final List<Artifact> artifactList = createArtifactList();
+
+            // copy Artifacts
+            copyArtifacts( artifactList );
+
+        }
+        catch ( Exception e )
+        {
+            getLog().error( e );
+        }
+    }
+
+
+    /**
+     * Copy artifacts to ${basedir}/lib
+     * 
+     * @param list
+     * @throws IOException
+     */
+    private void copyArtifacts( final List<Artifact> list ) throws IOException
+    {
+        // Only proceed when we have artifacts to process
+        if ( !list.isEmpty() )
+        {
+            final File copyDir = new File( classesOutDir, libraryPath );
+
+            if ( !copyDir.exists() )
+                copyDir.mkdirs();
+
+            for ( Artifact artifact : list )
+            {
+                final File destFile = new File( copyDir, artifact.getFile().getName() );
+                FileUtils.copyFile( artifact.getFile(), destFile );
+                getLog().info( "Copying " + artifact.getFile() + " to\n               " + destFile );
+            }
+        }
+    }
+}

Added: directory/studio/branches/studio-maven/studio-plugin/src/main/java/org/apache/directory/studio/maven/plugins/StudioReplaceFileInJarMojo.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-maven/studio-plugin/src/main/java/org/apache/directory/studio/maven/plugins/StudioReplaceFileInJarMojo.java?rev=616766&view=auto
==============================================================================
--- directory/studio/branches/studio-maven/studio-plugin/src/main/java/org/apache/directory/studio/maven/plugins/StudioReplaceFileInJarMojo.java (added)
+++ directory/studio/branches/studio-maven/studio-plugin/src/main/java/org/apache/directory/studio/maven/plugins/StudioReplaceFileInJarMojo.java Wed Jan 30 05:59:34 2008
@@ -0,0 +1,140 @@
+/*
+ *  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 org.apache.directory.studio.maven.plugins;
+
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Iterator;
+
+import org.apache.commons.io.FileUtils;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.shared.osgi.DefaultMaven2OsgiConverter;
+import org.apache.maven.shared.osgi.Maven2OsgiConverter;
+
+
+/**
+ * Add ro replace file in existing, distributed artifact
+ * 
+ * @goal replace-file-in-eclipse-artifact
+ * @description Add/Replace a file within a given eclipse artifact at a specific
+ *              location (zip or jar file)
+ * @requiresProject
+ * @requiresDependencyResolution runtime
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class StudioReplaceFileInJarMojo extends AbstractStudioMojo
+{
+
+    /**
+     * Collection of ArtifactItems to work on. (ArtifactItem contains groupId,
+     * artifactId, version, type, classifier, location, destFile, markerFile and
+     * overwrite.) See "Usage" and "Javadoc" for details.
+     * 
+     * @parameter
+     * @required
+     */
+    protected ArrayList<ArtifactItem> artifactItems;
+
+    /**
+     * FinalName of the jar file
+     * 
+     * @parameter
+     * @required
+     */
+    private File inputFile;
+
+    /**
+     * Location of the file.
+     * 
+     * @parameter expression="${project.build.directory}"
+     * @required
+     */
+    private File destinationDirectory;
+
+    /**
+     * Tmp work directory for this plugin
+     * 
+     * @parameter expression="${project.build.directory}/ReplaceFileInJarMojo/"
+     * @required
+     * @readonly
+     */
+    private String pluginWorkDir;
+
+
+    /**
+     * @param destinationDirectory
+     *            the destinationDirectory to set
+     */
+    public void setDestinationDirectory( File destinationDirectory )
+    {
+        this.destinationDirectory = destinationDirectory;
+    }
+
+
+    /**
+     * @param inputFile
+     *            the inputFile to set
+     */
+    public void setInputFile( File inputFile )
+    {
+        this.inputFile = inputFile;
+    }
+
+
+    public void execute() throws MojoExecutionException
+    {
+        final Maven2OsgiConverter maven2OsgiConverter = new DefaultMaven2OsgiConverter();
+
+        completeArtifactItems( artifactItems );
+
+        // Add file to packed file
+        for ( Iterator<ArtifactItem> artifactItem = artifactItems.iterator(); artifactItem.hasNext(); )
+        {
+            ArtifactItem item = artifactItem.next();
+            try
+            {
+                final File zipFile = new File( destinationDirectory.getAbsoluteFile() + File.separator
+                    + maven2OsgiConverter.getBundleFileName( item.getArtifact() ) );
+                final File tmpDir = new File( pluginWorkDir + item.getArtifact().getArtifactId() );
+                unpackToLocation( tmpDir, zipFile );
+                getLog().info( "Adding " + inputFile + " to\n              " + zipFile );
+                FileUtils.copyFileToDirectory( inputFile, tmpDir );
+                packFromLocation( tmpDir, zipFile );
+
+            }
+            catch ( Exception e )
+            {
+                throw new MojoExecutionException( "", e );
+            }
+        }
+    }
+
+
+    /**
+     * @param artifactItems
+     *            the artifactItems to set
+     */
+    public void setArtifactItems( ArrayList<ArtifactItem> artifactItems )
+    {
+        this.artifactItems = artifactItems;
+    }
+}

Added: directory/studio/branches/studio-maven/studio-plugin/src/main/java/org/apache/directory/studio/maven/plugins/StudioUnpackPrefixedMojo.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-maven/studio-plugin/src/main/java/org/apache/directory/studio/maven/plugins/StudioUnpackPrefixedMojo.java?rev=616766&view=auto
==============================================================================
--- directory/studio/branches/studio-maven/studio-plugin/src/main/java/org/apache/directory/studio/maven/plugins/StudioUnpackPrefixedMojo.java (added)
+++ directory/studio/branches/studio-maven/studio-plugin/src/main/java/org/apache/directory/studio/maven/plugins/StudioUnpackPrefixedMojo.java Wed Jan 30 05:59:34 2008
@@ -0,0 +1,107 @@
+/*
+ *  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 org.apache.directory.studio.maven.plugins;
+
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Iterator;
+
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.shared.osgi.DefaultMaven2OsgiConverter;
+import org.apache.maven.shared.osgi.Maven2OsgiConverter;
+
+
+/**
+ * Prefixes the unpack of an artifact into a given directory with a directory
+ * named based on the artifacts final name
+ * 
+ * @goal unpack-with-artifactid-prefix
+ * @description Prefixes the unpack of an artifact into a given directory with a
+ *              directory named based on the artifacts final name
+ * @requiresProject
+ * @requiresDependencyResolution runtime
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class StudioUnpackPrefixedMojo extends AbstractStudioMojo
+{
+
+    /**
+     * Collection of ArtifactItems to work on. (ArtifactItem contains groupId,
+     * artifactId, version, type, classifier, location, destFile, markerFile and
+     * overwrite.) See "Usage" and "Javadoc" for details.
+     * 
+     * @parameter
+     * @required
+     */
+    protected ArrayList<ArtifactItem> artifactItems;
+
+    /**
+     * Location of the file.
+     * 
+     * @parameter expression="${project.build.directory}"
+     * @required
+     */
+    private File outputDirectory;
+
+
+    /**
+     * @param outputDirectory
+     *            the outputDirectory to set
+     */
+    public void setOutputDirectory( File outputDirectory )
+    {
+        this.outputDirectory = outputDirectory;
+    }
+
+
+    public void execute() throws MojoExecutionException
+    {
+        final Maven2OsgiConverter maven2OsgiConverter = new DefaultMaven2OsgiConverter();
+        completeArtifactItems( artifactItems );
+        for ( Iterator<ArtifactItem> artifactItem = artifactItems.iterator(); artifactItem.hasNext(); )
+        {
+            ArtifactItem item = artifactItem.next();
+            try
+            {
+                final File tmpDir = new File( outputDirectory.getAbsoluteFile() + File.separator
+                    + maven2OsgiConverter.getBundleSymbolicName( item.getArtifact() ) + "_"
+                    + maven2OsgiConverter.getVersion( item.getArtifact() ) );
+                unpackToLocation( tmpDir, item.getArtifact().getFile() );
+            }
+            catch ( Exception e )
+            {
+                throw new MojoExecutionException( "", e );
+            }
+        }
+    }
+
+
+    /**
+     * @param artifactItems
+     *            the artifactItems to set
+     */
+    public void setArtifactItems( ArrayList<ArtifactItem> artifactItems )
+    {
+        this.artifactItems = artifactItems;
+    }
+
+}

Added: directory/studio/branches/studio-maven/studio-plugin/src/site/apt/examples/copy-eclipse-artifact.apt
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-maven/studio-plugin/src/site/apt/examples/copy-eclipse-artifact.apt?rev=616766&view=auto
==============================================================================
--- directory/studio/branches/studio-maven/studio-plugin/src/site/apt/examples/copy-eclipse-artifact.apt (added)
+++ directory/studio/branches/studio-maven/studio-plugin/src/site/apt/examples/copy-eclipse-artifact.apt Wed Jan 30 05:59:34 2008
@@ -0,0 +1,64 @@
+~~ 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.    
+ 
+  ------
+  Add or replace a file to existing, distributed artifact
+  ------
+  Apache Directory Project
+  ------
+  Oct 2007
+  ------
+
+Add or replace a file to existing, distributed artifact
+
+  Adds or replaces a file in an existing, distributed artifact.
+
++---+
+<project>
+  [...]
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.directory.studio</groupId>
+        <artifactId>maven-studio-plugin</artifactId>
+        <executions>
+          <execution>
+            <id>copy-directory-studio-plugins</id>
+            <phase>process-resources</phase>
+            <goals>
+              <goal>copy-eclipse-artifact</goal>
+            </goals>
+            <configuration>
+              <destinationDirectory>${studio-dir}/plugins</destinationDirectory>
+              <artifactItems>
+                <artifactItem>
+                  <groupId>org.apache.directory.studio</groupId>
+                  <artifactId>${pom.groupId}.ldapbrowser.core</artifactId>
+                </artifactItem>
+                <artifactItem>
+                  <groupId>org.apache.directory.studio</groupId>
+                  <artifactId>${pom.groupId}.ldapbrowser.common</artifactId>
+                </artifactItem>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+  [...]
+</project>
++---+

Added: directory/studio/branches/studio-maven/studio-plugin/src/site/apt/examples/prepare-jar-package.apt
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-maven/studio-plugin/src/site/apt/examples/prepare-jar-package.apt?rev=616766&view=auto
==============================================================================
--- directory/studio/branches/studio-maven/studio-plugin/src/site/apt/examples/prepare-jar-package.apt (added)
+++ directory/studio/branches/studio-maven/studio-plugin/src/site/apt/examples/prepare-jar-package.apt Wed Jan 30 05:59:34 2008
@@ -0,0 +1,53 @@
+~~ 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.    
+ 
+  ------
+  Add or replace a file to existing, distributed artifact
+  ------
+  Apache Directory Project
+  ------
+  Oct 2007
+  ------
+
+Add or replace a file to existing, distributed artifact
+
+  Adds or replaces a file in an existing, distributed artifact.
+
++---+
+<project>
+  [...]
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.directory.studio</groupId>
+        <artifactId>maven-studio-plugin</artifactId>
+        <configuration>
+          <skip>false</skip>
+        </configuration>
+        <executions>
+          <execution>
+            <goals>
+              <goal>prepare-jar-package</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+  [...]
+</project>
++---+

Added: directory/studio/branches/studio-maven/studio-plugin/src/site/apt/examples/replace-file-in-eclipse-artifact.apt
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-maven/studio-plugin/src/site/apt/examples/replace-file-in-eclipse-artifact.apt?rev=616766&view=auto
==============================================================================
--- directory/studio/branches/studio-maven/studio-plugin/src/site/apt/examples/replace-file-in-eclipse-artifact.apt (added)
+++ directory/studio/branches/studio-maven/studio-plugin/src/site/apt/examples/replace-file-in-eclipse-artifact.apt Wed Jan 30 05:59:34 2008
@@ -0,0 +1,64 @@
+~~ 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.    
+ 
+  ------
+  Add or replace a file to existing, distributed artifact
+  ------
+  Apache Directory Project
+  ------
+  Oct 2007
+  ------
+
+Add or replace a file to existing, distributed artifact
+
+  Adds or replaces a file in an existing, distributed artifact.
+
++---+
+<project>
+  [...]
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.directory.studio</groupId>
+        <artifactId>maven-studio-plugin</artifactId>
+        <executions>
+          <execution>
+            <id>replace-plugin.xml-in-org.eclipse.search</id>
+            <phase>process-resources</phase>
+            <goals>
+              <goal>replace-file-in-eclipse-artifact</goal>
+            </goals>
+            <configuration>
+              <inputFile>src/main/configuration/org.eclipse.search/plugin.xml</inputFile>
+              <destinationDirectory>${studio-dir}/plugins</destinationDirectory>
+              <overWrite>false</overWrite>
+              <outputDirectory>target/eclipse/plugins</outputDirectory>
+              <artifactItems>
+                <artifactItem>
+                  <groupId>org.eclipse</groupId>
+                  <artifactId>org.eclipse.search</artifactId>
+                </artifactItem>
+              </artifactItems>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+  [...]
+</project>
++---+

Added: directory/studio/branches/studio-maven/studio-plugin/src/site/apt/examples/unpack-with-artifactid-prefix.apt
URL: http://svn.apache.org/viewvc/directory/studio/branches/studio-maven/studio-plugin/src/site/apt/examples/unpack-with-artifactid-prefix.apt?rev=616766&view=auto
==============================================================================
--- directory/studio/branches/studio-maven/studio-plugin/src/site/apt/examples/unpack-with-artifactid-prefix.apt (added)
+++ directory/studio/branches/studio-maven/studio-plugin/src/site/apt/examples/unpack-with-artifactid-prefix.apt Wed Jan 30 05:59:34 2008
@@ -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.    
+ 
+  ------
+  Unpack with prefix
+  ------
+  Apache Directory Project
+  ------
+  Oct 2007
+  ------
+
+Unpack with prefix
+
+  Unpack an artifact in a desired location and put the artifact content into a directory
+  named like the final artifacts name (This is mainly used to unpack a *-feature.jar).
+
++---+
+<project>
+  [...]
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.directory.studio</groupId>
+        <artifactId>maven-studio-plugin</artifactId>
+        <executions>
+        <executions>
+          <execution>
+            <id>unpack-with-artifactid-prefix</id>
+            <phase>process-resources</phase>
+            <goals>
+              <goal>unpack-with-artifactid-prefix</goal>
+            </goals>
+            <configuration>
+              <outputDirectory>target/features</outputDirectory>
+              <artifactItems>
+                <artifactItem>
+                  <groupId>org.apache.directory.studio</groupId>
+                  <artifactId>${pom.groupId}.feature</artifactId>
+                </artifactItem>
+                <artifactItem>
+                  <groupId>org.apache.directory.studio</groupId>
+                  <artifactId>${pom.groupId}.schemaeditor.feature</artifactId>
+                </artifactItem>
+              </artifactItems>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+  [...]
+</project>
++---+



Mime
View raw message