Can the yui compressor maven plugin work with WTP? - eclipse

I am using Eclipse Indigo with M2E to deploy a local web app using WTP. I am also using the yui-compressor plugin, which seems to work fine on the exploded war directory under target, but doesn't work with eclipse WTP. Is there a recommended way to set this up so I can develop locally and use the minified files?
Here is my yui config:
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>yuicompressor-maven-plugin</artifactId>
<version>1.3.0</version>
<executions>
<execution>
<goals>
<goal>compress</goal>
</goals>
</execution>
</executions>
<configuration>
<nosuffix>true</nosuffix>
<force>true</force>
<jswarn>false</jswarn>
<linebreakpos>-1</linebreakpos>
<excludes>
<exclude>**/lib/*</exclude>
</excludes>
<aggregations>
<aggregation>
<insertNewLine>true</insertNewLine>
<output>${project.build.directory}/${project.build.finalName}/static/js/script-${timestamp}.min.js</output>
<includes>
<include>**/script/*.js</include>
</includes>
<excludes>
<exclude>**/lib/*</exclude>
</excludes>
</aggregation>
</aggregations>
</configuration>
</plugin>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>net.alchim31.maven</groupId>
<artifactId>yuicompressor-maven-plugin</artifactId>
<versionRange>[1.2,)</versionRange>
<goals>
<goal>compress</goal>
</goals>
</pluginExecutionFilter>
<action>
<execute />
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>

The problem, I think, is that you are not telling to maven-war-plugin where to find generated resources.
You should try to add webResources section to the maven-war-plugin configuration, e.g.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<webResources>
<resource>
<filtering>true</filtering>
<directory>${basedir}/src/main/webapp</directory>
<excludes>
<exclude>**/pattern-for-non-minified-scripts</exclude>
</excludes>
</resource>
<resource>
<filtering>true</filtering>
<directory>${project.build.directory}/${project.build.finalName}</directory>
<includes>
<include>static/js/script-${timestamp}.min.js</include>
</includes>
</resource>
</webResources>
</configuration>
</plugin>
To see that WTP has picked up the minified files, check .settings/org.eclipse.wst.common.component file has the following line:
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>

Did you try <runOnIncremental>true</runOnIncremental>?
<pluginManagement>
<plugins>
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>net.alchim31.maven</groupId>
<artifactId>yuicompressor-maven-plugin</artifactId>
<versionRange>[1.3.0,)</versionRange>
<goals>
<goal>compress</goal>
</goals>
</pluginExecutionFilter>
<action>
<execute>
<runOnIncremental>true</runOnIncremental>
</execute>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
To have M2E output the files into the /src/ directory rather than the /target/ directory, I use the following:
<plugins>
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>yuicompressor-maven-plugin</artifactId>
<version>1.3.0</version>
<executions>
<execution>
<goals>
<goal>compress</goal>
</goals>
</execution>
</executions>
<configuration>
<sourceDirectory>${project.basedir}/src/main/webapp/resources/js</sourceDirectory>
<outputDirectory>${project.basedir}/src/main/webapp/resources/js-min</outputDirectory>
</configuration>
</plugin>
</plugins>
In my HTML I then reference the JavaScript file(s) in [...]/resources/js-min/.

Related

How do you get output from a maven plugin in Eclipse when using the m2e lifecycle-mapping?

I'm unable to get any output from the custom java class (SchemaGenerator) to output in the Eclipse Maven console. Is there a way to do this? The class currently uses sys out and sys err, which appears in the output when using mvn from command line.
<build>
<!-- allow m2e to trigger the exec-maven-plugin -->
<pluginManagement>
<plugins>
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<versionRange>[1,)</versionRange>
<goals>
<goal>java</goal>
</goals>
</pluginExecutionFilter>
<action>
<execute>
<runOnConfiguration>true</runOnConfiguration>
<runOnIncremental>true</runOnIncremental>
</execute>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<!-- custom build step -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.6.0</version>
<executions>
<execution>
<id>SchemaGenerator</id>
<phase>process-resources</phase>
<goals>
<goal>java</goal>
</goals>
<configuration>
<includePluginDependencies>true</includePluginDependencies>
<includeProjectDependencies>false</includeProjectDependencies>
<mainClass>jit.SchemaGenerator</mainClass>
<arguments>
<argument>${project.build.outputDirectory}</argument>
<argument>schema.xml</argument>
</arguments>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>jit</groupId>
<artifactId>schema-generator</artifactId>
<version>0.0.1</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>

