You are executing "mvn clean exec:java".

This tells Maven, "first clean my project (delete the compiled code),
then call exec:java to run my code."

Hopefully you can see why things are not working as you might expect.

Hint: you might want to try "mvn clean compile exec:java" to recreate
the code as a second step which you just deleted in the first step.

Wayne

On Mon, Jun 17, 2013 at 10:36 PM, kingsley osime
<geekinthel...@gmail.com> wrote:
> Hello,
>
> I get the following error when trying to run simple-service app. my pom is
> below error stack
>
> - thanks
>
> **********************************************************************************
>
> ERROR STACK
> penjdk@codeboxIII:~/simple-service$ mvn -e clean exec:java
> [INFO] Error stacktraces are turned on.
> [INFO] Scanning for projects...
> [INFO]
> [INFO]
> ------------------------------------------------------------------------
> [INFO] Building simple-service 1.0-SNAPSHOT
> [INFO]
> ------------------------------------------------------------------------
> [INFO]
> [INFO] --- maven-clean-plugin:2.3:clean (default-clean) @ simple-service ---
> [INFO]
> [INFO] >>> exec-maven-plugin:1.2.1:java (default-cli) @ simple-service >>>
> [INFO]
> [INFO] <<< exec-maven-plugin:1.2.1:java (default-cli) @ simple-service <<<
> [INFO]
>
> [INFO] --- exec-maven-plugin:1.2.1:java (default-cli) @ simple-service ---
> [WARNING]
> java.lang.ClassNotFoundException: com.example.Main
>         at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
>         at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
>         at java.security.AccessController.doPrivileged(Native Method)
>         at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
>         at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
>         at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
>         at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:285)
>         at java.lang.Thread.run(Thread.java:722)
> [INFO]
> ------------------------------------------------------------------------
> [INFO] BUILD FAILURE
> [INFO]
> ------------------------------------------------------------------------
> [INFO] Total time: 5.572s
> [INFO] Finished at: Tue Jun 18 04:22:10 BST 2013
> [INFO] Final Memory: 7M/59M
> [INFO]
> ------------------------------------------------------------------------
> [ERROR] Failed to execute goal
> org.codehaus.mojo:exec-maven-plugin:1.2.1:java (default-cli) on project
> simple-service: An exception occured while executing the Java class.
> com.example.Main -> [Help 1]
> org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute
> goal org.codehaus.mojo:exec-maven-plugin:1.2.1:java (default-cli) on project
> simple-service: An exception occured while executing the Java class.
> com.example.Main
>         at
> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217)
>         at
> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
>         at
> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
>         at
> org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
>         at
> org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
>         at
> org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
>         at
> org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
>         at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
>         at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
>         at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
>         at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
>         at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>         at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>         at java.lang.reflect.Method.invoke(Method.java:601)
>         at
> org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
>         at
> org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
>         at
> org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
>         at
> org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
> Caused by: org.apache.maven.plugin.MojoExecutionException: An exception
> occured while executing the Java class. com.example.Main
>         at
> org.codehaus.mojo.exec.ExecJavaMojo.execute(ExecJavaMojo.java:352)
>         at
> org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
>         at
> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
>         ... 19 more
> Caused by: java.lang.ClassNotFoundException: com.example.Main
>         at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
>         at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
>         at java.security.AccessController.doPrivileged(Native Method)
>         at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
>         at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
>         at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
>         at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:285)
>         at java.lang.Thread.run(Thread.java:722)
> [ERROR]
> [ERROR] Re-run Maven using the -X switch to enable full debug logging.
> [ERROR]
> [ERROR] For more information about the errors and possible solutions, please
> read the following articles:
> [ERROR] [Help 1]
> http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
>
>
> **************************************************************************
>
> POM.XML
>
>
> <project 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>com.example</groupId><artifactId>simple-service</artifactId><packaging>jar</packaging><version>1.0-SNAPSHOT</version><name>simple-service</name><dependencyManagement><dependencies><dependency><groupId>org.glassfish.jersey</groupId><artifactId>jersey-bom</artifactId><version>${jersey.version}</version><type>pom</type><scope>import</scope></dependency></dependencies></dependencyManagement><dependencies><dependency><groupId>org.glassfish.jersey.containers</groupId><artifactId>jersey-container-grizzly2-http</artifactId></dependency><!--
> uncomment this to get JSON support:
>          <dependency>
>             <groupId>org.glassfish.jersey.media</groupId>
>             <artifactId>jersey-media-moxy</artifactId>
>         </dependency>
>
> --><dependency><groupId>junit</groupId><artifactId>junit</artifactId><version>4.9</version><scope>test</scope></dependency><dependency><groupId>org.glassfish.jersey.core</groupId><artifactId>jersey-client</artifactId><scope>test</scope></dependency></dependencies><build><plugins><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-compiler-plugin</artifactId><version>2.5.1</version><inherited>true</inherited><configuration><source>1.6</source><target>1.6</target></configuration></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>com.example.Main</mainClass></configuration></plugin></plugins></build><properties><jersey.version>2.0</jersey.version><project.build.sourceEncoding>UTF-8</project.build.sourceEncoding></properties></project>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to