I am currently working on a project where I want to generate an ANTLR parser from a grammar and continue working with that parser inside my Scala code.
For this, I set up a new project with the following 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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>foo</groupId>
<artifactId>bar</artifactId>
<version>1.0-SNAPSHOT</version>
<name>${project.artifactId}</name>
<description>Foo</description>
<properties>
<maven.compiler.source>1.6</maven.compiler.source>
<maven.compiler.target>1.6</maven.compiler.target>
<encoding>UTF-8</encoding>
<scala.version>2.11.5</scala.version>
<scala.compat.version>2.11</scala.compat.version>
<antlr.version>4.7</antlr.version>
</properties>
<dependencies>
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
<version>${scala.version}</version>
</dependency>
<dependency>
<groupId>org.antlr</groupId>
<artifactId>antlr4-runtime</artifactId>
<version>${antlr.version}</version>
</dependency>
<!-- Test -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.specs2</groupId>
<artifactId>specs2-core_${scala.compat.version}</artifactId>
<version>2.4.16</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.scalatest</groupId>
<artifactId>scalatest_${scala.compat.version}</artifactId>
<version>2.2.4</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId>
<version>3.2.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
</plugin>
<plugin>
<groupId>org.antlr</groupId>
<artifactId>antlr4-maven-plugin</artifactId>
<version>${antlr.version}</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId>
<executions>
<execution>
<id>scala-compile-first</id>
<phase>process-resources</phase>
<goals>
<goal>add-source</goal>
<goal>compile</goal>
</goals>
</execution>
<execution>
<id>scala-test-compile</id>
<phase>process-test-resources</phase>
<goals>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.18.1</version>
<configuration>
<useFile>false</useFile>
<disableXmlReport>true</disableXmlReport>
<!-- If you have classpath issue like NoDefClassError,... -->
<!-- useManifestOnlyJar>false</useManifestOnlyJar -->
<includes>
<include>**/*Test.*</include>
<include>**/*Suite.*</include>
</includes>
</configuration>
</plugin>
<plugin>
<groupId>org.antlr</groupId>
<artifactId>antlr4-maven-plugin</artifactId>
<executions>
<execution>
<id>antlr</id>
<goals>
<goal>antlr4</goal>
</goals>
</execution>
</executions>
<configuration>
<visitor>true</visitor>
</configuration>
</plugin>
</plugins>
</build>
</project>
Compiling a project with a grammar file in the default location works just fine - Java sources are generated to target/generated-sources/antlr as expected.
However, I can not import the generated parser (let's call it FooParser) inside my Scala code - IntelliJ recognizes that there is something called
FooParser but when I try to auto-import it, it fails.
Also, building from the command line with mvn compile with source code
depending on the FooParser fails.
Resolution of the whole thing was rather dumb:
My file structure was wrong:
src/
main/
antlr/
Foo.g4
You have to put your grammars into proper packages, otherwise
the whole thing wont be properly 'importable'.
src/
main/
antlr/
packagename/
Foo.g4
Related
attempting to build [RedFX-Quantum/Strange][1]. When running mvn package, I get "Fatal error compiling: invalid flag: --release". the pom.xml file is below:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.redfx</groupId>
<artifactId>strange</artifactId>
<packaging>jar</packaging>
<version>0.1.3</version>
<name>Strange</name>
<description>Strange Quantum Simulator</description>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<javadoc.plugin.version>3.2.0</javadoc.plugin.version>
<gpg.plugin.version>1.6</gpg.plugin.version>
</properties>
<dependencies>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.5.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId>
<version>5.5.2</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.5.2</version>
</dependency>
<!--
<dependency>
<groupId>org.nd4j</groupId>
<artifactId>nd4j-native</artifactId>
<version>1.0.0-beta7</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-nop</artifactId>
<version>1.7.26</version>
</dependency>
-->
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<release>10</release>
</configuration>
<dependencies>
<dependency>
<groupId>org.ow2.asm</groupId>
<artifactId>asm</artifactId>
<version>6.1.1</version> <!-- Use newer version of ASM -->
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
<configuration>
<mainClass>org.redfx.strange.demo.Demo</mainClass>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.2</version>
<executions>
<execution>
<goals>
<goal>test-jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M5</version>
<configuration>
<trimStackTrace>false</trimStackTrace>
</configuration>
</plugin>
<!--
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.7</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>true</autoReleaseAfterClose>
</configuration>
</plugin>
-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.0.0-M3</version>
<executions>
<execution>
<id>enforce-no-snapshots</id>
<phase>install</phase>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireReleaseDeps>
<message>Snapshot dependencies are not allowed for release project version!</message>
<onlyWhenRelease>true</onlyWhenRelease>
</requireReleaseDeps>
</rules>
<fail>true</fail>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>license-maven-plugin</artifactId>
<version>2.0.0</version>
<configuration>
<organizationName>Johan Vos</organizationName>
<inceptionYear>2020</inceptionYear>
<licenseName>bsd_3</licenseName>
<addJavaLicenseAfterPackage>false</addJavaLicenseAfterPackage>
</configuration>
</plugin>
</plugins>
</build>
<distributionManagement>
<snapshotRepository>
<id>ossrh</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
<repository>
<id>ossrh</id>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
</distributionManagement>
<profiles>
<profile>
<id>release</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.2.1</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>${javadoc.plugin.version}</version>
<configuration>
<detectJavaApiLink>false</detectJavaApiLink>
<source>8</source>
</configuration>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.7</version>
<configuration>
<skip>false</skip>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>${gpg.plugin.version}</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
<configuration>
<!-- This is necessary for gpg to not try to use the pinentry programs -->
<!-- Only required for GPG >= 2.2 -->
<!--
<gpgArguments>
<arg>--pinentry-mode</arg>
<arg>loopback</arg>
</gpgArguments>
-->
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<scm>
<connection>scm:git:git://github.com/redfx-quantum/strange.git</connection>
<developerConnection>scm:git:git#github.com:redfx-quantum/strange.git</developerConnection>
<url>https://github.com/redfx-quantum/strange</url>
<tag>HEAD</tag>
</scm>
</project>
running mvn package -e didn't give any noticeably different output and mvn package -X didn't give me anything I could understand. How would I go about fixing it? Looking in the pom.xml file, the only release related thing I could see was the <release>10<\release> but idk what to change that to if that is the problem. I'm assuming I have to change things in the file to fit what versions of java and maven I have but I'm pretty new to the both of them and don't really know what I'm looking for.
[1]https://github.com/redfx-quantum/strange
According to the https://github.com/xebia-france/selma/blob/master/examples/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>
<groupId>com.mapper</groupId>
<artifactId>Selma</artifactId>
<version>0.0.1-SNAPSHOT</version>
<build>
<sourceDirectory>src</sourceDirectory>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.bsc.maven</groupId>
<artifactId>maven-processor-plugin</artifactId>
<version>2.2.4</version>
<configuration>
<defaultOutputDirectory>
${project.build.directory}/generated-sources/selma
</defaultOutputDirectory>
<processors>
<processor>fr.xebia.extras.selma.codegen.MapperProcessor</processor>
</processors>
</configuration>
<executions>
<execution>
<id>process</id>
<phase>generate-sources</phase>
<goals>
<goal>process</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>fr.xebia.extras</groupId>
<artifactId>selma-processor</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>fr.xebia.extras</groupId>
<artifactId>example-common</artifactId>
<version>0.16-SNAPSHOT</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.9.1</version>
<executions>
<execution>
<id>add-source</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>${project.build.directory}/generated-sources/selma</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
<dependencies>
<dependency>
<groupId>fr.xebia.extras</groupId>
<artifactId>selma-processor</artifactId>
<version>0.15</version>
<scope>provided</scope>
</dependency>
<!-- This is the only real dependency you will have in your binaries -->
<dependency>
<groupId>fr.xebia.extras</groupId>
<artifactId>selma</artifactId>
<version>0.15</version>
</dependency>
</dependencies>
</project>
I create a selma sample, but codes could not generated. And when running, there is an error
Caused by: java.lang.ClassNotFoundException:com.mapper.mapper.SelmaMapperSelmaGeneratedClass
Is there any other configuration should be added to generate codes?
I misunderstood the meaning to compile time, indeed, I should run the maven command clean install. Then the codes are generated.
to use Selma inside eclipse without Maven, you should add both processor and api jar to the path of the annotation processor plugin.
This should be somewhere in project settings, see plugin documentation for this purpose: https://www.eclipse.org/jdt/apt/introToAPT.php .
How can I pack switchyard application with has dependencies to my another project with Maven? Currently I'm trying to make things work as explained here
official dock.
But with no result, on startup of application in log file I see
Caused by: java.lang.NoClassDefFoundError: com/aspiderngi/common/switchyard/InventoryRequest
Caused by: java.lang.ClassNotFoundException: com.aspiderngi.common.switchyard.InventoryRequest from...
Is it possible to achieve anyways?
pom.xml:
<?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>
<groupId>com.example.switchyard</groupId>
<version>0.0.1-SNAPSHOT</version>
<name>com.example.switchyard:sy-example</name>
<artifactId>sy-example</artifactId>
<properties>
<switchyard.version>2.0.0.Final</switchyard.version>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
</properties>
<packaging>war</packaging>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.switchyard</groupId>
<artifactId>switchyard-bom</artifactId>
<version>${switchyard.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>com.aspiderngi</groupId>
<artifactId>artifacts-common</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.switchyard.components</groupId>
<artifactId>switchyard-component-camel</artifactId>
</dependency>
<dependency>
<groupId>org.switchyard.components</groupId>
<artifactId>switchyard-component-camel-jms</artifactId>
</dependency>
<dependency>
<groupId>org.switchyard.components</groupId>
<artifactId>switchyard-component-resteasy</artifactId>
</dependency>
<dependency>
<groupId>org.switchyard</groupId>
<artifactId>switchyard-api</artifactId>
</dependency>
<dependency>
<groupId>org.switchyard</groupId>
<artifactId>switchyard-transform</artifactId>
</dependency>
<dependency>
<groupId>org.switchyard</groupId>
<artifactId>switchyard-validate</artifactId>
</dependency>
<dependency>
<groupId>org.switchyard</groupId>
<artifactId>switchyard-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.switchyard.components</groupId>
<artifactId>switchyard-component-test-mixin-cdi</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.switchyard.components</groupId>
<artifactId>switchyard-component-bean</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.switchyard</groupId>
<artifactId>switchyard-plugin</artifactId>
<version>${switchyard.version}</version>
<executions>
<execution>
<goals>
<goal>configure</goal>
</goals>
</execution>
</executions>
<configuration>
<scannerClassNames>
<param>org.switchyard.transform.config.model.TransformSwitchYardScanner</param>
</scannerClassNames>
</configuration>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
<packagingExcludes>
WEB-INF/lib/*.jar,
WEB-INF/classes/META-INF/switchyard.xml
</packagingExcludes>
<webResources>
<resource>
<directory>target/classes/META-INF</directory>
<targetPath>WEB-INF</targetPath>
<includes>
<include>switchyard.xml</include>
</includes>
</resource>
</webResources>
</configuration>
</plugin>
</plugins>
</build>
</project>
You can use Maven Shade plugin:
https://maven.apache.org/plugins/maven-shade-plugin/
example:
<project>
...
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.4.1</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<shadedArtifactAttached>true</shadedArtifactAttached>
<shadedClassifierName>jackofall</shadedClassifierName> <!-- Any name that makes sense -->
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
...
</project>
Please try this out. The dependent project must have its own pom.xml(child)
Include this child pom to the parent pom. And include the below code in the parent pom.xml
This would directly deploy the application in the server
From project root in cmd execute the below commands:
1. mvn clean
2. mvn dependency:resolve
3. mvn install
if you are using Eclipse, use maven update. then Run As maven install
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<debug>true</debug>
</configuration>
</plugin>
<plugin>
<groupId>org.jboss.as.plugins</groupId>
<artifactId>jboss-as-maven-plugin</artifactId>
<configuration>
<skip>false</skip>
</configuration>
</plugin>
<plugin>
<groupId>org.switchyard</groupId>
<artifactId>switchyard-plugin</artifactId>
<version>${switchyard.version}</version>
<executions>
<execution>
<goals>
<goal>configure</goal>
</goals>
</execution>
</executions>
<configuration>
<scannerClassNames>
<param>org.switchyard.transform.config.model.TransformSwitchYardScanner</param>
</scannerClassNames>
</configuration>
</plugin>
<plugin>
<groupId>org.jboss.as.plugins</groupId>
<artifactId>jboss-as-maven-plugin</artifactId>
<executions>
<execution>
<phase>install</phase>
<goals>
<goal>deploy</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
if you are using Bean then include
<scannerClassNames>
<param>org.switchyard.transform.config.model.BeanSwitchYardScanner</param>
</scannerClassNames>
I have a wsdl, all tests are applied in soapUI.The Test was succesfull.
Meanwhile, I don't know how will I integrate our program.
When all project has been done in SoapUI, I used WSDL2JAVA axis2.
It put a lot of class for me in the folder.
How will I combine?
I need a only simple client.
any simple method to do it?
I have also timestamp,username,keystore and a truststore.
Can AXIS2 put in classes for me ?
It sounds like you need something like Maven to build and package your web service client. The following Maven POM is a skeleton that has goals to generate your client classes from a WSDL and package the whole project as a JAR.
<?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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>webservice-client</artifactId>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.10</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.sun.xml.ws</groupId>
<artifactId>jaxws-rt</artifactId>
<version>2.1.4</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<id>make-a-jar</id>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<encoding>UTF-8</encoding>
<showWarnings>true</showWarnings>
<showDeprecation>true</showDeprecation>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
<version>1.10</version>
<executions>
<execution>
<id>generate-sources</id>
<phase>generate-sources</phase>
<configuration>
<wsdlFiles>
<wsdlFile>myService.wsdl</wsdlFile>
</wsdlFiles>
</configuration>
<goals>
<goal>wsimport</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
While running the executing the maven main class using below command:
mvn exec:java -Dexec.mainClass="com.xoxo.amqtest.SubscriberDriver"
I assumed that all the jars must be picked up from the maven repo. But instead it throws below exception.
java.lang.NoClassDefFoundError: com/xoxo/infra/protectedpkg/ProtectedPackageLoadException
This maven project runs fine in eclipse. Is there any way to specify maven to pick all the dependencies from maven repo instead of adding all the dependencies like below
java -cp ./:./target/amq-subscriber-1.0.0-SNAPSHOT-jar-with-dependencies.jar:/x/home/stvu/.m2/repository/com/xoxo/submodule/infra-jsse-2.0.1.jar com.xoxo.amqtest.SubscriberDriver
Edit:
<?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>com.xoxox.infra</groupId>
<artifactId>infra-parent</artifactId>
<version>13.2.3</version>
<relativePath />
</parent>
<groupId>com.xoxox.amqtest</groupId>
<artifactId>amqsubscriber</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>amq_sub_test</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>com.xoxox.infra</groupId>
<artifactId>infra</artifactId>
</dependency>
<dependency>
<groupId>com.xoxox.kernel</groupId>
<artifactId>KernelDAL</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>javax.jms</groupId>
<artifactId>jms</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.14</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.5.11</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.7</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit-addons</groupId>
<artifactId>junit-addons</artifactId>
<version>1.4</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<testFailureIgnore>true</testFailureIgnore>
</configuration>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.3</version>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
<executions>
<execution>
<id>make-assembly</id> <!-- this is used for inheritance merges -->
<phase>package</phase> <!-- bind to the packaging phase -->
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>
com.xoxox.infra.maven.plugins
</groupId>
<artifactId>
infra-codegenerator-maven-plugin
</artifactId>
<versionRange>
[13.3.0,)
</versionRange>
<goals>
<goal>generate-code</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore></ignore>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
I've done this in the past using exec-maven-plugin:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
<id>execute-your-main</id>
<phase>process-classes</phase>
<goals>
<goal>java</goal>
</goals>
<configuration>
<mainClass>com.xoxo.amqtest.SubscriberDriver</mainClass>
<arguments>
<argument>ADD_YOUR_ARGUMENTS_IF_NEEDED</argument>
</arguments>
</configuration>
</execution>
</plugin>
take look at appassembler plugin.
http://mojo.codehaus.org/appassembler/appassembler-maven-plugin/
Configuration will look like
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>appassembler-maven-plugin</artifactId>
<version>1.6</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>assemble</goal>
</goals>
</execution>
</executions>
<configuration>
<programs>
<program>
<mainClass>fun.Tester</mainClass>
<id>app</id>
</program>
</programs>
</configuration>
</plugin>
it will create directory name 'appassembler' in you target directory which will have all dependent jars and executable according to platform in 'bin' directory