Eclipse m2e overwrites buildNumber from buildnumber-maven-plugin

I'm using Eclipse m2e, buildnumber-maven-plugin, and templating-maven-plugin to create a filtered java file with ${buildNumber}.
Here is a sample from the src/main/java-templates/build.java file:
public static final String BUILDNUMBER = "${buildNumber}";
If I run "mvn generate-sources" on the command line, my filtered java file contains the generated buildNumber value. If I run "generate-sources" from within Eclipse using m2e, the filtered java file briefly contains the actual buildNumber but is quickly replaced with the original string "${buildNumber}"
The structure of the project is
CmbProduct/pom.xml
+-- Model/pom.xml
+-- other modules
The buildnumber-maven-plugin is run in the parent pom.xml because I use buildNumber to set a general <finalName> value for all sub-modules.
I have tried it with and without lifecycle-mapping for org.eclipse.m2e.
I did not notice any change.
I have several "echo" tasks in both pom.xml files for debug purposes. These show the correct/actual buildNumber when run.
Here is an abbreviated CmbProduct/pom.xml:
<?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>
<groupId>com.magnicomp</groupId>
<artifactId>Product</artifactId>
<!-- Do not change version EVER. This is used by MagniCompCommon and all other sub modules. -->
<version>1.0</version>
<packaging>pom</packaging>
<name>CMB Product</name>
<modules>
<module>Model</module>
<module>Common</module>
</modules>
<scm>
<!-- SCM used by buildnumber-maven-plugin and others -->
<connection>scm:git:git://sol:/vol/git/cmb.git</connection>
</scm>
<properties>
<!--
The canonical Product Version is defined below. This value is
automatically propagated to Java via plugin in the Modelproject.
The ${buildNumber} is automatically generated on-the-fly by
buildnumber-maven-plugin
-->
<!--
Product version defined primary version of product.
This is used instead of project.version because the later must
remain the same.
-->
<product.version.base>1.0.0</product.version.base>
<product.version.status>alpha1</product.version.status>
<product.version>${product.version.base}.${buildNumber}-${product.version.status}</product.version>
<!-- Version in 4 dot (digits + dot) format suitable for Windows file Version -->
<product.version.4dot>${product.version.base}.${buildNumber}</product.version.4dot>
<!-- Java version -->
<project.source.version>1.8</project.source.version>
<project.target.version>1.8</project.target.version>
<!-- MagniComp common -->
<failOnMissingWebXml>false</failOnMissingWebXml>
<hibernate.version>4.3.11.Final</hibernate.version> <!-- was 4.3.10.Final -->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<texo.version>0.9.0-v201501182340</texo.version>
<emf.version>2.11.0-v20150123-0347</emf.version>
<!-- Vaadin -->
<vaadin.version>7.5.7</vaadin.version>
<vaadin.plugin.version>${vaadin.version}</vaadin.plugin.version>
<vaadin.icons.version>1.0.1</vaadin.icons.version>
<!-- Product specific -->
<javax.servlet.version>3.1</javax.servlet.version>
<jersey.glassfish.version>2.21</jersey.glassfish.version>
<bouncy.version>1.51</bouncy.version>
<build.helper.maven.plugin.version>1.9.1</build.helper.maven.plugin.version>
<maven.shade.plugin.version>2.4.1</maven.shade.plugin.version>
<jna.version>4.1.0</jna.version>
</properties>
<build>
<finalName>${project.artifactId}-${product.version}</finalName>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.7</version>
<configuration>
<encoding>${project.encoding}</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.6</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.6</version>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.6</version>
<!-- We do not need a default assembly.xml
<configuration>
<descriptors>
<descriptor>src/main/assembly/bin.xml</descriptor>
</descriptors>
</configuration>
-->
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.4.0</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>templating-maven-plugin</artifactId>
<version>1.0.0</version>
</plugin>
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.codehaus.mojo</groupId>
<artifactId>buildnumber-maven-plugin</artifactId>
<versionRange>[1.4,)</versionRange>
<goals>
<goal>create</goal>
<goal>create-metadata</goal>
</goals>
</pluginExecutionFilter>
<action>
<execute>
<runOnIncremental>true</runOnIncremental>
</execute>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.0</version>
<configuration>
<encoding>${project.encoding}</encoding>
<source>${project.source.version}</source>
<target>${project.target.version}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>buildnumber-maven-plugin</artifactId>
<version>1.4</version> <!-- Keep in sync with pluginsManagement -->
<inherited>false</inherited> <!-- Run only for this level project -->
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>create</goal> <!-- Create buildNumber -->
<goal>create-metadata</goal> <!-- Create build.properties -->
</goals>
</execution>
</executions>
<configuration>
<!--
Auto update incremental integer as build number.
Without this it uses git revision.
-->
<format>{0,number,integer}</format>
<items>
<item>buildNumber</item>
</items>
<!-- Store buildNumber in given file. Use product.version so it resets each time version changes -->
<buildNumberPropertiesFileLocation>${basedir}/buildinfo/buildNumber-${product.version.base}-${product.version.status}.properties</buildNumberPropertiesFileLocation>
<!-- WORKAROUND: Make ${buildNumber} available to child modules -->
<getRevisionOnlyOnce>true</getRevisionOnlyOnce>
</configuration>
</plugin>
<plugin> <!-- Help identify buildNumber -->
<artifactId>maven-antrun-plugin</artifactId>
<inherited>false</inherited> <!-- Run only for this level project -->
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<echo>Build Number (buildNumber) is ${buildNumber}</echo>
</tasks>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<!-- This plugin allows us to add "src-gen" as another source dir -->
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>${build.helper.maven.plugin.version}</version>
<executions>
<execution>
<id>add-source</id>
<phase>generate-sources</phase>
<goals><goal>add-source</goal></goals>
<configuration>
<sources>
<source>src-gen</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.18.1</version>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>src/test/resources/testng-unit.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>
</plugins>
</build>
... snip ....
Here is Model/pom.xml:
<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>com.magnicomp</groupId>
<artifactId>Product</artifactId>
<version>1.0</version>
</parent>
<artifactId>Model</artifactId>
<packaging>jar</packaging>
<build>
<resources> <!-- XXX ARE WE GOING TO USE THIS? -->
<resource>
<directory>src/main/resources</directory>
<includes>
<include>version.properties</include>
</includes>
<filtering>true</filtering>
</resource>
</resources>
<pluginManagement>
<plugins>
<!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
<!-- Override eclipse error about "create-metadata" goal from above plugin -->
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.codehaus.mojo</groupId>
<artifactId>templating-maven-plugin</artifactId>
<versionRange>[1.0.0,)</versionRange>
<goals>
<goal>filter-sources</goal>
</goals>
</pluginExecutionFilter>
<action>
<execute>
<runOnIncremental>true</runOnIncremental>
</execute>
</action>
</pluginExecution>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.codehaus.mojo</groupId>
<artifactId>buildnumber-maven-plugin</artifactId>
<versionRange>[1.4,)</versionRange>
<goals>
<goal>create</goal>
<goal>create-metadata</goal>
</goals>
</pluginExecutionFilter>
<action>
<execute>
<runOnIncremental>true</runOnIncremental>
</execute>
</action>
</pluginExecution>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<versionRange>[1.3,)</versionRange>
<goals>
<goal>run</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore></ignore>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin> <!-- Aid with making sure buildNumber is available -->
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>echo-buildnumber-1</id>
<phase>validate</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<echo>Build number during validate is ${buildNumber}</echo>
</tasks>
</configuration>
</execution>
<execution>
<id>echo-buildnumber-2</id>
<phase>generate-sources</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<echo>Build number during generate-sources is ${buildNumber}</echo>
</tasks>
</configuration>
</execution>
</executions>
</plugin>
<plugin> <!-- Must be after buildnumber-maven-plugin due to ${buildNumber} -->
<groupId>org.codehaus.mojo</groupId>
<artifactId>templating-maven-plugin</artifactId>
<executions>
<!-- Take files in sourceDirectory and filter them to outputDirectory -->
<execution>
<id>filter-src</id>
<phase>generate-sources</phase>
<goals>
<goal>filter-sources</goal>
</goals>
<configuration>
<sourceDirectory>${basedir}/src/main/java-templates</sourceDirectory>
<outputDirectory>${basedir}/src-generated</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<!-- Copy the build.properties created by buildnumber-maven-plugin -->
<id>copy-build-properties</id>
<phase>validate</phase>
<goals> <goal>copy-resources</goal> </goals>
<configuration>
<outputDirectory>${basedir}/src/main/resources</outputDirectory>
<resources>
<resource>
<directory>${project.parent.basedir}/target/generated/build-metadata</directory>
<filtering>true</filtering>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
... snip ...
Its been a while, but I got this work with the create-timestamp goal with the timestampFormat and timestampPropertyName configuration properties, and the by adding the runOnConfiguration true on the Eclipse m2e lifecycle mapping.
Build number plugin:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>buildnumber-maven-plugin</artifactId>
<version>1.4</version>
<configuration>
<revisionOnScmFailure>just.say.no.scm.config.in.pom</revisionOnScmFailure>
</configuration>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>create-timestamp</goal>
</goals>
<configuration>
<timestampFormat>yyyyMMddHHmmssS</timestampFormat>
<timestampPropertyName>myBuildNumberVariable</timestampPropertyName>
<!-- formats the timestamp all together like 20160404141705123 and puts
it in the ${myBuildNumberVariable} buildProperty -->
</configuration>
</execution>
</executions>
</plugin>

