Java Jersey - ClassNotFoundException

时间:2015-02-11 14:53:05

标签: java maven jersey jersey-2.0

我按照教程here创建了一个简单服务的restful项目。我跑mvn test clean时没关系。但是当我运行mvn exec:java -X时,编译器总是抱怨ClassNotFoundException。我不明白。我从教程中直接看了。

我还确保com.example.Main确实存在。

顺便说一句,这是我的java和maven设置以及错误日志:

yy-MacBook-Pro:simple-service yy$ mvn -version
    Apache Maven 3.2.5 (12a6b3acb947671f09b81f49094c53f426d8cea1; 2014-12-15T01:29:23+08:00)
    Maven home: /Applications/apache-maven-3.2.5
    Java version: 1.8.0_31, vendor: Oracle Corporation
    Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_31.jdk/Contents/Home/jre
    Default locale: en_US, platform encoding: UTF-8
    OS name: "mac os x", version: "10.10.2", arch: "x86_64", family: "mac"

yy-MacBook-Pro:simple-service yy$ java -version
java version "1.8.0_31"
Java(TM) SE Runtime Environment (build 1.8.0_31-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.31-b07, mixed mode)
yy-MacBook-Pro:simple-service christopher$ java -version


yy-MacBook-Pro:simple-service yy$ mvn exec:java -X
Apache Maven 3.2.5 (12a6b3acb947671f09b81f49094c53f426d8cea1; 2014-12-15T01:29:23+08:00)
Maven home: /Applications/apache-maven-3.2.5
Java version: 1.8.0_31, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_31.jdk/Contents/Home/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.10.2", arch: "x86_64", family: "mac"
[INFO] Error stacktraces are turned on.
[DEBUG] Reading global settings from /Applications/apache-maven-3.2.5/conf/settings.xml
[DEBUG] Reading user settings from /Users/yy/.m2/settings.xml
[DEBUG] Using local repository at /Users/yy/.m2/repository
[DEBUG] Using manager EnhancedLocalRepositoryManager with priority 10.0 for /Users/yy/.m2/repository
[INFO] Scanning for projects...
[DEBUG] Extension realms for project com.example:simple-service:jar:1.0-SNAPSHOT: (none)
[DEBUG] Looking up lifecyle mappings for packaging jar from ClassRealm[plexus.core, parent: null]
[DEBUG] Resolving plugin prefix exec from [org.apache.maven.plugins, org.codehaus.mojo]
[DEBUG] Resolved plugin prefix exec to org.codehaus.mojo:exec-maven-plugin from POM com.example:simple-service:jar:1.0-SNAPSHOT
[DEBUG] === REACTOR BUILD PLAN ================================================
[DEBUG] Project: com.example:simple-service:jar:1.0-SNAPSHOT
[DEBUG] Tasks:   [exec:java]
[DEBUG] Style:   Regular
[DEBUG] =======================================================================
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building simple-service 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[DEBUG] Resolving plugin prefix exec from [org.apache.maven.plugins, org.codehaus.mojo]
[DEBUG] Resolved plugin prefix exec to org.codehaus.mojo:exec-maven-plugin from POM com.example:simple-service:jar:1.0-SNAPSHOT
[DEBUG] Lifecycle default -> [validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy]
[DEBUG] Lifecycle clean -> [pre-clean, clean, post-clean]
[DEBUG] Lifecycle site -> [pre-site, site, post-site, site-deploy]
[DEBUG] Lifecycle default -> [validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy]
[DEBUG] Lifecycle clean -> [pre-clean, clean, post-clean]
[DEBUG] Lifecycle site -> [pre-site, site, post-site, site-deploy]
[DEBUG] === PROJECT BUILD PLAN ================================================
[DEBUG] Project:       com.example:simple-service:1.0-SNAPSHOT
[DEBUG] Dependencies (collect): []
[DEBUG] Dependencies (resolve): [test]
[DEBUG] Repositories (dependencies): [central (https://repo.maven.apache.org/maven2, default, releases)]
[DEBUG] Repositories (plugins)     : [central (https://repo.maven.apache.org/maven2, default, releases)]
[DEBUG] --- init fork of com.example:simple-service:1.0-SNAPSHOT for org.codehaus.mojo:exec-maven-plugin:1.2.1:java (default-cli) ---
[DEBUG] Dependencies (collect): []
[DEBUG] Dependencies (resolve): []
[DEBUG] --- exit fork of com.example:simple-service:1.0-SNAPSHOT for org.codehaus.mojo:exec-maven-plugin:1.2.1:java (default-cli) ---
[DEBUG] -----------------------------------------------------------------------
[DEBUG] Goal:          org.codehaus.mojo:exec-maven-plugin:1.2.1:java (default-cli)
[DEBUG] Style:         Regular
[DEBUG] Configuration: <?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <arguments>${exec.arguments}</arguments>
  <classpathScope default-value="runtime">${exec.classpathScope}</classpathScope>
  <cleanupDaemonThreads>${exec.cleanupDaemonThreads} default-value=</cleanupDaemonThreads>
  <commandlineArgs>${exec.args}</commandlineArgs>
  <daemonThreadJoinTimeout default-value="15000">${exec.daemonThreadJoinTimeout}</daemonThreadJoinTimeout>
  <includePluginDependencies default-value="false">${exec.includePluginDependencies}</includePluginDependencies>
  <includeProjectDependencies default-value="true">${exec.includeProjectDependencies}</includeProjectDependencies>
  <keepAlive default-value="false">${exec.keepAlive}</keepAlive>
  <killAfter default-value="-1">${exec.killAfter}</killAfter>
  <localRepository default-value="${localRepository}"/>
  <mainClass>com.example.Main</mainClass>
  <pluginDependencies default-value="${plugin.artifacts}"/>
  <project default-value="${project}"/>
  <remoteRepositories default-value="${project.remoteArtifactRepositories}"/>
  <skip default-value="false">${skip}</skip>
  <sourceRoot>${sourceRoot}</sourceRoot>
  <stopUnresponsiveDaemonThreads>${exec.stopUnresponsiveDaemonThreads} default-value=</stopUnresponsiveDaemonThreads>
  <testSourceRoot>${testSourceRoot}</testSourceRoot>
</configuration>
[DEBUG] =======================================================================
[INFO] 
[INFO] >>> exec-maven-plugin:1.2.1:java (default-cli) > validate @ simple-service >>>
[INFO] 
[INFO] <<< exec-maven-plugin:1.2.1:java (default-cli) < validate @ simple-service <<<
[DEBUG] Dependency collection stats: {ConflictMarker.analyzeTime=1, ConflictMarker.markTime=0, ConflictMarker.nodeCount=42, ConflictIdSorter.graphTime=1, ConflictIdSorter.topsortTime=0, ConflictIdSorter.conflictIdCount=21, ConflictIdSorter.conflictIdCycleCount=0, ConflictResolver.totalTime=4, ConflictResolver.conflictItemCount=37, DefaultDependencyCollector.collectTime=118, DefaultDependencyCollector.transformTime=8}
[DEBUG] com.example:simple-service:jar:1.0-SNAPSHOT
[DEBUG]    org.glassfish.jersey.containers:jersey-container-grizzly2-http:jar:2.15:compile
[DEBUG]       org.glassfish.hk2.external:javax.inject:jar:2.4.0-b06:compile
[DEBUG]       org.glassfish.grizzly:grizzly-http-server:jar:2.3.16:compile
[DEBUG]          org.glassfish.grizzly:grizzly-http:jar:2.3.16:compile
[DEBUG]             org.glassfish.grizzly:grizzly-framework:jar:2.3.16:compile
[DEBUG]       org.glassfish.jersey.core:jersey-common:jar:2.15:compile
[DEBUG]          javax.annotation:javax.annotation-api:jar:1.2:compile
[DEBUG]          org.glassfish.jersey.bundles.repackaged:jersey-guava:jar:2.15:compile
[DEBUG]          org.glassfish.hk2:hk2-api:jar:2.4.0-b06:compile
[DEBUG]             org.glassfish.hk2:hk2-utils:jar:2.4.0-b06:compile
[DEBUG]             org.glassfish.hk2.external:aopalliance-repackaged:jar:2.4.0-b06:compile
[DEBUG]          org.glassfish.hk2:hk2-locator:jar:2.4.0-b06:compile
[DEBUG]             org.javassist:javassist:jar:3.18.1-GA:compile
[DEBUG]          org.glassfish.hk2:osgi-resource-locator:jar:1.0.1:compile
[DEBUG]       org.glassfish.jersey.core:jersey-server:jar:2.15:compile
[DEBUG]          org.glassfish.jersey.core:jersey-client:jar:2.15:compile
[DEBUG]          javax.validation:validation-api:jar:1.1.0.Final:compile
[DEBUG]       javax.ws.rs:javax.ws.rs-api:jar:2.0.1:compile
[DEBUG]    junit:junit:jar:4.9:test
[DEBUG]       org.hamcrest:hamcrest-core:jar:1.1:test
[INFO] 
[INFO] --- exec-maven-plugin:1.2.1:java (default-cli) @ simple-service ---
[DEBUG] Created new class realm maven.api
[DEBUG] Importing foreign packages into class realm maven.api
[DEBUG]   Imported: org.apache.maven.cli < plexus.core
[DEBUG]   Imported: org.eclipse.aether.internal.impl < plexus.core
[DEBUG]   Imported: org.codehaus.plexus.lifecycle < plexus.core
[DEBUG]   Imported: org.apache.maven.lifecycle < plexus.core
[DEBUG]   Imported: org.apache.maven.repository < plexus.core
[DEBUG]   Imported: org.codehaus.plexus.personality < plexus.core
[DEBUG]   Imported: org.apache.maven.usability < plexus.core
[DEBUG]   Imported: org.codehaus.plexus.configuration < plexus.core
[DEBUG]   Imported: javax.enterprise.inject.* < plexus.core
[DEBUG]   Imported: org.apache.maven.* < plexus.core
[DEBUG]   Imported: org.apache.maven.project < plexus.core
[DEBUG]   Imported: org.apache.maven.exception < plexus.core
[DEBUG]   Imported: org.eclipse.aether.spi < plexus.core
[DEBUG]   Imported: org.apache.maven.plugin < plexus.core
[DEBUG]   Imported: org.eclipse.aether.collection < plexus.core
[DEBUG]   Imported: org.codehaus.plexus.* < plexus.core
[DEBUG]   Imported: org.codehaus.plexus.logging < plexus.core
[DEBUG]   Imported: org.apache.maven.profiles < plexus.core
[DEBUG]   Imported: org.eclipse.aether.transfer < plexus.core
[DEBUG]   Imported: org.codehaus.plexus.util.xml.pull.XmlPullParserException < plexus.core
[DEBUG]   Imported: org.apache.maven.execution.scope < plexus.core
[DEBUG]   Imported: org.apache.maven.wagon.* < plexus.core
[DEBUG]   Imported: org.apache.maven.rtinfo < plexus.core
[DEBUG]   Imported: org.eclipse.aether.impl < plexus.core
[DEBUG]   Imported: org.apache.maven.monitor < plexus.core
[DEBUG]   Imported: org.eclipse.aether.graph < plexus.core
[DEBUG]   Imported: org.eclipse.aether.metadata < plexus.core
[DEBUG]   Imported: org.codehaus.plexus.context < plexus.core
[DEBUG]   Imported: org.apache.maven.wagon.observers < plexus.core
[DEBUG]   Imported: org.apache.maven.wagon.resource < plexus.core
[DEBUG]   Imported: javax.inject.* < plexus.core
[DEBUG]   Imported: org.apache.maven.model < plexus.core
[DEBUG]   Imported: org.codehaus.plexus.util.xml.Xpp3Dom < plexus.core
[DEBUG]   Imported: org.eclipse.aether.deployment < plexus.core
[DEBUG]   Imported: org.apache.maven.artifact < plexus.core
[DEBUG]   Imported: org.apache.maven.toolchain < plexus.core
[DEBUG]   Imported: org.eclipse.aether.resolution < plexus.core
[DEBUG]   Imported: org.codehaus.plexus.util.xml.pull.XmlSerializer < plexus.core
[DEBUG]   Imported: org.apache.maven.settings < plexus.core
[DEBUG]   Imported: org.apache.maven.wagon.authorization < plexus.core
[DEBUG]   Imported: org.apache.maven.wagon.events < plexus.core
[DEBUG]   Imported: org.apache.maven.wagon.authentication < plexus.core
[DEBUG]   Imported: org.apache.maven.reporting < plexus.core
[DEBUG]   Imported: org.eclipse.aether.repository < plexus.core
[DEBUG]   Imported: org.slf4j.* < plexus.core
[DEBUG]   Imported: org.apache.maven.wagon.repository < plexus.core
[DEBUG]   Imported: javax.enterprise.util.* < plexus.core
[DEBUG]   Imported: org.apache.maven.configuration < plexus.core
[DEBUG]   Imported: org.codehaus.plexus.classworlds < plexus.core
[DEBUG]   Imported: org.codehaus.classworlds < plexus.core
[DEBUG]   Imported: org.codehaus.plexus.util.xml.pull.XmlPullParser < plexus.core
[DEBUG]   Imported: org.apache.maven.classrealm < plexus.core
[DEBUG]   Imported: org.eclipse.aether.* < plexus.core
[DEBUG]   Imported: org.eclipse.aether.artifact < plexus.core
[DEBUG]   Imported: org.apache.maven.execution < plexus.core
[DEBUG]   Imported: org.apache.maven.wagon.proxy < plexus.core
[DEBUG]   Imported: org.codehaus.plexus.container < plexus.core
[DEBUG]   Imported: org.eclipse.aether.version < plexus.core
[DEBUG]   Imported: org.eclipse.aether.installation < plexus.core
[DEBUG]   Imported: org.codehaus.plexus.component < plexus.core
[DEBUG] Populating class realm maven.api
[DEBUG] Dependency collection stats: {ConflictMarker.analyzeTime=0, ConflictMarker.markTime=0, ConflictMarker.nodeCount=68, ConflictIdSorter.graphTime=1, ConflictIdSorter.topsortTime=0, ConflictIdSorter.conflictIdCount=25, ConflictIdSorter.conflictIdCycleCount=0, ConflictResolver.totalTime=1, ConflictResolver.conflictItemCount=65, DefaultDependencyCollector.collectTime=66, DefaultDependencyCollector.transformTime=2}
[DEBUG] org.codehaus.mojo:exec-maven-plugin:jar:1.2.1:
[DEBUG]    org.apache.maven:maven-toolchain:jar:1.0:compile
[DEBUG]    org.apache.maven:maven-project:jar:2.0.6:compile
[DEBUG]       org.apache.maven:maven-settings:jar:2.0.6:compile
[DEBUG]       org.apache.maven:maven-profile:jar:2.0.6:compile
[DEBUG]       org.apache.maven:maven-plugin-registry:jar:2.0.6:compile
[DEBUG]    org.apache.maven:maven-model:jar:2.0.6:compile
[DEBUG]    org.apache.maven:maven-artifact:jar:2.0.6:compile
[DEBUG]    org.apache.maven:maven-artifact-manager:jar:2.0.6:compile
[DEBUG]       org.apache.maven:maven-repository-metadata:jar:2.0.6:compile
[DEBUG]    org.apache.maven:maven-core:jar:2.0.6:compile
[DEBUG]       org.apache.maven:maven-plugin-parameter-documenter:jar:2.0.6:compile
[DEBUG]       org.apache.maven.reporting:maven-reporting-api:jar:2.0.6:compile
[DEBUG]          org.apache.maven.doxia:doxia-sink-api:jar:1.0-alpha-7:compile
[DEBUG]       org.apache.maven:maven-error-diagnostics:jar:2.0.6:compile
[DEBUG]       commons-cli:commons-cli:jar:1.0:compile
[DEBUG]       org.apache.maven:maven-plugin-descriptor:jar:2.0.6:compile
[DEBUG]       org.codehaus.plexus:plexus-interactivity-api:jar:1.0-alpha-4:compile
[DEBUG]       org.apache.maven:maven-monitor:jar:2.0.6:compile
[DEBUG]       classworlds:classworlds:jar:1.1:compile
[DEBUG]    org.apache.maven:maven-plugin-api:jar:2.0.6:compile
[DEBUG]    org.codehaus.plexus:plexus-utils:jar:2.0.5:compile
[DEBUG]    org.codehaus.plexus:plexus-container-default:jar:1.0-alpha-9:compile
[DEBUG]       junit:junit:jar:3.8.2:test
[DEBUG]    org.apache.commons:commons-exec:jar:1.1:compile
[DEBUG] Created new class realm plugin>org.codehaus.mojo:exec-maven-plugin:1.2.1
[DEBUG] Importing foreign packages into class realm plugin>org.codehaus.mojo:exec-maven-plugin:1.2.1
[DEBUG]   Imported:  < maven.api
[DEBUG] Populating class realm plugin>org.codehaus.mojo:exec-maven-plugin:1.2.1
[DEBUG]   Included: org.codehaus.mojo:exec-maven-plugin:jar:1.2.1
[DEBUG]   Included: org.apache.maven.reporting:maven-reporting-api:jar:2.0.6
[DEBUG]   Included: org.apache.maven.doxia:doxia-sink-api:jar:1.0-alpha-7
[DEBUG]   Included: commons-cli:commons-cli:jar:1.0
[DEBUG]   Included: org.codehaus.plexus:plexus-interactivity-api:jar:1.0-alpha-4
[DEBUG]   Included: org.codehaus.plexus:plexus-utils:jar:2.0.5
[DEBUG]   Included: org.apache.commons:commons-exec:jar:1.1
[DEBUG]   Excluded: org.apache.maven:maven-toolchain:jar:1.0
[DEBUG]   Excluded: org.apache.maven:maven-project:jar:2.0.6
[DEBUG]   Excluded: org.apache.maven:maven-settings:jar:2.0.6
[DEBUG]   Excluded: org.apache.maven:maven-profile:jar:2.0.6
[DEBUG]   Excluded: org.apache.maven:maven-plugin-registry:jar:2.0.6
[DEBUG]   Excluded: org.apache.maven:maven-model:jar:2.0.6
[DEBUG]   Excluded: org.apache.maven:maven-artifact:jar:2.0.6
[DEBUG]   Excluded: org.apache.maven:maven-artifact-manager:jar:2.0.6
[DEBUG]   Excluded: org.apache.maven:maven-repository-metadata:jar:2.0.6
[DEBUG]   Excluded: org.apache.maven:maven-core:jar:2.0.6
[DEBUG]   Excluded: org.apache.maven:maven-plugin-parameter-documenter:jar:2.0.6
[DEBUG]   Excluded: org.apache.maven:maven-error-diagnostics:jar:2.0.6
[DEBUG]   Excluded: org.apache.maven:maven-plugin-descriptor:jar:2.0.6
[DEBUG]   Excluded: org.apache.maven:maven-monitor:jar:2.0.6
[DEBUG]   Excluded: classworlds:classworlds:jar:1.1
[DEBUG]   Excluded: org.apache.maven:maven-plugin-api:jar:2.0.6
[DEBUG]   Excluded: org.codehaus.plexus:plexus-container-default:jar:1.0-alpha-9
[DEBUG]   Excluded: junit:junit:jar:3.8.2
[DEBUG] Configuring mojo org.codehaus.mojo:exec-maven-plugin:1.2.1:java from plugin realm ClassRealm[plugin>org.codehaus.mojo:exec-maven-plugin:1.2.1, parent: sun.misc.Launcher$AppClassLoader@45ee12a7]
[DEBUG] Configuring mojo 'org.codehaus.mojo:exec-maven-plugin:1.2.1:java' with basic configurator -->
[DEBUG]   (f) arguments = []
[DEBUG]   (f) classpathScope = runtime
[DEBUG]   (f) cleanupDaemonThreads = false
[DEBUG]   (f) daemonThreadJoinTimeout = 15000
[DEBUG]   (f) includePluginDependencies = false
[DEBUG]   (f) includeProjectDependencies = true
[DEBUG]   (f) keepAlive = false
[DEBUG]   (f) killAfter = -1
[DEBUG]   (f) localRepository =       id: local
      url: file:///Users/yy/.m2/repository/
   layout: default
snapshots: [enabled => true, update => always]
 releases: [enabled => true, update => always]

[DEBUG]   (f) mainClass = com.example.Main
[DEBUG]   (f) pluginDependencies = [org.codehaus.mojo:exec-maven-plugin:maven-plugin:1.2.1:, org.apache.maven.reporting:maven-reporting-api:jar:2.0.6:compile, org.apache.maven.doxia:doxia-sink-api:jar:1.0-alpha-7:compile, commons-cli:commons-cli:jar:1.0:compile, org.codehaus.plexus:plexus-interactivity-api:jar:1.0-alpha-4:compile, org.codehaus.plexus:plexus-utils:jar:2.0.5:compile, org.apache.commons:commons-exec:jar:1.1:compile]
[DEBUG]   (f) project = MavenProject: com.example:simple-service:1.0-SNAPSHOT @ /Users/yy/Documents/workspace/javaWorkspace/simple-service/pom.xml
[DEBUG]   (f) remoteRepositories = [      id: central
      url: https://repo.maven.apache.org/maven2
   layout: default
snapshots: [enabled => false, update => daily]
 releases: [enabled => true, update => daily]
]
[DEBUG]   (f) skip = false
[DEBUG]   (f) stopUnresponsiveDaemonThreads = false
[DEBUG] -- end configuration --
[DEBUG] Invoking : com.example.Main.main()
[DEBUG] Plugin Dependencies will be excluded.
[DEBUG] Project Dependencies will be included.
[DEBUG] Collected project artifacts [org.glassfish.jersey.containers:jersey-container-grizzly2-http:jar:2.15:compile, org.glassfish.hk2.external:javax.inject:jar:2.4.0-b06:compile, org.glassfish.grizzly:grizzly-http-server:jar:2.3.16:compile, org.glassfish.grizzly:grizzly-http:jar:2.3.16:compile, org.glassfish.grizzly:grizzly-framework:jar:2.3.16:compile, org.glassfish.jersey.core:jersey-common:jar:2.15:compile, javax.annotation:javax.annotation-api:jar:1.2:compile, org.glassfish.jersey.bundles.repackaged:jersey-guava:jar:2.15:compile, org.glassfish.hk2:hk2-api:jar:2.4.0-b06:compile, org.glassfish.hk2:hk2-utils:jar:2.4.0-b06:compile, org.glassfish.hk2.external:aopalliance-repackaged:jar:2.4.0-b06:compile, org.glassfish.hk2:hk2-locator:jar:2.4.0-b06:compile, org.javassist:javassist:jar:3.18.1-GA:compile, org.glassfish.hk2:osgi-resource-locator:jar:1.0.1:compile, org.glassfish.jersey.core:jersey-server:jar:2.15:compile, org.glassfish.jersey.core:jersey-client:jar:2.15:compile, javax.validation:validation-api:jar:1.1.0.Final:compile, javax.ws.rs:javax.ws.rs-api:jar:2.0.1:compile]
[DEBUG] Collected project classpath [/Users/yy/Documents/workspace/javaWorkspace/simple-service/target/classes]
[DEBUG] Adding to classpath : file:/Users/yy/Documents/workspace/javaWorkspace/simple-service/target/classes
[DEBUG] Adding project dependency artifact: jersey-container-grizzly2-http to classpath
[DEBUG] Adding project dependency artifact: javax.inject to classpath
[DEBUG] Adding project dependency artifact: grizzly-http-server to classpath
[DEBUG] Adding project dependency artifact: grizzly-http to classpath
[DEBUG] Adding project dependency artifact: grizzly-framework to classpath
[DEBUG] Adding project dependency artifact: jersey-common to classpath
[DEBUG] Adding project dependency artifact: javax.annotation-api to classpath
[DEBUG] Adding project dependency artifact: jersey-guava to classpath
[DEBUG] Adding project dependency artifact: hk2-api to classpath
[DEBUG] Adding project dependency artifact: hk2-utils to classpath
[DEBUG] Adding project dependency artifact: aopalliance-repackaged to classpath
[DEBUG] Adding project dependency artifact: hk2-locator to classpath
[DEBUG] Adding project dependency artifact: javassist to classpath
[DEBUG] Adding project dependency artifact: osgi-resource-locator to classpath
[DEBUG] Adding project dependency artifact: jersey-server to classpath
[DEBUG] Adding project dependency artifact: jersey-client to classpath
[DEBUG] Adding project dependency artifact: validation-api to classpath
[DEBUG] Adding project dependency artifact: javax.ws.rs-api to classpath
[DEBUG] joining on thread Thread[com.example.Main.main(),5,com.example.Main]
[WARNING] 
java.lang.ClassNotFoundException: com.example.Main
    at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:285)
    at java.lang.Thread.run(Thread.java:745)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.481 s
[INFO] Finished at: 2015-02-11T22:47:06+08:00
[INFO] Final Memory: 9M/245M
[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:216)
    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:116)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:120)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:355)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:216)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:160)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
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:132)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
    ... 19 more
Caused by: java.lang.ClassNotFoundException: com.example.Main
    at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:285)
    at java.lang.Thread.run(Thread.java:745)
[ERROR] 
[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

0 个答案:

没有答案