0

我有一个 maven 项目作为一个宁静的设计,我分离了每一层:我有一个域层、数据层和一个 web 层。我的问题是:每当我向域层添加域类(实体)时,我的 web 层都不起作用,我得到一个 404 异常,仅此而已。我有三个项目。

1) domain_layer(所有实体)
2)data_layer(所有服务和存储库)
3)web_layer(所有控制器)。

即使我使用命令:

mvn clean install eclipse:clean eclipse:eclipse
mvn clean package eclipse:clean eclipse:eclipse
没有帮助。

但是当我删除新类时,它又可以工作了。

任何机构怎么知道这个问题?

这是我在 web 层的 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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>....weblayer</groupId>
<artifactId>weblayer</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<name>SpringMVC Maven Webapp</name>
<url>http://maven.apache.org</url>

<!-- Shared version number properties -->
<properties>
    <spring.version>3.0.6.RELEASE</spring.version>
    <org.springframework.version>3.1.2.RELEASE</org.springframework.version>
    <org.aspectj-version>1.6.9</org.aspectj-version>
</properties>

<dependencies>

<!--          all other dependencies-- >


    <!-- dependencies for domain and data-layer -->

    <dependency>
        <groupId>domainlayer</groupId>
        <artifactId>domain</artifactId>
        <version>1.0</version>
    </dependency>
    <dependency>
        <groupId>datalayer</groupId>
        <artifactId>datalayer</artifactId>
        <version>1.0</version>
    </dependency>


<repositories> 
    <!-- For main Spring releases -->
    <repository>
        <id>org.springframework.maven.release</id>
        <name>Spring Maven Release Repository</name>
        <url>http://maven.springframework.org/release</url>
        <releases>
            <enabled>true</enabled>
        </releases>
        <snapshots>
            <enabled>false</enabled>
        </snapshots>
    </repository>

    <!-- For testing against latest Spring snapshots -->
    <repository>
        <id>org.springframework.maven.snapshot</id>
        <name>Spring Maven Snapshot Repository</name>
        <url>http://maven.springframework.org/snapshot</url>
        <releases>
            <enabled>false</enabled>
        </releases>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
    </repository>

    <!-- For developing against latest Spring milestones -->
    <repository>
        <id>org.springframework.maven.milestone</id>
        <name>Spring Maven Milestone Repository</name>
        <url>http://maven.springframework.org/milestone</url>
        <snapshots>
            <enabled>false</enabled>
        </snapshots>
    </repository>
</repositories>

<build>
    <finalName>weblayer</finalName>
    <plugins>
        <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>2.4</version>
            <configuration>
                <source>1.7</source>
                <target>1.7</target>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-eclipse-plugin</artifactId>
            <version>2.8</version>
            <configuration>
                <wtpmanifest>true</wtpmanifest>
                <wtpversion>2.0</wtpversion>
                <useProjectReferences>false</useProjectReferences>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
            <executions>
                <execution>
                    <id>install</id>
                    <phase>install</phase>
                    <goals>
                        <goal>sources</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

任何帮助将不胜感激,谢谢。

4

1 回答 1

0

解决了。实体类中缺少@Id 每个实体类都必须有一个@Id 注释。

于 2013-02-27T20:45:51.480 回答