No marketplace entries found to handle yeoman-maven-plugin

I have recently installed and created an application with JHipster. When i run the app in terminal with "mvn spring-boot:run", the app runs without problem.
But when i import the project (as a maven project) into Eclipse, i have this error in my pom:
No marketplace entries found to handle yeoman-maven-plugin:0.4:build
in Eclipse. Please see Help for more information.
Here is a screenshot of the error.
This is how this plugin is defined in the generated pom.xml by default:
<build>
<plugins>
<plugin>
<groupId>com.github.trecloux</groupId>
<artifactId>yeoman-maven-plugin</artifactId>
<version>0.4</version>
<executions>
<execution>
<id>run-grunt</id>
<phase>generate-resources</phase>
<goals>
<goal>build</goal>
</goals>
<configuration>
<skipTests>true</skipTests>
<buildTool>grunt</buildTool>
<buildArgs>compass:server --force</buildArgs>
</configuration>
</execution>
</executions>
<configuration>
<yeomanProjectDirectory>${project.basedir}</yeomanProjectDirectory>
</configuration>
</plugin>
</plugins>
</build>
How can i continue to manipulate, edit the generated project files in my Eclipse?
Eclipse lifecycle-mapping issue is described here:
http://www.eclipse.org/m2e/documentation/m2e-execution-not-covered.html
There is not m2e connector for yeoman-maven-plugin
Recommended way to deal with this issue it to ignore executing this plugin by m2e:
<build>
<plugins>
<pluginManagement>
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>
com.github.trecloux
</groupId>
<artifactId>
yeoman-maven-plugin
</artifactId>
<versionRange>
[0.4,)
</versionRange>
<goals>
<goal>build</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore></ignore>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
Note that executing maven from Eclipse is not affected.
As Mateusz Balbus said you have to modify the pom.xml, but with a small difference as we can find here :
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>
com.github.trecloux
</groupId>
<artifactId>
yeoman-maven-plugin
</artifactId>
<versionRange>
[0.4,)
</versionRange>
<goals>
<goal>build</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore></ignore>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>

