Java 将后端projet获取到我的前端时出现NoClassDefFoundError

Java 将后端projet获取到我的前端时出现NoClassDefFoundError,java,maven,Java,Maven,我在pom.xml中有一个后端项目: <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&g

我在pom.xml中有一个后端项目:

<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>GestionScolaire</groupId>
  <artifactId>GestionScolaire</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>war</packaging>
  <build>
    <sourceDirectory>src/java</sourceDirectory>
...
启动服务器时出现以下错误:

org.springframework.beans.factory.BeanCreationException:创建名为“org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping”的bean时出错:调用init方法失败;嵌套异常为java.lang.NoClassDefFoundError:Matiere

你们知道我为什么会犯这个错误吗


谢谢

至少部分问题在于:

<dependency>
    <groupId>GestionScolaire</groupId>
    <artifactId>GestionScolaire</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <type>war</type>
</dependency>
使用以下配置:

          <plugin>
            <artifactId>maven-war-plugin</artifactId>
            <version>3.1.0</version>
            <configuration>
              <archiveClasses>true</archiveClasses>
            </configuration>
          </plugin>

If you need to re-use this JAR in another project, the recommended approach is to move the classes to a separate module that builds a
    <project>
      ...
      <artifactId>mywebapp</artifactId>
      <version>1.0-SNAPSHOT</version>
      ...
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-war-plugin</artifactId>
            <version>3.1.0</version>
            <configuration>
              <attachClasses>true</attachClasses>
            </configuration>
          </plugin>
        </plugins>
      </build>
      ...
    </project>

This will result in two artifacts being deployed: mywebapp-1.0-SNAPSHOT.war and mywebapp-1.0-SNAPSHOT-classes.jar.
工件,带有分类器,使用以下配置:

          <plugin>
            <artifactId>maven-war-plugin</artifactId>
            <version>3.1.0</version>
            <configuration>
              <archiveClasses>true</archiveClasses>
            </configuration>
          </plugin>

If you need to re-use this JAR in another project, the recommended approach is to move the classes to a separate module that builds a
    <project>
      ...
      <artifactId>mywebapp</artifactId>
      <version>1.0-SNAPSHOT</version>
      ...
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-war-plugin</artifactId>
            <version>3.1.0</version>
            <configuration>
              <attachClasses>true</attachClasses>
            </configuration>
          </plugin>
        </plugins>
      </build>
      ...
    </project>

This will result in two artifacts being deployed: mywebapp-1.0-SNAPSHOT.war and mywebapp-1.0-SNAPSHOT-classes.jar.

...
mywebapp
1.0-快照
...
maven战争插件
3.1.0
真的
...
这将导致部署两个工件:mywebapp-1.0-SNAPSHOT.war和mywebapp-1.0-SNAPSHOT-classes.jar。
我的同事创建了2个“web项目”。所以类在WEB-INF文件夹中。。。。谢谢你们
If you can't move the classes to another project, you can deploy the classes and resources included in your webapp as an "attached"
    <project>
      ...
      <artifactId>mywebapp</artifactId>
      <version>1.0-SNAPSHOT</version>
      ...
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-war-plugin</artifactId>
            <version>3.1.0</version>
            <configuration>
              <attachClasses>true</attachClasses>
            </configuration>
          </plugin>
        </plugins>
      </build>
      ...
    </project>

This will result in two artifacts being deployed: mywebapp-1.0-SNAPSHOT.war and mywebapp-1.0-SNAPSHOT-classes.jar.