Running java main program using maven -


while running executing maven main class using below command:

mvn exec:java -dexec.mainclass="com.xoxo.amqtest.subscriberdriver" 

i assumed jars must picked maven repo. instead throws below exception.

java.lang.noclassdeffounderror: com/xoxo/infra/protectedpkg/protectedpackageloadexception 

this maven project runs fine in eclipse. there way specify maven pick dependencies maven repo instead of adding dependencies 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> <!-- used inheritance merges -->                         <phase>package</phase> <!-- bind 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 used store eclipse m2e settings only. has no influence on 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 in 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> 

Comments

Popular posts from this blog

c# - How to get the current UAC mode -

postgresql - Lazarus + Postgres: incomplete startup packet -

javascript - Ajax jqXHR.status==0 fix error -