Build RPM or Deb or Both file through maven build

I would like to create an OS package from a Maven project file according to the OS in question. The package may be RPM , Deb or something else. In the case of Deb packages, this could be done for example with the jdeb plugin.
We can use profile in pom.xml to creates one of file from deb or rpm .The profile structure are as follows:-
<profiles>
<profile>
<id>rpm</id>
<activation>
<os>
<family>linux</family>
</os>
</activation>
<build>
<finalName>Finalname</finalName>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
</plugin>
<plugin>
<groupId>com.springsource.bundlor</groupId>
<artifactId>com.springsource.bundlor.maven</artifactId>
<version>1.0.0.M1B</version>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<inherited>false</inherited>
<configuration>
<descriptorRefs>
<descriptorRef>project</descriptorRef>
</descriptorRefs>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.3.1</version>
<configuration>
<webResources>
<resource>
<directory>src/main/resources</directory>
<filtering>false</filtering>
</resource>
<resource>
<directory>src/main/java</directory>
<filtering>true</filtering>
</resource>
<resource>
<!-- this is relative to the pom.xml directory -->
<directory>src/test/java</directory>
<!-- <excludes> <exclude>**/*Test.java</exclude> <exclude>**/*AllTests.java</exclude>
<exclude>**/*.java</exclude> </excludes> -->
</resource>
</webResources>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skip>false</skip>
<includes>
<include>**/*.java</include>
</includes>
<redirectTestOutputToFile>true</redirectTestOutputToFile>
<printSummary>true</printSummary>
<useFile>true</useFile>
<forkMode>pertest</forkMode>
</configuration>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<archive>
<manifest>
<mainClass>
org.springframework.batch.core.launch.support.CommandLineJobRunner
</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>rpm-maven-plugin</artifactId>
<version>2.0.1</version>
<executions>
<execution>
<phase>package</phase>
<id>package-development</id>
<goals>
<goal>rpm</goal>
</goals>
</execution>
</executions>
<configuration>
<copyright>No body</copyright>
<group>Development</group>
<description>MavenRecipe:RPMPackage.</description>
<mappings>
<mapping>
<directory>/opt/tomcat/webapps/${project.build.finalName}</directory>
<sources>
<source>
<location>target/${project.build.finalName}</location>
</source>
</sources>
</mapping>
</mappings>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>deb</id>
<activation>
<os>
<family>linux</family>
</os>
</activation>
<build>
<finalName>FinalName</finalName>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
</plugin>
<plugin>
<groupId>com.springsource.bundlor</groupId>
<artifactId>com.springsource.bundlor.maven</artifactId>
<version>1.0.0.M1B</version>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<inherited>false</inherited>
<configuration>
<descriptorRefs>
<descriptorRef>project</descriptorRef>
</descriptorRefs>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.vafer</groupId>
<artifactId>jdeb</artifactId>
<version>1.0</version>
<executions>
<execution>
<id>deb</id>
<phase>install</phase>
<goals>
<goal>jdeb</goal>
</goals>
<configuration>
<verbose>true</verbose>
<deb>target/${project.build.finalName}${project.version}.deb</deb>
<controlDir>/home/dbobra/Workspace/project-workspace/projectname/src/deb/control</controlDir>
<dataSet>
<data>
<src>${project.build.directory}/${project.build.finalName}</src>
<type>directory</type>
<mapper>
<type>perm</type>
<prefix>/home/dbobra/installed/tomcat/webapps/${project.build.finalName}</prefix>
</mapper>
</data>
</dataSet>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
If you need to create both file you have build with this command
mvn clean install -e
If you need to create deb file only then you use command
mvn clean install -P '!rpm' -e
If you need to create rpm file only then you use command
mvn clean install -P '!deb' -e
Hope this stuff works on your problems.

