gpt4 book ai didi

java - 无法使用 Maven 运行 Java

转载 作者:行者123 更新时间:2023-12-01 12:11:59 27 4
gpt4 key购买 nike

我一直在尝试使用 mvn exec:execmvn exec:java 使应用程序与 maven 一起运行,但不断收到此错误:

java.lang.ClassNotFoundException: com.inpun.alt.gaecl.AppEngineShell
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)

POM:

<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>com.inpun</groupId>
<artifactId>gael</artifactId>
<packaging>jar</packaging>
<version>1.0</version>
<name>GAE Command Line</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.6</maven.compiler.source>
<maven.compiler.target>1.6</maven.compiler.target>
<gae.version>1.8.8</gae.version>
</properties>
<dependencies>
<dependency>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-api-labs</artifactId>
<version>${gae.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-api-stubs</artifactId>
<version>${gae.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-testing</artifactId>
<version>${gae.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
<phase>install</phase>
<goals>
<goal>java</goal>
</goals>
<configuration>
<mainClass>com.inpun.alt.gaecl.AppEngineShell</mainClass>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

此代码可能存在什么问题导致 ClassNotFoundException

最佳答案

尝试运行mvn package exec:java

关于java - 无法使用 Maven 运行 Java,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27215603/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com