Author: fbricon
Date: 2011-08-12 19:32:23 -0400 (Fri, 12 Aug 2011)
New Revision: 33872
Added:
trunk/maven/plugins/org.jboss.tools.maven.jbosspackaging/
trunk/maven/plugins/org.jboss.tools.maven.jbosspackaging/.classpath
trunk/maven/plugins/org.jboss.tools.maven.jbosspackaging/.project
trunk/maven/plugins/org.jboss.tools.maven.jbosspackaging/.settings/
trunk/maven/plugins/org.jboss.tools.maven.jbosspackaging/.settings/org.eclipse.jdt.core.prefs
trunk/maven/plugins/org.jboss.tools.maven.jbosspackaging/.settings/org.eclipse.m2e.core.prefs
trunk/maven/plugins/org.jboss.tools.maven.jbosspackaging/META-INF/
trunk/maven/plugins/org.jboss.tools.maven.jbosspackaging/META-INF/MANIFEST.MF
trunk/maven/plugins/org.jboss.tools.maven.jbosspackaging/about.html
trunk/maven/plugins/org.jboss.tools.maven.jbosspackaging/about.ini
trunk/maven/plugins/org.jboss.tools.maven.jbosspackaging/about.mappings
trunk/maven/plugins/org.jboss.tools.maven.jbosspackaging/about.properties
trunk/maven/plugins/org.jboss.tools.maven.jbosspackaging/build.properties
trunk/maven/plugins/org.jboss.tools.maven.jbosspackaging/jboss_about.png
trunk/maven/plugins/org.jboss.tools.maven.jbosspackaging/lifecycle-mapping-metadata.xml
trunk/maven/plugins/org.jboss.tools.maven.jbosspackaging/plugin.properties
trunk/maven/plugins/org.jboss.tools.maven.jbosspackaging/plugin.xml
trunk/maven/plugins/org.jboss.tools.maven.jbosspackaging/pom.xml
trunk/maven/plugins/org.jboss.tools.maven.jbosspackaging/src/
trunk/maven/plugins/org.jboss.tools.maven.jbosspackaging/src/org/
trunk/maven/plugins/org.jboss.tools.maven.jbosspackaging/src/org/jboss/
trunk/maven/plugins/org.jboss.tools.maven.jbosspackaging/src/org/jboss/tools/
trunk/maven/plugins/org.jboss.tools.maven.jbosspackaging/src/org/jboss/tools/maven/
trunk/maven/plugins/org.jboss.tools.maven.jbosspackaging/src/org/jboss/tools/maven/jbosspackaging/
trunk/maven/plugins/org.jboss.tools.maven.jbosspackaging/src/org/jboss/tools/maven/jbosspackaging/MavenJBossPackagingActivator.java
trunk/maven/plugins/org.jboss.tools.maven.jbosspackaging/src/org/jboss/tools/maven/jbosspackaging/SarLifecycleMapping.java
trunk/maven/plugins/org.jboss.tools.maven.jbosspackaging/src/org/jboss/tools/maven/jbosspackaging/configurators/
trunk/maven/plugins/org.jboss.tools.maven.jbosspackaging/src/org/jboss/tools/maven/jbosspackaging/configurators/JBossPackagingArchiverConfigurator.java
trunk/maven/plugins/org.jboss.tools.maven.jbosspackaging/src/org/jboss/tools/maven/jbosspackaging/configurators/JBossPackagingPluginConfiguration.java
trunk/maven/plugins/org.jboss.tools.maven.jbosspackaging/src/org/jboss/tools/maven/jbosspackaging/configurators/MavenSarConstants.java
trunk/maven/plugins/org.jboss.tools.maven.jbosspackaging/src/org/jboss/tools/maven/jbosspackaging/configurators/ResourceCleaner.java
trunk/maven/plugins/org.jboss.tools.maven.jbosspackaging/src/org/jboss/tools/maven/jbosspackaging/configurators/SarArchiverConfigurator.java
trunk/maven/plugins/org.jboss.tools.maven.jbosspackaging/src/org/jboss/tools/maven/jbosspackaging/configurators/SarProjectConfigurator.java
Modified:
trunk/maven/plugins/pom.xml
Log:
JBIDE-9127 : Added maven project configurator for jboss-sar packages
Added: trunk/maven/plugins/org.jboss.tools.maven.jbosspackaging/.classpath
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.jbosspackaging/.classpath
(rev 0)
+++ trunk/maven/plugins/org.jboss.tools.maven.jbosspackaging/.classpath 2011-08-12
23:32:23 UTC (rev 33872)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con"
path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src/"/>
+ <classpathentry kind="output" path="target/classes"/>
+</classpath>
Added: trunk/maven/plugins/org.jboss.tools.maven.jbosspackaging/.project
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.jbosspackaging/.project
(rev 0)
+++ trunk/maven/plugins/org.jboss.tools.maven.jbosspackaging/.project 2011-08-12 23:32:23
UTC (rev 33872)
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.jboss.tools.maven.jbosspackaging</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.m2e.core.maven2Builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.m2e.core.maven2Nature</nature>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Added:
trunk/maven/plugins/org.jboss.tools.maven.jbosspackaging/.settings/org.eclipse.jdt.core.prefs
===================================================================
---
trunk/maven/plugins/org.jboss.tools.maven.jbosspackaging/.settings/org.eclipse.jdt.core.prefs
(rev 0)
+++
trunk/maven/plugins/org.jboss.tools.maven.jbosspackaging/.settings/org.eclipse.jdt.core.prefs 2011-08-12
23:32:23 UTC (rev 33872)
@@ -0,0 +1,8 @@
+#Sat Jul 03 23:59:47 CEST 2010
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
Added:
trunk/maven/plugins/org.jboss.tools.maven.jbosspackaging/.settings/org.eclipse.m2e.core.prefs
===================================================================
---
trunk/maven/plugins/org.jboss.tools.maven.jbosspackaging/.settings/org.eclipse.m2e.core.prefs
(rev 0)
+++
trunk/maven/plugins/org.jboss.tools.maven.jbosspackaging/.settings/org.eclipse.m2e.core.prefs 2011-08-12
23:32:23 UTC (rev 33872)
@@ -0,0 +1,5 @@
+#Tue Jun 28 11:43:06 CEST 2011
+activeProfiles=
+eclipse.preferences.version=1
+resolveWorkspaceProjects=true
+version=1
Added: trunk/maven/plugins/org.jboss.tools.maven.jbosspackaging/META-INF/MANIFEST.MF
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.jbosspackaging/META-INF/MANIFEST.MF
(rev 0)
+++
trunk/maven/plugins/org.jboss.tools.maven.jbosspackaging/META-INF/MANIFEST.MF 2011-08-12
23:32:23 UTC (rev 33872)
@@ -0,0 +1,22 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %Bundle-Name
+Bundle-SymbolicName: org.jboss.tools.maven.jbosspackaging;singleton:=true
+Bundle-Version: 1.3.0.qualifier
+Bundle-Activator: org.jboss.tools.maven.jbosspackaging.MavenJBossPackagingActivator
+Require-Bundle: org.eclipse.ui;bundle-version="3.7.0",
+ org.eclipse.core.runtime;bundle-version="3.7.0",
+ org.jboss.tools.maven.core,
+ org.jboss.tools.maven.ui,
+ org.jboss.tools.common.model,
+ org.eclipse.jst.j2ee.core,
+ org.eclipse.jst.j2ee,
+ org.eclipse.wst.common.emfworkbench.integration;bundle-version="1.2.100",
+ org.sonatype.m2e.mavenarchiver;bundle-version="0.14.0",
+ org.jboss.ide.eclipse.as.ui.mbeans;bundle-version="2.3.0"
+Bundle-ActivationPolicy: lazy
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-Vendor: %Bundle-Vendor
+Bundle-Localization: plugin
+Export-Package: org.jboss.tools.maven.jbosspackaging,
+ org.jboss.tools.maven.jbosspackaging.configurators
Added: trunk/maven/plugins/org.jboss.tools.maven.jbosspackaging/about.html
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.jbosspackaging/about.html
(rev 0)
+++ trunk/maven/plugins/org.jboss.tools.maven.jbosspackaging/about.html 2011-08-12
23:32:23 UTC (rev 33872)
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html
xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1" />
+<title>JBoss Packaging Maven Configurators</title>
+<style type="text/css" media="screen">
+<!--
+ body {
+ font-family: Sans-serif, Arial, Helvetica;
+ }
+
+-->
+</style>
+</head>
+<body>
+<h1>JBoss Packaging Maven Configurators</h1>
+
+<p>
+This plugin is part of the JBoss Tools developed by the <a
href="http://www.jboss.com">JBoss Inc.</a>
+</p>
+
+<p>Information about this plugin is available at <a
href="http://www.jboss.org/tools">JBoss Tools project
page</a></p>
+
+<p>
+This software is distributed under the terms of the Eclipse Public License - v 1.0
+(see <a
href="www.eclipse.org/legal/epl-v10.html">Eclipse Public License
- Version 1.0</a>).
+</p>
+</body>
+</html>
\ No newline at end of file
Added: trunk/maven/plugins/org.jboss.tools.maven.jbosspackaging/about.ini
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.jbosspackaging/about.ini
(rev 0)
+++ trunk/maven/plugins/org.jboss.tools.maven.jbosspackaging/about.ini 2011-08-12 23:32:23
UTC (rev 33872)
@@ -0,0 +1,27 @@
+# about.ini
+# contains information about a feature
+# java.io.Properties file (ISO 8859-1 with "\" escapes)
+# "%key" are externalized strings defined in about.properties
+# This file does not need to be translated.
+# test
+# Property "aboutText" contains blurb for "About" dialog
(translated)
+aboutText=%blurb
+
+# Property "windowImage" contains path to window icon (16x16)
+# needed for primary features only
+
+# Property "featureImage" contains path to feature image (32x32)
+featureImage=jboss_about.png
+
+# Property "aboutImage" contains path to product image (500x330 or 115x164)
+# needed for primary features only
+
+# Property "appName" contains name of the application (not translated)
+# needed for primary features only
+
+# Property "welcomePerspective" contains the id of the perspective in which
the
+# welcome page is to be opened.
+# optional
+
+
+
Added: trunk/maven/plugins/org.jboss.tools.maven.jbosspackaging/about.mappings
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.jbosspackaging/about.mappings
(rev 0)
+++ trunk/maven/plugins/org.jboss.tools.maven.jbosspackaging/about.mappings 2011-08-12
23:32:23 UTC (rev 33872)
@@ -0,0 +1,5 @@
+# about.mappings
+# contains fill-ins for about.properties
+# java.io.Properties file (ISO 8859-1 with "\" escapes)
+# This file does not need to be translated.
+
Added: trunk/maven/plugins/org.jboss.tools.maven.jbosspackaging/about.properties
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.jbosspackaging/about.properties
(rev 0)
+++ trunk/maven/plugins/org.jboss.tools.maven.jbosspackaging/about.properties 2011-08-12
23:32:23 UTC (rev 33872)
@@ -0,0 +1,2 @@
+blurb=JBoss Packaging Maven Configurators\n\nVersion\: {featureVersion}\n\n(c) Copyright
JBoss by Red Hat, contributors and others 2004 - 2010. All rights reserved.\nVisit
http\://jboss.org/tools
+
Added: trunk/maven/plugins/org.jboss.tools.maven.jbosspackaging/build.properties
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.jbosspackaging/build.properties
(rev 0)
+++ trunk/maven/plugins/org.jboss.tools.maven.jbosspackaging/build.properties 2011-08-12
23:32:23 UTC (rev 33872)
@@ -0,0 +1,12 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ plugin.properties,\
+ about.html,\
+ about.ini,\
+ about.mappings,\
+ about.properties,\
+ jboss_about.png,\
+ lifecycle-mapping-metadata.xml
Added: trunk/maven/plugins/org.jboss.tools.maven.jbosspackaging/jboss_about.png
===================================================================
(Binary files differ)
Property changes on:
trunk/maven/plugins/org.jboss.tools.maven.jbosspackaging/jboss_about.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added:
trunk/maven/plugins/org.jboss.tools.maven.jbosspackaging/lifecycle-mapping-metadata.xml
===================================================================
---
trunk/maven/plugins/org.jboss.tools.maven.jbosspackaging/lifecycle-mapping-metadata.xml
(rev 0)
+++
trunk/maven/plugins/org.jboss.tools.maven.jbosspackaging/lifecycle-mapping-metadata.xml 2011-08-12
23:32:23 UTC (rev 33872)
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<lifecycleMappingMetadata>
+ <lifecycleMappings>
+ <lifecycleMapping>
+ <packagingType>jboss-sar</packagingType>
+
<lifecycleMappingId>org.jboss.tools.maven.jbosspackaging.SarLifecycleMapping</lifecycleMappingId>
+ <pluginExecutions>
+ <pluginExecution>
+ <pluginExecutionFilter>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>jboss-packaging-maven-plugin</artifactId>
+ <versionRange>[1.0,)</versionRange>
+ <goals>
+ <goal>sar</goal>
+ <goal>sar-exploded</goal>
+ <goal>sar-inplace</goal>
+ </goals>
+ </pluginExecutionFilter>
+ <action>
+ <configurator>
+ <id>org.jboss.tools.maven.jbosspackaging.sarconfigurator</id>
+ </configurator>
+ </action>
+ </pluginExecution>
+ <pluginExecution>
+ <pluginExecutionFilter>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>jboss-packaging-maven-plugin</artifactId>
+ <versionRange>[1.0,)</versionRange>
+ <goals>
+ <goal>sar</goal>
+ <goal>sar-exploded</goal>
+ <goal>sar-inplace</goal>
+ </goals>
+ </pluginExecutionFilter>
+ <action>
+ <configurator>
+
<id>org.jboss.tools.maven.jbosspackaging.sararchiverconfigurator</id>
+ </configurator>
+ </action>
+ </pluginExecution>
+ </pluginExecutions>
+ </lifecycleMapping>
+ </lifecycleMappings>
+</lifecycleMappingMetadata>
\ No newline at end of file
Added: trunk/maven/plugins/org.jboss.tools.maven.jbosspackaging/plugin.properties
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.jbosspackaging/plugin.properties
(rev 0)
+++ trunk/maven/plugins/org.jboss.tools.maven.jbosspackaging/plugin.properties 2011-08-12
23:32:23 UTC (rev 33872)
@@ -0,0 +1,6 @@
+Bundle-Vendor = JBoss by Red Hat
+Bundle-Name = JBoss Packaging Maven Configurator
+SAR_Project_configurator = SAR
+SAR_MavenArchiver_configurator = SAR Maven Archiver
+Maven_Configuration_Problem=Maven Configuration Problem
+Maven_Configuration_Problems=Maven Configuration Problems
Added: trunk/maven/plugins/org.jboss.tools.maven.jbosspackaging/plugin.xml
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.jbosspackaging/plugin.xml
(rev 0)
+++ trunk/maven/plugins/org.jboss.tools.maven.jbosspackaging/plugin.xml 2011-08-12
23:32:23 UTC (rev 33872)
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+ <extension
+ point="org.eclipse.m2e.core.lifecycleMappingMetadataSource">
+ </extension>
+
+ <extension
+ point="org.eclipse.m2e.core.lifecycleMappings">
+ <lifecycleMapping
+ class="org.jboss.tools.maven.jbosspackaging.SarLifecycleMapping"
+ id="org.jboss.tools.maven.jbosspackaging.SarLifecycleMapping"
+ name="SAR Lifecycle mapping">
+ </lifecycleMapping>
+ </extension>
+
+ <extension point="org.eclipse.m2e.core.projectConfigurators">
+ <configurator
+ id="org.jboss.tools.maven.jbosspackaging.sarconfigurator"
+
class="org.jboss.tools.maven.jbosspackaging.configurators.SarProjectConfigurator"
+ name="%SAR_Project_configurator"
+ />
+ </extension>
+ <extension point="org.eclipse.m2e.core.projectConfigurators">
+ <configurator
+ id="org.jboss.tools.maven.jbosspackaging.sararchiverconfigurator"
+
class="org.jboss.tools.maven.jbosspackaging.configurators.SarArchiverConfigurator"
+ name="%SAR_MavenArchiver_configurator"
+ secondaryTo="org.jboss.tools.maven.jbosspackaging.sarconfigurator"
+ />
+ </extension>
+
+ <extension point="org.eclipse.core.resources.markers"
+ id="org.jbosstools.maven.configuration.jboss.sar"
+ name="%Maven_Configuration_Problem">
+ <super type="org.eclipse.m2e.core.maven2Problem.configuration"/>
+ <persistent value="true"/>
+ </extension>
+
+ <extension
+ point="org.eclipse.ui.ide.markerSupport">
+ <markerTypeCategory
+ name="%Maven_Configuration_Problems">
+ <markerTypeReference
+ id="org.jbosstools.maven.configuration.jboss.sar">
+ </markerTypeReference>
+ </markerTypeCategory>
+ </extension>
+</plugin>
Added: trunk/maven/plugins/org.jboss.tools.maven.jbosspackaging/pom.xml
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.jbosspackaging/pom.xml
(rev 0)
+++ trunk/maven/plugins/org.jboss.tools.maven.jbosspackaging/pom.xml 2011-08-12 23:32:23
UTC (rev 33872)
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.jboss.tools.maven</groupId>
+ <artifactId>plugins</artifactId>
+ <version>1.3.0-SNAPSHOT</version>
+ </parent>
+ <groupId>org.jboss.tools.maven.plugins</groupId>
+ <artifactId>org.jboss.tools.maven.jbosspackaging</artifactId>
+
+ <packaging>eclipse-plugin</packaging>
+</project>
\ No newline at end of file
Added:
trunk/maven/plugins/org.jboss.tools.maven.jbosspackaging/src/org/jboss/tools/maven/jbosspackaging/MavenJBossPackagingActivator.java
===================================================================
---
trunk/maven/plugins/org.jboss.tools.maven.jbosspackaging/src/org/jboss/tools/maven/jbosspackaging/MavenJBossPackagingActivator.java
(rev 0)
+++
trunk/maven/plugins/org.jboss.tools.maven.jbosspackaging/src/org/jboss/tools/maven/jbosspackaging/MavenJBossPackagingActivator.java 2011-08-12
23:32:23 UTC (rev 33872)
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.maven.jbosspackaging;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ *
+ * @author snjeza
+ *
+ */
+public class MavenJBossPackagingActivator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.jboss.tools.maven.jbosspackaging";
//$NON-NLS-1$
+
+ // The shared instance
+ private static MavenJBossPackagingActivator plugin;
+
+ /*
+ * (non-Javadoc)
+ * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext bundleContext) throws Exception {
+ super.start(bundleContext);
+ MavenJBossPackagingActivator.plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext bundleContext) throws Exception {
+ MavenJBossPackagingActivator.plugin = null;
+ super.stop(bundleContext);
+ }
+
+ public static MavenJBossPackagingActivator getDefault() {
+ return plugin;
+ }
+
+ public static void log(Throwable e) {
+ IStatus status = new Status(IStatus.ERROR, PLUGIN_ID, e.getLocalizedMessage(), e);
+ getDefault().getLog().log(status);
+ }
+
+ public static void log(String message) {
+ IStatus status = new Status(IStatus.ERROR, PLUGIN_ID, message);
+ getDefault().getLog().log(status);
+ }
+}
Added:
trunk/maven/plugins/org.jboss.tools.maven.jbosspackaging/src/org/jboss/tools/maven/jbosspackaging/SarLifecycleMapping.java
===================================================================
---
trunk/maven/plugins/org.jboss.tools.maven.jbosspackaging/src/org/jboss/tools/maven/jbosspackaging/SarLifecycleMapping.java
(rev 0)
+++
trunk/maven/plugins/org.jboss.tools.maven.jbosspackaging/src/org/jboss/tools/maven/jbosspackaging/SarLifecycleMapping.java 2011-08-12
23:32:23 UTC (rev 33872)
@@ -0,0 +1,20 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.maven.jbosspackaging;
+
+import org.eclipse.m2e.core.project.configurator.AbstractCustomizableLifecycleMapping;
+
+/**
+ * @author Fred Bricon
+ */
+public class SarLifecycleMapping extends AbstractCustomizableLifecycleMapping {
+
+}
Added:
trunk/maven/plugins/org.jboss.tools.maven.jbosspackaging/src/org/jboss/tools/maven/jbosspackaging/configurators/JBossPackagingArchiverConfigurator.java
===================================================================
---
trunk/maven/plugins/org.jboss.tools.maven.jbosspackaging/src/org/jboss/tools/maven/jbosspackaging/configurators/JBossPackagingArchiverConfigurator.java
(rev 0)
+++
trunk/maven/plugins/org.jboss.tools.maven.jbosspackaging/src/org/jboss/tools/maven/jbosspackaging/configurators/JBossPackagingArchiverConfigurator.java 2011-08-12
23:32:23 UTC (rev 33872)
@@ -0,0 +1,33 @@
+package org.jboss.tools.maven.jbosspackaging.configurators;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.m2e.core.project.IMavenProjectFacade;
+import org.eclipse.m2e.core.project.configurator.MojoExecutionKey;
+import org.sonatype.m2e.mavenarchiver.internal.JarArchiverConfigurator;
+
+public abstract class JBossPackagingArchiverConfigurator extends JarArchiverConfigurator
{
+
+ @Override
+ protected MojoExecutionKey getExecutionKey() {
+ MojoExecutionKey key = new MojoExecutionKey("org.codehaus.mojo",
"jboss-packaging-maven-plugin", "", getGoal(),
+ null, null);
+ return key;
+ }
+
+ protected abstract String getGoal();
+
+ @Override
+ public void generateManifest(IMavenProjectFacade mavenFacade, IFile manifest,
IProgressMonitor monitor)
+ throws CoreException {
+ super.generateManifest(mavenFacade, manifest, monitor);
+ }
+
+ @Override
+ protected boolean needsNewManifest(IFile manifest, IMavenProjectFacade oldFacade,
IMavenProjectFacade newFacade,
+ IProgressMonitor monitor) {
+ // TODO Auto-generated method stub
+ return super.needsNewManifest(manifest, oldFacade, newFacade, monitor);
+ }
+}
Added:
trunk/maven/plugins/org.jboss.tools.maven.jbosspackaging/src/org/jboss/tools/maven/jbosspackaging/configurators/JBossPackagingPluginConfiguration.java
===================================================================
---
trunk/maven/plugins/org.jboss.tools.maven.jbosspackaging/src/org/jboss/tools/maven/jbosspackaging/configurators/JBossPackagingPluginConfiguration.java
(rev 0)
+++
trunk/maven/plugins/org.jboss.tools.maven.jbosspackaging/src/org/jboss/tools/maven/jbosspackaging/configurators/JBossPackagingPluginConfiguration.java 2011-08-12
23:32:23 UTC (rev 33872)
@@ -0,0 +1,130 @@
+package org.jboss.tools.maven.jbosspackaging.configurators;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.model.Plugin;
+import org.apache.maven.project.MavenProject;
+import org.codehaus.plexus.util.StringUtils;
+import org.codehaus.plexus.util.xml.Xpp3Dom;
+
+public class JBossPackagingPluginConfiguration {
+
+ private static final String DEFAULT_LIB_DIRECTORY = "/lib";
+
+ protected final MavenProject mavenProject;
+
+ protected Set<String> excludes = null;
+
+ protected Boolean excludeAll;
+
+ protected Boolean removeDependencyVersions;
+
+ protected Xpp3Dom configuration;
+
+ protected String libDirectory;
+
+ public JBossPackagingPluginConfiguration(MavenProject mavenProject) {
+ this.mavenProject = mavenProject;
+ Plugin plugin =
mavenProject.getPlugin("org.codehaus.mojo:jboss-packaging-maven-plugin");
+ if (plugin != null) {
+ configuration =(Xpp3Dom) plugin.getConfiguration();
+ }
+ }
+
+
+ public String getLibDirectory() {
+ if (libDirectory == null) {
+ if (configuration != null) {
+ Xpp3Dom libDom = configuration.getChild("libDirectory");
+ if(libDom != null) {
+ libDirectory = libDom.getValue();
+ }
+ }
+ if (StringUtils.isEmpty(libDirectory)) {
+ libDirectory = DEFAULT_LIB_DIRECTORY;
+ }
+ }
+ return libDirectory;
+ }
+
+ public boolean isExcludeAll() {
+ if (excludeAll == null) {
+ if (configuration != null) {
+ Xpp3Dom excludeAllDom = configuration.getChild("excludeAll");
+ if(excludeAllDom != null) {
+ excludeAll = Boolean.valueOf(excludeAllDom.getValue());
+ }
+ }
+ if (excludeAll == null) {
+ excludeAll = Boolean.FALSE;
+ }
+ }
+ return excludeAll.booleanValue();
+ }
+
+ public boolean isRemoveDependencyVersions() {
+ if (removeDependencyVersions == null) {
+ if (configuration != null) {
+ Xpp3Dom removeVersionDom =
configuration.getChild("removeDependencyVersions");
+ if(removeVersionDom != null) {
+ removeDependencyVersions = Boolean.valueOf(removeVersionDom.getValue());
+ }
+ }
+ if (removeDependencyVersions == null) {
+ removeDependencyVersions = Boolean.FALSE;
+ }
+ }
+ return removeDependencyVersions.booleanValue();
+ }
+
+ public boolean isExcluded(Artifact artifact) {
+ if (isExcludeAll() || !artifact.getArtifactHandler().isAddedToClasspath()) {
+ return true;
+ }
+ if (getExcludes() != null) {
+ for (String groupIdArtifactId : excludes) {
+ if
(groupIdArtifactId.equals(artifact.getGroupId()+":"+artifact.getArtifactId()))
{
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ private Set<String> getExcludes() {
+ if (excludes == null) {
+ excludes = new HashSet<String>();
+ if (configuration != null) {
+ Xpp3Dom excludesDom = configuration.getChild("excludes");
+ if(excludesDom != null) {
+ for (Xpp3Dom excludeDom : excludesDom.getChildren("exclude")) {
+ if (excludeDom != null) {
+ String exclude = excludeDom.getValue();
+ if (StringUtils.isNotEmpty(exclude)) {
+ excludes.add(exclude);
+ }
+ }
+ }
+ }
+ }
+ }
+ return excludes;
+ }
+
+
+ public String mapFileName(Artifact artifact) {
+ StringBuilder fileName = new StringBuilder(artifact.getArtifactId());
+ String classifier = artifact.getClassifier();
+ if (classifier != null) {
+ fileName.append("-").append(classifier);
+ }
+ if (!isRemoveDependencyVersions()) {
+ fileName.append("-").append(artifact.getVersion());
+ }
+ fileName.append(".").append(artifact.getArtifactHandler().getExtension());
+ return fileName.toString();
+ }
+
+}
Added:
trunk/maven/plugins/org.jboss.tools.maven.jbosspackaging/src/org/jboss/tools/maven/jbosspackaging/configurators/MavenSarConstants.java
===================================================================
---
trunk/maven/plugins/org.jboss.tools.maven.jbosspackaging/src/org/jboss/tools/maven/jbosspackaging/configurators/MavenSarConstants.java
(rev 0)
+++
trunk/maven/plugins/org.jboss.tools.maven.jbosspackaging/src/org/jboss/tools/maven/jbosspackaging/configurators/MavenSarConstants.java 2011-08-12
23:32:23 UTC (rev 33872)
@@ -0,0 +1,11 @@
+package org.jboss.tools.maven.jbosspackaging.configurators;
+
+public class MavenSarConstants {
+
+ public static final String SAR_CONFIGURATION_ERROR_MARKER_ID =
"org.jbosstools.maven.configuration.jboss.sar";
+ /**
+ * Private constructor to prevent instanciation.
+ */
+ private MavenSarConstants() {}
+
+}
Added:
trunk/maven/plugins/org.jboss.tools.maven.jbosspackaging/src/org/jboss/tools/maven/jbosspackaging/configurators/ResourceCleaner.java
===================================================================
---
trunk/maven/plugins/org.jboss.tools.maven.jbosspackaging/src/org/jboss/tools/maven/jbosspackaging/configurators/ResourceCleaner.java
(rev 0)
+++
trunk/maven/plugins/org.jboss.tools.maven.jbosspackaging/src/org/jboss/tools/maven/jbosspackaging/configurators/ResourceCleaner.java 2011-08-12
23:32:23 UTC (rev 33872)
@@ -0,0 +1,133 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+
+package org.jboss.tools.maven.jbosspackaging.configurators;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+
+/**
+ * ResourceCleaner
+ *
+ * @author Fred Bricon
+ */
+public class ResourceCleaner {
+
+ private final IProject project;
+
+ private Map<IFolder, Boolean> folders = new LinkedHashMap<IFolder,
Boolean>();
+
+ private Map<IFile, Boolean> files = new LinkedHashMap<IFile, Boolean>();
+
+ private Set<IFolder> keepers = new HashSet<IFolder>();
+
+ /**
+ * @param project
+ */
+ public ResourceCleaner(IProject project) {
+ this.project = project;
+ }
+
+ public ResourceCleaner(IProject project, IFolder ... foldersToKeep) {
+ this.project = project;
+ if (foldersToKeep != null) {
+ for (IFolder folder : foldersToKeep) {
+ if (folder != null) {
+ keepers.add(folder);
+ IContainer parent = folder.getParent();
+ while (parent instanceof IFolder) {
+ keepers.add((IFolder)parent);
+ parent = parent.getParent();
+ }
+ }
+ }
+ }
+ }
+
+
+ public void addFolder(IPath folderPath, boolean deleteEmptyParents) {
+ if (folderPath == null) {
+ return;
+ }
+ addFolder(project.getFolder(folderPath), deleteEmptyParents);
+ }
+
+
+ public void addFolders(Collection<IPath> folderPaths) {
+ if (folderPaths == null) {
+ return;
+ }
+ for (IPath path : folderPaths) {
+ addFolder(path, false);
+ }
+ }
+
+ public void addFolder(IFolder folder, boolean deleteEmptyParents) {
+ if (folder != null && !folder.exists()) {
+ folders.put(folder, deleteEmptyParents);
+ addInexistentParentFolders(folder);
+ }
+ }
+
+ public void addFiles(IPath ... filePaths) {
+ if (filePaths == null) {
+ return;
+ }
+ for (IPath fileName : filePaths) {
+ IFile fileToDelete = project.getFile(fileName);
+ if (!fileToDelete.exists()) {
+ files.put(fileToDelete, false);
+ addInexistentParentFolders(fileToDelete);
+ }
+ }
+ }
+
+ public void cleanUp() throws CoreException {
+ IProgressMonitor monitor = new NullProgressMonitor();
+ for (IFile file : files.keySet()) {
+ if (file.exists()) {
+ file.delete(true, monitor);
+ }
+ }
+ for (IFolder folder : folders.keySet()) {
+ if (folder.exists() && folder.members().length == 0) {
+ folder.delete(true, monitor);
+ }
+ }
+ }
+
+ protected void addInexistentParentFolders(IResource resource) {
+ IContainer parent = resource.getParent();
+ IFolder firstInexistentParent = null;
+ while (parent instanceof IFolder) {
+ if (keepers.contains(parent)
+ || parent.exists()) {
+ break;
+ }
+ firstInexistentParent = (IFolder)parent;
+ parent = parent.getParent();
+ }
+ if (firstInexistentParent != null) {
+ folders.put(firstInexistentParent, true);
+ }
+ }
+
+}
Added:
trunk/maven/plugins/org.jboss.tools.maven.jbosspackaging/src/org/jboss/tools/maven/jbosspackaging/configurators/SarArchiverConfigurator.java
===================================================================
---
trunk/maven/plugins/org.jboss.tools.maven.jbosspackaging/src/org/jboss/tools/maven/jbosspackaging/configurators/SarArchiverConfigurator.java
(rev 0)
+++
trunk/maven/plugins/org.jboss.tools.maven.jbosspackaging/src/org/jboss/tools/maven/jbosspackaging/configurators/SarArchiverConfigurator.java 2011-08-12
23:32:23 UTC (rev 33872)
@@ -0,0 +1,14 @@
+package org.jboss.tools.maven.jbosspackaging.configurators;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.m2e.core.project.IMavenProjectFacade;
+
+public class SarArchiverConfigurator extends JBossPackagingArchiverConfigurator {
+
+ @Override
+ protected String getGoal() {
+ return "sar";
+ }
+}
Added:
trunk/maven/plugins/org.jboss.tools.maven.jbosspackaging/src/org/jboss/tools/maven/jbosspackaging/configurators/SarProjectConfigurator.java
===================================================================
---
trunk/maven/plugins/org.jboss.tools.maven.jbosspackaging/src/org/jboss/tools/maven/jbosspackaging/configurators/SarProjectConfigurator.java
(rev 0)
+++
trunk/maven/plugins/org.jboss.tools.maven.jbosspackaging/src/org/jboss/tools/maven/jbosspackaging/configurators/SarProjectConfigurator.java 2011-08-12
23:32:23 UTC (rev 33872)
@@ -0,0 +1,253 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.maven.jbosspackaging.configurators;
+
+import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
+import java.util.Set;
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
+import org.apache.maven.artifact.resolver.filter.ScopeArtifactFilter;
+import org.apache.maven.project.MavenProject;
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jdt.core.IClasspathAttribute;
+import org.eclipse.jdt.core.IClasspathEntry;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jst.j2ee.classpathdep.IClasspathDependencyConstants;
+import org.eclipse.m2e.core.project.IMavenProjectFacade;
+import org.eclipse.m2e.core.project.MavenProjectChangedEvent;
+import org.eclipse.m2e.core.project.configurator.AbstractProjectConfigurator;
+import org.eclipse.m2e.core.project.configurator.ProjectConfigurationRequest;
+import org.eclipse.m2e.jdt.internal.MavenClasspathHelpers;
+import org.eclipse.wst.common.componentcore.ComponentCore;
+import org.eclipse.wst.common.componentcore.ModuleCoreNature;
+import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
+import org.eclipse.wst.common.componentcore.resources.IVirtualReference;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+import org.eclipse.wst.common.project.facet.core.IFacetedProject;
+import org.eclipse.wst.common.project.facet.core.IFacetedProject.Action;
+import org.eclipse.wst.common.project.facet.core.IProjectFacet;
+import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
+import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
+import org.jboss.ide.eclipse.as.ui.mbeans.project.IJBossSARFacetDataModelProperties;
+import org.jboss.ide.eclipse.as.ui.mbeans.project.JBossSARFacetDataModelProvider;
+import org.jboss.tools.maven.core.IJBossMavenConstants;
+import
org.jboss.tools.maven.core.internal.project.facet.MavenFacetInstallDataModelProvider;
+import org.maven.ide.eclipse.wtp.ArtifactHelper;
+import org.maven.ide.eclipse.wtp.ResourceCleaner;
+import org.maven.ide.eclipse.wtp.WTPProjectsUtil;
+
+/**
+ *
+ * @author Fred Bricon
+ *
+ */
+public class SarProjectConfigurator extends AbstractProjectConfigurator {
+
+ public static final IProjectFacet JBOSS_SAR_FACET;
+ public static final IProjectFacetVersion JBOSS_SAR_FACET_VERSION_1_0;
+ public static final ArtifactFilter SCOPE_FILTER_RUNTIME = new
ScopeArtifactFilter(Artifact.SCOPE_RUNTIME);
+ protected static final IProjectFacet m2Facet;
+ protected static final IProjectFacetVersion m2Version;
+ private static final IClasspathAttribute NONDEPENDENCY_ATTRIBUTE =
JavaCore.newClasspathAttribute(
+ IClasspathDependencyConstants.CLASSPATH_COMPONENT_NON_DEPENDENCY, "");
+ static {
+ JBOSS_SAR_FACET = ProjectFacetsManager.getProjectFacet("jst.jboss.sar");
+ JBOSS_SAR_FACET_VERSION_1_0 =
JBOSS_SAR_FACET.getVersion("1.0");//$NON-NLS-1$
+ m2Facet = ProjectFacetsManager.getProjectFacet("jboss.m2"); //$NON-NLS-1$
+ m2Version = m2Facet.getVersion("1.0"); //$NON-NLS-1$
+ }
+
+ @Override
+ public void configure(ProjectConfigurationRequest request, IProgressMonitor monitor)
throws CoreException {
+
+ MavenProject mavenProject = request.getMavenProject();
+ IProject project = request.getProject();
+
+ markerManager.deleteMarkers(project,
MavenSarConstants.SAR_CONFIGURATION_ERROR_MARKER_ID);
+
+ if (!getExpectedPackage().equals(mavenProject.getPackaging())) {
+ return;
+ }
+
+ IFacetedProject facetedProject = ProjectFacetsManager.create(project, true, monitor);
+
+ Set<Action> actions = new LinkedHashSet<Action>();
+
+ IMavenProjectFacade facade = request.getMavenProjectFacade();
+
+ ResourceCleaner fileCleaner = new ResourceCleaner(project);
+ addFilesToClean(fileCleaner, facade.getResourceLocations());
+ addFilesToClean(fileCleaner, facade.getTestResourceLocations());
+ addFilesToClean(fileCleaner, facade.getCompileSourceLocations());
+ addFilesToClean(fileCleaner, facade.getTestCompileSourceLocations());
+
+ IPath source = facade.getResourceLocations()[0];
+
+ WTPProjectsUtil.installJavaFacet(actions, project, facetedProject);
+ if (!actions.isEmpty()) {
+ facetedProject.modify(actions, monitor);
+ }
+ installSarFacet(facetedProject, source, monitor);
+
+ installM2Facet(facetedProject, monitor);
+
+ ModuleCoreNature.addModuleCoreNatureIfNecessary(project, monitor);
+
+ WTPProjectsUtil.removeTestFolderLinks(project, mavenProject, monitor, "/");
+
+ setNonDependencyAttributeToContainer(project, monitor);
+
+ WTPProjectsUtil.removeWTPClasspathContainer(project);
+
+ fileCleaner.cleanUp();
+ }
+
+ private void installM2Facet(IFacetedProject fproj, IProgressMonitor monitor) throws
CoreException {
+ if (!fproj.hasProjectFacet(m2Facet)) {
+ IDataModel config = (IDataModel) new MavenFacetInstallDataModelProvider().create();
+ config.setBooleanProperty(IJBossMavenConstants.MAVEN_PROJECT_EXISTS, true);
+ fproj.installProjectFacet(m2Version, config, monitor);
+ }
+ }
+
+ private void installSarFacet(IFacetedProject fproj, IPath source, IProgressMonitor
monitor) throws CoreException {
+ if (!fproj.hasProjectFacet(JBOSS_SAR_FACET)) {
+ IProjectFacetVersion facetVersion = JBOSS_SAR_FACET_VERSION_1_0;
+ IStatus status = facetVersion.getConstraint().check(fproj.getProjectFacets());
+ if (status.isOK()) {
+ IDataModel config = (IDataModel) new JBossSARFacetDataModelProvider().create();
+ config.setProperty(IJBossSARFacetDataModelProperties.SAR_CONTENT_FOLDER,
source.toPortableString());
+ fproj.installProjectFacet(facetVersion, config, monitor);
+ } else {
+ addErrorMarker(fproj.getProject(), facetVersion + " can not be installed :
"+ status.getMessage());
+ for (IStatus st : status.getChildren()) {
+ addErrorMarker(fproj.getProject(), st.getMessage());
+ }
+ }
+ }
+ }
+
+ private void addErrorMarker(IProject project, String message) {
+ markerManager.addMarker(project,
+ MavenSarConstants.SAR_CONFIGURATION_ERROR_MARKER_ID,
+ message
+ ,-1, IMarker.SEVERITY_ERROR);
+ }
+
+ protected String getExpectedPackage() {
+ return "jboss-sar";
+ }
+
+
+ public void setModuleDependencies(IProject project, MavenProject mavenProject,
IProgressMonitor monitor)
+ throws CoreException {
+
+ IVirtualComponent sarComponent = ComponentCore.createComponent(project);
+ if (sarComponent == null) {
+ return;
+ }
+
+ Set<IVirtualReference> newRefs = new LinkedHashSet<IVirtualReference>();
+
+ JBossPackagingPluginConfiguration config = new
JBossPackagingPluginConfiguration(mavenProject);
+
+ if (!config.isExcludeAll()) {
+ Set<Artifact> artifacts = mavenProject.getArtifacts();
+
+ for (Artifact artifact : artifacts) {
+ // Don't deploy pom, non runtime or optional dependencies
+ if ("pom".equals(artifact.getType()) ||
!SCOPE_FILTER_RUNTIME.include(artifact)
+ || artifact.isOptional() || config.isExcluded(artifact)) {
+ continue;
+ }
+
+ IMavenProjectFacade workspaceDependency =
projectManager.getMavenProject(artifact.getGroupId(),
+ artifact.getArtifactId(), artifact.getVersion());
+
+ IVirtualComponent depComponent;
+ if (workspaceDependency != null &&
!workspaceDependency.getProject().equals(project)
+ && workspaceDependency.getFullPath(artifact.getFile()) != null) {
+ // artifact dependency is a workspace project
+ depComponent = ComponentCore.createComponent(workspaceDependency.getProject());
+ } else {
+ // artifact dependency should be added as a JEE module,
+ // referenced with M2_REPO variable
+ String artifactPath = ArtifactHelper.getM2REPOVarPath(artifact);
+ depComponent = ComponentCore.createArchiveComponent(sarComponent.getProject(),
artifactPath);
+ }
+ IVirtualReference reference = ComponentCore.createReference(sarComponent,
depComponent);
+ reference.setArchiveName(config.mapFileName(artifact));
+ reference.setRuntimePath(new Path(config.getLibDirectory()));
+ newRefs.add(reference);
+ }
+ }
+ IVirtualReference[] newRefsArray = new IVirtualReference[newRefs.size()];
+ newRefs.toArray(newRefsArray);
+
+ // Only change the project references if they've changed
+ if (WTPProjectsUtil.hasChanged(sarComponent.getReferences(), newRefsArray)) {
+ sarComponent.setReferences(newRefsArray);
+ }
+ }
+
+ protected void setNonDependencyAttributeToContainer(IProject project, IProgressMonitor
monitor)
+ throws JavaModelException {
+ updateContainerAttributes(project, NONDEPENDENCY_ATTRIBUTE,
+ IClasspathDependencyConstants.CLASSPATH_COMPONENT_DEPENDENCY, monitor);
+ }
+
+ protected void updateContainerAttributes(IProject project, IClasspathAttribute
attributeToAdd,
+ String attributeToDelete, IProgressMonitor monitor) throws JavaModelException {
+ IJavaProject javaProject = JavaCore.create(project);
+ if (javaProject == null)
+ return;
+ IClasspathEntry[] cp = javaProject.getRawClasspath();
+ for (int i = 0; i < cp.length; i++) {
+ if (IClasspathEntry.CPE_CONTAINER == cp[i].getEntryKind()
+ && MavenClasspathHelpers.isMaven2ClasspathContainer(cp[i].getPath())) {
+ LinkedHashMap<String, IClasspathAttribute> attrs = new LinkedHashMap<String,
IClasspathAttribute>();
+ for (IClasspathAttribute attr : cp[i].getExtraAttributes()) {
+ if (!attr.getName().equals(attributeToDelete)) {
+ attrs.put(attr.getName(), attr);
+ }
+ }
+ attrs.put(attributeToAdd.getName(), attributeToAdd);
+ IClasspathAttribute[] newAttrs = attrs.values().toArray(new
IClasspathAttribute[attrs.size()]);
+ cp[i] = JavaCore.newContainerEntry(cp[i].getPath(), cp[i].getAccessRules(),
newAttrs,
+ cp[i].isExported());
+ break;
+ }
+ }
+ javaProject.setRawClasspath(cp, monitor);
+ }
+
+ @Override
+ public void mavenProjectChanged(MavenProjectChangedEvent event, IProgressMonitor
monitor) throws CoreException {
+ setModuleDependencies(event.getMavenProject().getProject(),
event.getMavenProject().getMavenProject(), monitor);
+ }
+
+ private void addFilesToClean(ResourceCleaner cleaner, IPath[] paths) {
+ for (IPath resourceFolderPath : paths) {
+ cleaner.addFiles(resourceFolderPath.append("META-INF/MANIFEST.MF"));
+ }
+ }
+
+}
Modified: trunk/maven/plugins/pom.xml
===================================================================
--- trunk/maven/plugins/pom.xml 2011-08-12 22:08:25 UTC (rev 33871)
+++ trunk/maven/plugins/pom.xml 2011-08-12 23:32:23 UTC (rev 33872)
@@ -22,6 +22,7 @@
<module>org.jboss.tools.maven.portlet</module>
<module>org.jboss.tools.maven.project.examples</module>
<module>org.jboss.tools.maven.jaxrs</module>
+ <module>org.jboss.tools.maven.jbosspackaging</module>
</modules>
</project>