Eclipse m2e connector for JAX-WS org.codehaus.mojo

I am trying to consume a webservice using wsimport goal declared at maven build. But I am facing the problem with m2e connectors. There is an error in my POM which says
Plugin execution not covered by lifecycle configuration: org.codehaus.mojo:jaxws-maven-
plugin:1.10:wsimport (execution: default, phase: generate-sources)
I have been trying to install m2e connectors but not getting them even in marketplace. There are other m2e connectors but not for JAX-WS which i need.
I have followed and tried almost each solution mentioned here but all in vain.
Although there is no problem in generating the resources. The resources are generated at build time successfully but this POM error is not allowing my project to get sync with my tomcat and each time I have to deploy the war manually to test even the little changes i make.
All this is really annoying and I need to figure out a solution to this. I am using eclipse juno in this.
Below is the POM file I am using
<build>
<finalName>home</finalName>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
<version>1.10</version>
<executions>
<execution>
<phase>post-clean</phase>
<goals>
<goal>wsimport</goal>
</goals>
</execution>
</executions>
<!-- -->
<configuration>
<wsdlUrls>
<wsdlUrl>http://localhost:8080/email-service/services/EmailService?wsdl</wsdlUrl>
</wsdlUrls>
<sourceDestDir>${project.build.directory}/generated</sourceDestDir>
<verbose>true</verbose>
</configuration>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.1</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<id>additional-resources</id>
<phase>process-resources</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/home/WEB-INF/classes</outputDirectory>
<resources>
<resource>
<directory>${project.basedir}/src/main/webapp/resources/props</directory>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
There is a M2E jaxws-maven-connector GitHub project: https://github.com/trajano/jaxws-maven-connector . It worked for me with Eclipse Kepler and org.codehaus.mojo:jaxws-maven-plugin:1.12.
Choose Install new Software from the Help menu.
Add the repository https://raw.github.com/trajano/jaxws-maven-connector/master/jaxws-connector-update-site/ (see project)
Install m2e connector for jaxws and restart.
Import the Maven project or update the Eclipse Maven project configuration.
Vote for https://github.com/javaee/metro-jaxws-commons/issues/124 and get this fixed in the plugin.
Then you don't need a connector.
In the meantime you can hack this as per Archimedes Trajano's post
Though I did keep the jaxws-maven-connector updated to work with the latest M2E and jaxws-maven-plugin, I found a better way (which I also posted on http://www.trajano.net/2013/12/jaxws-maven-plugin-and-m2e/)
You add the following profile to your pom.xml file to remove the need for a non-discoverable M2E plugin.
<profile>
<id>m2e</id>
<activation>
<property>
<name>m2e.version</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.8</version>
<executions>
<execution>
<id>attach-wsimport-sources</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>${basedir}/target/generated-sources/wsimport</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>
org.jvnet.jax-ws-commons
</groupId>
<artifactId>
jaxws-maven-plugin
</artifactId>
<versionRange>
[2.3.1-b03,)
</versionRange>
<goals>
<goal>wsimport</goal>
</goals>
</pluginExecutionFilter>
<action>
<execute />
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</profile>
As for the jaxws-maven-plugin configuration, just keep it to the defaults as much as possible:
<plugin>
<groupId>org.jvnet.jax-ws-commons</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
<version>2.3.1-b03</version>
<configuration>
<wsdlUrls>
<wsdlUrl>http://www.webservicex.net/ConvertAcceleration.asmx?WSDL</wsdlUrl>
</wsdlUrls>
</configuration>
<executions>
<execution>
<id>wsimport</id>
<goals>
<goal>wsimport</goal>
</goals>
</execution>
</executions>
</plugin>