当我在Maven项目中添加对域层的任何调用时,我的Web层不起作用

时间:2013-02-27 03:51:39

标签: maven

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

1) domain_layer(All entities)
2) data_layer(All service and repositories)
3) web_layer(All controllers).

即使我使用命令:

mvn clean install eclipse:clean eclipse:eclipse
mvn clean package eclipse:clean eclipse:eclipse
也无效。

但是当我删除新课程时,它再次起作用。

任何人都知道这个问题吗?

这是我在网络层中的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>

任何帮助都会感激不尽,谢谢。

1 个答案:

答案 0 :(得分:0)

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