使用此命令运行项目时出现以下错误:mvn -e camel:run
[错误]无法执行目标 org.apache.camel:camel-maven-plugin:2.10.4:run(default-cli)on project bullshit:nul l:MojoExecutionException: org.apache.camel.spring.Main - > [帮助1] org.apache.maven.lifecycle.LifecycleExecutionException:失败 执行目标org.apache.camel:camel-maven-plugin:2.10。 4:运行 项目废话中的(default-cli):null at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:216) 在 org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) 在 org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) 在 org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116) 在 org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80) 在 org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder。 java:51)at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:120) 在org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:347)at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:154)at org.apache.maven.cli.MavenCli.execute(MavenCli.java:582)at at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:214)at at org.apache.maven.cli.MavenCli.main(MavenCli.java:158)at at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) 在 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 在java.lang.reflect.Method.invoke(Method.java:606)at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289) 在 org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229) 在 org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415) 在 org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356) 引起:org.apache.maven.plugin.MojoExecutionException at org.apache.camel.maven.RunMojo.execute(RunMojo.java:482)at at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:132) 在 org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208) ... 19更多引起:java.lang.ClassNotFoundException: org.apache.camel.spring.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:425)at java.lang.ClassLoader.loadClass(ClassLoader.java:358)at org.apache.camel.maven.RunMojo $ 1.run(RunMojo.java:434)at java.lang.Thread.run(Thread.java:745)
这是我在pom.xml文件中依赖的内容:
<properties>
<camel.version>2.10.4</camel.version>
</properties>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-core</artifactId>
<version>${camel.version}</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-core-osgi</artifactId>
<version>${camel.version}</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-spring</artifactId>
<version>${camel.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-quartz</artifactId>
<version>${camel.version}</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-mina</artifactId>
<version>${camel.version}</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-spring-integration</artifactId>
<version>${camel.version}</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-test</artifactId>
<version>${camel.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-test-spring</artifactId>
<version>${camel.version}</version>
<scope>test</scope>
</dependency>
任何帮助将不胜感激,谢谢。如果人们可以帮助而不是投票,我将不胜感激。如果您知道答案,那么请帮忙。
删除范围后出错。
我删除了范围。我收到此错误:运行main时发生错误:
org.apache.camel.spring.Main java.lang.ClassNotFoundException: org.apache.camel.spring.Main 在java.net.URLClassLoader $ 1.run(URLClassLoader.java:366) 在java.net.URLClassLoader $ 1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) 在java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:425) at java.lang.ClassLoader.loadClass(ClassLoader.java:358) 在org.apache.camel.maven.RunMojo $ 1.run(RunMojo.java:434) 在java.lang.Thread.run(Thread.java:745)
答案 0 :(得分:1)
它是一个类路径问题,找不到此类org.apache.camel.spring.Main
,它来自camel-spring
依赖项。所以你应该删除编译范围,例如只需使用
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-spring</artifactId>
<version>${camel.version}</version>
</dependency>