在我更改了我的maven项目的groupid之后,我获得了所有课程的ClassNotFoundException
。
Class not found com.some.package.Test_SomeClass
java.lang.ClassNotFoundException: com.some.package.Test_SomeClass
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.loadClass(RemoteTestRunner.java:771)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.loadClasses(RemoteTestRunner.java:500)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:523)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:761)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:461)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:207)
这是我第一次遇到这样的事情。奇怪的是,eclipse仍然可以识别所有类,即不会在代码中显示编译错误。 maven更新仍然有效。
修改
我执行mvn clean install
编辑2
这是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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.company.group</groupId>
<!-- the maven project was created with a different groupid (com.company.anothergroup) -->
<artifactId>project</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>aproject</name>
<url>http://maven.apache.org</url>
<properties>
<!-- ...properties... -->
</properties>
<dependencies>
<!-- ...dependencies... -->
</dependencies>
<distributionManagement>
<repository>
<id>nexus-release</id>
<url>https://company.com/nexus/</url>
</repository>
<snapshotRepository>
<id>nexus-snapshots</id>
<url>https://company.com/nexus/</url>
</snapshotRepository>
</distributionManagement>
<scm>
<url>company github url</url>
<connection>connection details</connection>
<developerConnection>connection detils</developerConnection>
</scm>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.2</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
感谢您的帮助