Within a larger Maven project, I have a Java file (AudioFileBuilder.java) that generates audio files from the Google Cloud Text-to-Speech service. It can execute from its own main() class; however, this file references an enumeration within the project (that other project source files depend on).
I am creating a fat JAR (JAR-with-dependencies), .exe file (Windows), and .app file (macOS) for the main project. I would like to exclude the AudioFileBuilder.java file AND the associated Google Cloud Text-to-Speech dependency in the JAR, exe, and app files. However, I still need the AudioFileBuilder.java file to run every time the project is built.
Here is a link to my project's current POM file (the project is open-source):
https://github.com/hadi16/GamesForTheBlind/blob/Alex-Branch/pom.xml
This is my current POM file:
<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>edu.up</groupId>
<artifactId>Games_For_Blind</artifactId>
<version>1.0.0.0</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<packaging>jar</packaging>
<dependencies>
<!-- Compile Dependencies -->
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-texttospeech</artifactId>
<version>0.117.0-beta</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId>
<version>2.3.2</version>
<scope>compile</scope>
</dependency>
<!-- Test Dependencies -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>12</source>
<target>12</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.1.1</version>
<configuration>
<outputDirectory>${project.build.directory}/dist</outputDirectory>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<mainClass>gamesforblind.Main</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
<executions>
<execution>
<id>assemble-all</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<id>copy-resources</id>
<phase>process-classes</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${project.build.outputDirectory}</outputDirectory>
<resources>
<resource>
<directory>${basedir}/target/xsd-out</directory>
<filtering>false</filtering>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<!-- To generate the phrase audio files. -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.6.0</version>
<executions>
<execution>
<phase>prepare-package</phase>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
<configuration>
<executable>java</executable>
<arguments>
<argument>-classpath</argument>
<classpath/>
<argument>gamesforblind.synthesizer.AudioFileBuilder</argument>
</arguments>
<environmentVariables>
<GOOGLE_APPLICATION_CREDENTIALS>google_api_key.json</GOOGLE_APPLICATION_CREDENTIALS>
</environmentVariables>
</configuration>
</plugin>
<!-- Create executable Windows file. -->
<plugin>
<groupId>com.akathist.maven.plugins.launch4j</groupId>
<artifactId>launch4j-maven-plugin</artifactId>
<version>1.7.25</version>
<executions>
<execution>
<id>l4j-clui</id>
<phase>package</phase>
<goals>
<goal>launch4j</goal>
</goals>
<configuration>
<headerType>gui</headerType>
<jar>${project.build.directory}/dist/${project.artifactId}-${project.version}-jar-with-dependencies.jar</jar>
<outfile>${project.build.directory}/dist/${project.artifactId}-${project.version}.exe</outfile>
<classPath>
<mainClass>gamesforblind.Main</mainClass>
</classPath>
<jre>
<minVersion>12</minVersion>
<jdkPreference>preferJre</jdkPreference>
</jre>
<versionInfo>
<copyright>2019</copyright>
<fileVersion>${project.version}</fileVersion>
<txtFileVersion>${project.version}</txtFileVersion>
<fileDescription>${project.name}</fileDescription>
<productVersion>${project.version}</productVersion>
<txtProductVersion>${project.version}</txtProductVersion>
<productName>${project.name}</productName>
<internalName>${project.name}</internalName>
<originalFilename>${project.artifactId}-${project.version}.exe</originalFilename>
<companyName>University of Portland</companyName>
</versionInfo>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>de.perdian.maven.plugins</groupId>
<artifactId>macosappbundler-maven-plugin</artifactId>
<version>1.3.0</version>
<configuration>
<plist>
<CFBundleDisplayName>Games For The Blind</CFBundleDisplayName>
<JVMMainClassName>gamesforblind.Main</JVMMainClassName>
<JVMVersion>12</JVMVersion>
<CFBundleDisplayName>Games For The Blind</CFBundleDisplayName>
<CFBundleName>Games For The Blind</CFBundleName>
</plist>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>bundle</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
UPDATE:
I divided the project into two separate modules: "audio-builder" & "application" - as suggested by Welsh.
However, I have a Java enumeration ("Phrases.java") that both the audio-builder & application uses. The audio-builder needs this file to know which audio phrases are currently in the program, while the rest of the application needs this to load in said audio files & call the playback of these files.
So, this made me add the "audio-builder" module as a dependency for the "application" module. Since the Google Cloud dependency is needed at compile-time, this means that it is bundled in the generated JAR, app, and exe files.
These changes can be found here: https://github.com/hadi16/GamesForTheBlind/tree/Maven-Fixes
Root POM file:
<?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>edu.up</groupId>
<artifactId>games-for-the-blind</artifactId>
<version>1.0.0.0</version>
<modules>
<module>games-for-the-blind/audio-builder</module>
<module>games-for-the-blind/application</module>
</modules>
<packaging>pom</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
</project>
Audio-builder POM file:
<?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>edu.up</groupId>
<artifactId>audio-builder</artifactId>
<version>1.0.0.0</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-texttospeech</artifactId>
<version>0.117.0-beta</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>12</source>
<target>12</target>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.6.0</version>
<executions>
<execution>
<phase>prepare-package</phase>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
<configuration>
<executable>java</executable>
<arguments>
<argument>-classpath</argument>
<classpath/>
<argument>builder.AudioFileBuilder</argument>
</arguments>
<environmentVariables>
<GOOGLE_APPLICATION_CREDENTIALS>google_api_key.json</GOOGLE_APPLICATION_CREDENTIALS>
</environmentVariables>
</configuration>
</plugin>
</plugins>
</build>
</project>
Application POM file (note the dependency to audio-builder):
<?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>edu.up</groupId>
<artifactId>application</artifactId>
<version>1.0.0.0</version>
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<!-- Compile Dependencies -->
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId>
<version>2.3.2</version>
<scope>compile</scope>
</dependency>
<!-- Test Dependencies -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>edu.up</groupId>
<artifactId>audio-builder</artifactId>
<version>1.0.0.0</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>12</source>
<target>12</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.1.1</version>
<configuration>
<outputDirectory>${project.build.directory}/dist</outputDirectory>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<mainClass>gamesforblind.Main</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
<executions>
<execution>
<id>assemble-all</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<id>copy-resources</id>
<phase>process-classes</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${project.build.outputDirectory}</outputDirectory>
<resources>
<resource>
<directory>${basedir}/target/xsd-out</directory>
<filtering>false</filtering>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<!-- Create executable Windows file. -->
<plugin>
<groupId>com.akathist.maven.plugins.launch4j</groupId>
<artifactId>launch4j-maven-plugin</artifactId>
<version>1.7.25</version>
<executions>
<execution>
<id>l4j-clui</id>
<phase>package</phase>
<goals>
<goal>launch4j</goal>
</goals>
<configuration>
<headerType>gui</headerType>
<jar>
${project.build.directory}/dist/${project.artifactId}-${project.version}-jar-with-dependencies.jar
</jar>
<outfile>${project.build.directory}/dist/${project.artifactId}-${project.version}.exe
</outfile>
<classPath>
<mainClass>gamesforblind.Main</mainClass>
</classPath>
<jre>
<minVersion>12</minVersion>
<jdkPreference>preferJre</jdkPreference>
</jre>
<versionInfo>
<copyright>2019</copyright>
<fileVersion>${project.version}</fileVersion>
<txtFileVersion>${project.version}</txtFileVersion>
<fileDescription>${project.name}</fileDescription>
<productVersion>${project.version}</productVersion>
<txtProductVersion>${project.version}</txtProductVersion>
<productName>${project.name}</productName>
<internalName>${project.name}</internalName>
<originalFilename>${project.artifactId}-${project.version}.exe</originalFilename>
<companyName>University of Portland</companyName>
</versionInfo>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>de.perdian.maven.plugins</groupId>
<artifactId>macosappbundler-maven-plugin</artifactId>
<version>1.3.0</version>
<configuration>
<plist>
<CFBundleDisplayName>Games For The Blind</CFBundleDisplayName>
<JVMMainClassName>gamesforblind.Main</JVMMainClassName>
<JVMVersion>12</JVMVersion>
<CFBundleDisplayName>Games For The Blind</CFBundleDisplayName>
<CFBundleName>Games For The Blind</CFBundleName>
</plist>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>bundle</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Thank you!
I would recommend that you split your projects into two sub projects, so you would have for example:
games-for-the-blind/
pom.xml
audio-builder/
pom.xml
application/
pom.xml
Then what you can do is have the audio-builder package output the required files into the application/resources directory and have it listed first in the main pom.xml file.
This would allow you to distribute the application resultant files that would not contain any of the details of the audio-builder project.
Related
I'm trying to use Asciidoctor to generate an html file using the method built in asciidocj (convertFile)
I'm getting java.lang.NoClassDefFoundError:org/asciidoctor/OptionsBuilder
I'm working on eclipse ; maven and
I added the Asciidoctor dependency in the pom.xml file.
public void view(String document) {
OptionsBuilder op = OptionsBuilder.options().toFile(false);
Asciidoctor asciidoctor = create();
String html = asciidoctor.convertFile(new File(this.path + "/" + document + ".adoc"), op.asMap());
System.out.println(html);
}
<?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>ProgGl</groupId>
<artifactId>PriseDeNotes</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>PriseDeNotes</name>
<description>Projet de Prog Gl</description>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<main-class>ProgGl.PriseDeNote.App</main-class>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.2</version>
<configuration>
<archive>
<manifest>
<mainClass>${main-class}</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.asciidoctor</groupId>
<artifactId>asciidoctor-maven-plugin</artifactId>
<version>1.5.6</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.3</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>2.7</version>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<mainClass>${main-class}</mainClass>
</manifest>
</archive>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-source-plugin</artifactId>
<version>3.0.1</version>
<executions>
<execution>
<id>attach-sources</id>
<phase>package</phase>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.0.0-M1</version>
<executions>
<execution>
<id>attach-javadocs</id>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-maven-plugin</artifactId>
<version>3.1.7</version>
<dependencies>
<!-- overwrite dependency on spotbugs if you want to specify the version of spotbugs -->
<dependency>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs</artifactId>
<version>3.1.8</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>3.0.0</version>
<reportSets>
<reportSet>
<reports>
<report>checkstyle</report>
</reports>
</reportSet>
</reportSets>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jxr-plugin</artifactId>
<version>2.3</version>
</plugin>
</plugins>
</reporting>
<dependencies>
<dependency>
<groupId>org.asciidoctor</groupId>
<artifactId>asciidoctorj</artifactId>
<version>2.0.0</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-all</artifactId>
<version>1.3</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
mvn install, package everything is working fine,
when I execute the program I'm getting this error.
I read that it's about class path etc... but I don't understand how to do otherwise
Exception in thread "main" java.lang.NoClassDefFoundError: org/asciidoctor/OptionsBuilder
at ProgGl.PriseDeNote.Application.view(Application.java:171)
at ProgGl.PriseDeNote.Commands.ViewCommand.execute(ViewCommand.java:22)
at ProgGl.PriseDeNote.App.main(App.java:66)
Caused by: java.lang.ClassNotFoundException: org.asciidoctor.OptionsBuilder
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 3 more
Thank you.
General, the maven assembly plugin generates another .jar called target/PriseDeNotes-0.0.1-SNAPSHOT-jar-with-dependencies.jar.
You can try java -jar target/PriseDeNotes-0.0.1-SNAPSHOT-jar-with-dependencies.jar to run the application.
I see you have the maven-assembly-plugin already. Compile with mvn clean compile assembly:single then run with java -jar target/PriseDeNotes-0.0.1-SNAPSHOT-jar-with-dependencies.jar.
I think the problem is, that maven doesn't copy the dependencies into the jar. Try to copy the dependencies in the target with the related plugin you can find here:
https://maven.apache.org/plugins/maven-dependency-plugin/examples/copying-project-dependencies.html
With this, it should copy the needed dependencies to the target folder.
I'm using the latest gwt maven plugin (https://tbroyer.github.io/gwt-maven-plugin/index.html) to compile a multi module GWT project and deploy it to tomcat 9. I am also using intellij 14 as my IDE. It's a client app only ie. no server/servlet. When I build via the IDE gwt plugin and zip up and deploy that output to tomcat my app works fine.
However, using the maven plugin, everything compiles ok and the contents of the war look fine to me. The war deploys ok to tomcat, but I simply see a blank page when I try to load it on my browser (latest chrome edition).
I'm running dev tools and jscript console and there are no errors being reported, network view, shows the content downloading ok. I've set break points in my nocache js files and stepped through it with no problems. Below is my pom. I'd appreciated any insight / help with this as it's been bugging me for days..
<?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">
<parent>
<artifactId>guml-ui</artifactId>
<groupId>guml-ui</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>dashboard</artifactId>
<!--<packaging>gwt-app</packaging>-->
<dependencies>
<dependency>
<groupId>guml-ui</groupId>
<artifactId>myworkspace</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>guml-ui</groupId>
<artifactId>project</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>guml-ui</groupId>
<artifactId>common</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
<build>
<resources>
<resource>
<directory>src/main/java/au/com/guml/ui/components/dashboard/public</directory>
</resource>
<resource>
<directory>war</directory>
</resource>
</resources>
<plugins>
<plugin>
<groupId>net.ltgt.gwt.maven</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>1.0-rc-9</version>
<extensions>true</extensions>
<configuration>
<moduleName>au.com.guml.ui.components.dashboard.Dashboard</moduleName>
<moduleShortName>Dashboard</moduleShortName>
<warDir>${basedir}/../gumlui-war/target/gumlui-war-${project.version}</warDir>
<devmodeWorkDir>${basedir}/../gumlui-war/target/gumlui-war-${project.version}</devmodeWorkDir>
<webappDirectory>${basedir}/../gumlui-war/target/gumlui-war-${project.version}</webappDirectory>
<skipModule>true</skipModule>
<draftCompile>true</draftCompile>
<startupUrls>Dashboard.html</startupUrls>
</configuration>
<executions>
<execution>
<id>compile-module-common</id>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<moduleName>au.com.guml.ui.components.common.Common</moduleName>
<moduleShortName>Common</moduleShortName>
</configuration>
</execution>
<execution>
<id>compile-module-myworkspace</id>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<moduleName>au.com.guml.ui.components.myworkspace.MyWorkspace</moduleName>
<moduleShortName>MyWorkspace</moduleShortName>
</configuration>
</execution>
<execution>
<id>compile-module-project</id>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<moduleName>au.com.guml.ui.components.project.Project</moduleName>
<moduleShortName>Project</moduleShortName>
</configuration>
</execution>
<execution>
<id>compile-module-dashboard</id>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<moduleName>au.com.guml.ui.components.dashboard.Dashboard</moduleName>
<moduleShortName>Dashboard</moduleShortName>
</configuration>
</execution>
</executions>
</plugin>
<!-- copy the host html page -->
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.2</version>
<executions>
<execution>
<id>copy-hosthtml</id>
<phase>prepare-package</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${basedir}/../gumlui-war/target/gumlui-war-${project.version}</outputDirectory>
<resources>
<resource>
<directory>war</directory>
<filtering>true</filtering>
</resource>
</resources>
</configuration>
</execution>
<execution>
<id>copy-public</id>
<phase>prepare-package</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${basedir}/../gumlui-war/target/gumlui-war-${project.version}/Dashboard</outputDirectory>
<resources>
<resource>
<directory>src/main/java/au/com/guml/ui/components/dashboard/public</directory>
<filtering>true</filtering>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
Cheers,
Matt.
For anyone that is interested I got the maven build working on the multi module gwt project. See the following pom (dashboard) which is my app which inherits other modules.
<?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">
<parent>
<artifactId>guml-ui</artifactId>
<groupId>guml-ui</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>dashboard</artifactId>
<!--<packaging>gwt-app</packaging>-->
<dependencies>
<dependency>
<groupId>guml-ui</groupId>
<artifactId>myworkspace</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>guml-ui</groupId>
<artifactId>project</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>guml-ui</groupId>
<artifactId>common</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>4.1.0.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator-sources</artifactId>
<version>4.1.0.Final</version>
<scope>system</scope>
<systemPath>${project.basedir}/src/main/webapp/WEB-INF/lib/hibernate-validator-4.1.0.Final-sources.jar</systemPath>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.6.1</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.6.1</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.16</version>
</dependency>
</dependencies>
<build>
<resources>
<resource>
<directory>src/main/java/au/com/guml/ui/components/dashboard/public</directory>
</resource>
<resource>
<directory>src/main/java</directory>
</resource>
</resources>
<plugins>
<plugin>
<groupId>net.ltgt.gwt.maven</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>1.0-rc-9</version>
<extensions>true</extensions>
<configuration>
<moduleName>au.com.guml.ui.components.dashboard.Dashboard</moduleName>
<moduleShortName>Dashboard</moduleShortName>
<warDir>${basedir}/../gumlui-war/target/gumlui</warDir>
<devmodeWorkDir>${basedir}/../gumlui-war/target/gumlui</devmodeWorkDir>
<webappDirectory>${basedir}/../gumlui-war/target/gumlui</webappDirectory>
<skipModule>true</skipModule>
<startupUrls>Dashboard.html</startupUrls>
<!--<style>PRETTY</style>-->
</configuration>
<executions>
<execution>
<id>compile-module-common</id>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<moduleName>au.com.guml.ui.components.common.Common</moduleName>
<moduleShortName>Common</moduleShortName>
</configuration>
</execution>
<execution>
<id>compile-module-myworkspace</id>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<moduleName>au.com.guml.ui.components.myworkspace.MyWorkspace</moduleName>
<moduleShortName>MyWorkspace</moduleShortName>
</configuration>
</execution>
<execution>
<id>compile-module-project</id>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<moduleName>au.com.guml.ui.components.project.Project</moduleName>
<moduleShortName>Project</moduleShortName>
</configuration>
</execution>
<execution>
<id>compile-module-dashboard</id>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<moduleName>au.com.guml.ui.components.dashboard.Dashboard</moduleName>
<moduleShortName>Dashboard</moduleShortName>
</configuration>
</execution>
</executions>
</plugin>
<!-- copy the host html page -->
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.2</version>
<executions>
<execution>
<id>copy-public</id>
<phase>prepare-package</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${basedir}/../gumlui-war/target/gumlui/Dashboard</outputDirectory>
<resources>
<resource>
<directory>src/main/java/au/com/guml/ui/components/dashboard/public</directory>
<filtering>true</filtering>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
I have to include the build resources entries on this pom and my inherited projects to manually include the public directory, not sure why, this appears to a quirk with the plugin.
I am writing my groovy code in maven using GMaven plugin. when I do mvn clean install it is showing build success but when I checked my target folder it is not generating any jar for me. I am refering this atlassian link in that
<plugins>
<plugin>
<executions>
<execution>
<goals>
<goal>generateStubs</goal>
<goal>compile</goal>
<goal>generateTestStubs</goal>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
but for this I am getting pom error on execution. please help me out here
Below is my pom file
<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.myproject</groupId>
<artifactId>mydata</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>mydata</name>
<url>http://maven.apache.orgurl>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<gmaven.version>1.5</gmaven.version>
<groovy.version>2.1.8</groovy.version>
</properties>
<dependencies>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<version>2.4.11</version>
</dependency>
</dependencies>
<build>
<!-- <pluginManagement> -->
<plugins>
<plugin>
<groupId>org.codehaus.gmaven</groupId>
<artifactId>gmaven-plugin</artifactId>
<version>${gmaven.version}</version>
<configuration>
<providerSelection>2.0</providerSelection>
</configuration>
<dependencies>
<dependency>
<groupId>org.codehaus.gmaven.runtime</groupId>
<artifactId>gmaven-runtime-2.0</artifactId>
<version>${gmaven.version}</version>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<version>${groovy.version}</version>
</dependency>
</dependencies>
<!-- <executions>
<execution>
<goals>
<goal>generateStubs</goal>
<goal>compile</goal>
<goal>generateTestStubs</goal>
<goal>testCompile</goal>
</goals>
</execution>
</executions> -->
</plugin>
</plugins>
<!-- </pluginManagement> -->
</build>
</project>
UPDATE 1:
I am able to see the jar but it does not have my groovy code
Can you please try the following:
<plugin>
<groupId>org.codehaus.gmavenplus</groupId>
<artifactId>gmavenplus-plugin</artifactId>
<version>1.5</version>
<executions>
<execution>
<goals>
<goal>addSources</goal>
<goal>compile</goal>
</goals>
</execution>
</executions>
<configuration>
<sources>
<source>
<directory>${project.basedir}/src</directory>
<includes>
<include>**/*.groovy</include>
</includes>
</source>
</sources>
</configuration>
</plugin>
Actually that's what I'm using and jar is correctly generated
PS: Make sure that source.directory points to where your .groovy files exist
I'm modifying Weka, an open-source Maven project, and my modifications are running perfectly on eclipse. However, when I export to an executable jar file, I get a null pointer exception, because it's not able to find the images I created and added to the project upon getImage() calls.
It seems that this is a rather common problem with jar files, so I tried using the URL method to load, but upon further investigation, when I look into the jar file with SecureZIP, the images(.png) that I added to the project are not even in the jar (however, the images (.png) that were in the original open source distribution were, despite the fact that all the images were in the same folder and of the same type (.png) designated by the build path in the source). Is there something I'm forgetting to do? Why are my images not exporting to the jar, but the other images in the folder are?
Library Handling is: "Extract required libraries into generated JAR".
Images are in src/main/java/weka/gui.
<?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>nz.ac.waikato.cms.weka</groupId>
<artifactId>weka-stable</artifactId>
<version>3.8.1-SNAPSHOT</version>
<!-- weka-version -->
<packaging>jar</packaging>
<name>weka-stable</name>
<description>The Waikato Environment for Knowledge Analysis (WEKA), a machine learning workbench. This is the stable version. Apart from bugfixes, this version does not receive any other updates.
</description>
<url>http://www.cms.waikato.ac.nz/ml/weka/</url>
<organization>
<name>University of Waikato, Hamilton, NZ</name>
<url>http://www.waikato.ac.nz/</url>
</organization>
<licenses>
<license>
<name>GNU General Public License 3</name>
<url>http://www.gnu.org/licenses/gpl-3.0.txt</url>
<distribution>repo</distribution>
</license>
</licenses>
<developers>
<developer>
<id>wekateam</id>
<name>The WEKA Team</name>
<email>wekalist#list.waikato.ac.nz</email>
</developer>
</developers>
<mailingLists>
<mailingList>
<name>wekalist</name>
<subscribe>https://list.waikato.ac.nz/mailman/listinfo/wekalist</subscribe>
<unsubscribe>https://list.waikato.ac.nz/mailman/listinfo/wekalist</unsubscribe>
<archive>https://list.waikato.ac.nz/mailman/htdig/wekalist/</archive>
</mailingList>
</mailingLists>
<parent>
<groupId>org.sonatype.oss</groupId>
<artifactId>oss-parent</artifactId>
<version>7</version>
</parent>
<scm>
<connection>scm:svn:https://svn.cms.waikato.ac.nz/svn/weka/branches/stable-3-8/weka</connection>
<developerConnection>scm:svn:https://svn.cms.waikato.ac.nz/svn/weka/branches/stable-3-8/weka</developerConnection>
<url>https://svn.cms.waikato.ac.nz/svn/weka/branches/stable-3-8/weka</url>
</scm>
<profiles>
<profile>
<id>release-sign-artifacts</id>
<activation>
<property>
<name>performRelease</name>
<value>true</value>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.1</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<!-- used for skipping tests -->
<id>no-tests</id>
<properties>
<skipTests>true</skipTests>
</properties>
</profile>
</profiles>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>nz.ac.waikato.cms.weka.thirdparty</groupId>
<artifactId>java-cup-11b</artifactId>
<version>2015.03.26</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>nz.ac.waikato.cms.weka.thirdparty</groupId>
<artifactId>java-cup-11b-runtime</artifactId>
<version>2015.03.26</version>
</dependency>
<dependency>
<groupId>nz.ac.waikato.cms.weka.thirdparty</groupId>
<artifactId>bounce</artifactId>
<version>0.18</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-compress</artifactId>
<version>1.10</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.googlecode.matrix-toolkits-java</groupId>
<artifactId>mtj</artifactId>
<version>1.0.4</version>
</dependency>
<dependency>
<groupId>net.sourceforge.f2j</groupId>
<artifactId>arpack_combined_all</artifactId>
<version>0.1</version>
</dependency>
<dependency>
<groupId>com.googlecode.netlib-java</groupId>
<artifactId>netlib-java</artifactId>
<version>1.1</version>
</dependency>
</dependencies>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<weka.main.class>weka.gui.GUIChooser</weka.main.class>
</properties>
<build>
<directory>dist</directory>
<outputDirectory>build/classes</outputDirectory>
<testOutputDirectory>build/testcases</testOutputDirectory>
<resources>
<resource>
<targetPath>${project.build.outputDirectory}</targetPath>
<directory>${project.build.sourceDirectory}</directory>
<includes>
<include>**/*.arff</include>
<include>**/*.cost</include>
<include>**/*.cup</include>
<include>**/*.default</include>
<include>**/*.excludes</include>
<include>**/*.flex</include>
<include>**/*.gif</include>
<include>**/*.icns</include>
<include>**/*.ico</include>
<include>**/*.jflex</include>
<include>**/*.jpeg</include>
<include>**/*.jpg</include>
<include>**/*.kfml</include>
<include>**/*.matrix</include>
<include>**/*.png</include>
<include>**/*.properties</include>
<include>**/*.props</include>
<include>**/*.txt</include>
<include>**/*.xml</include>
<include>**/DatabaseUtils.props.*</include>
<include>weka/gui/beans/README</include>
</includes>
</resource>
<resource>
<targetPath>${project.build.testOutputDirectory}</targetPath>
<directory>${project.build.testSourceDirectory}</directory>
<includes>
<include>**/*.arff</include>
<include>**/*.cost</include>
<include>**/*.cup</include>
<include>**/*.default</include>
<include>**/*.excludes</include>
<include>**/*.flex</include>
<include>**/*.gif</include>
<include>**/*.icns</include>
<include>**/*.ico</include>
<include>**/*.jflex</include>
<include>**/*.jpeg</include>
<include>**/*.jpg</include>
<include>**/*.kfml</include>
<include>**/*.matrix</include>
<include>**/*.png</include>
<include>**/*.properties</include>
<include>**/*.props</include>
<include>**/*.txt</include>
<include>**/*.xml</include>
<include>**/DatabaseUtils.props.*</include>
<include>weka/gui/beans/README</include>
</includes>
</resource>
</resources>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.7.2</version>
<configuration>
<includes>
<include>**/*Test.java</include>
</includes>
<disableXmlReport>true</disableXmlReport>
<redirectTestOutputToFile>true</redirectTestOutputToFile>
<systemPropertyVariables>
<weka.test.Regression.root>src/test/resources/wekarefs</weka.test.Regression.root>
<weka.test.maventest>true</weka.test.maventest>
<user.timezone>Pacific/Auckland</user.timezone>
</systemPropertyVariables>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.1</version>
<configuration>
<tagBase>https://svn.cms.waikato.ac.nz/svn/weka/tags</tagBase>
<useReleaseProfile>false</useReleaseProfile>
<!-- tests are performed with the ant build file, hence skipped here. -->
<preparationGoals>clean verify -P no-tests</preparationGoals>
<goals>deploy -P no-tests</goals>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<version>2.4.1</version>
<configuration>
<filesets>
<fileset>
<directory>.</directory>
<includes>
<include>**/*~</include>
<include>**/.attach_pid*</include>
<include>**/hs_err_pid*</include>
</includes>
<followSymlinks>false</followSymlinks>
</fileset>
</filesets>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<archive>
<manifest>
<mainClass>${weka.main.class}</mainClass>
</manifest>
</archive>
</configuration>
<executions>
<execution>
<goals>
<goal>test-jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.1.2</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<excludeResources>true</excludeResources>
</configuration>
</execution>
<execution>
<id>attach-test-sources</id>
<goals>
<goal>test-jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.8.1</version>
<configuration>
<maxmemory>1000m</maxmemory>
<subpackages>weka:org</subpackages>
<show>public</show>
<outputDirectory>${project.basedir}/doc</outputDirectory>
<!-- when using Java 8, use this setting to avoid overly strict javadoclet -->
<!--additionalparam>-Xdoclint:none</additionalparam-->
</configuration>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
I am creating a jar-with-dependencies in mvn 3.0.3. I have successfully done this in one project (using just mvn install) and created a complete jar-wth-dependencies. I copied the relevant chunk of POM code (<plugins>...</plugins>, which someone else wrote!) to the current project (which differs in that it has assemblies). It creates the normal snapshot jar (jumbo-converters-compchem-gaussian-0.3-SNAPSHOT.jar) but no jar-with-dependencies. How should I amend the POM?
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>cml</groupId>
<artifactId>jumbo-converters</artifactId>
<version>0.3-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<artifactId>jumbo-converters-compchem-gaussian</artifactId>
<name>jumbo-converters-compchem-gaussian</name>
<dependencies>
<dependency>
<groupId>${jumbo.groupId}</groupId>
<artifactId>jumbo</artifactId>
</dependency>
<dependency>
<groupId>cml</groupId>
<artifactId>jumbo-converters-core</artifactId>
</dependency>
<dependency>
<groupId>cml</groupId>
<artifactId>jumbo-converters-compchem-common</artifactId>
<version>0.3-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>cml</groupId>
<artifactId>jumbo-converters-templates</artifactId>
<version>0.3-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>cml</groupId>
<artifactId>jumbo-converters-testutils</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>cml</groupId>
<artifactId>jumbo-converters-compchem-testutils</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<mainClass>org.xmlcml.cml.converters.compchem.gaussian.GaussianLogXML2CompchemConverter</mainClass>
</manifest>
</archive>
<excludes>
<exclude>.hgsub</exclude>
<exclude>**/.hg/</exclude>
<exclude>**/.project</exclude>
<exclude>**/external/</exclude>
</excludes>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<mainClass>org.xmlcml.cml.converters.compchem.gaussian.GaussianLogXML2CompchemConverter</mainClass>
</manifest>
</archive>
<excludes>
<exclude>.hgsub</exclude>
<exclude>**/.hg/</exclude>
<exclude>**/.project</exclude>
<exclude>**/external/</exclude>
</excludes>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
First,
Use maven dependency plugin to retrieve/store the dependencies (more info here) to your project folder.
Ex: Say lib folder.
Now mark this lib folder as a "Resources" folder.
Like,
<resources>
<resource>
<directory>lib</directory>
<targetPath>lib</targetPath>
</resource>
</resources>
Now mvn install should include the dependencies in your final artifact.
(copying Shinchan's comment to here so it can be formatted:
Simple add this to ur pom.
<build>
<resources>
<resource>
<directory>lib</directory>
<targetPath>lib</targetPath>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.8</version>
<executions>
<execution>
<phase>install</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>lib</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>