Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/378.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 如何在jetty上运行多模块maven项目?_Java_Spring_Maven_Jetty - Fatal编程技术网

Java 如何在jetty上运行多模块maven项目?

Java 如何在jetty上运行多模块maven项目?,java,spring,maven,jetty,Java,Spring,Maven,Jetty,我试图用两个模块创建一个多模块maven项目:“listUsersRest”(使用SpringRest)和“listUsersDomain”(使用SpringDataJPA)。REST模块依赖于域,这在pom中得到了澄清。我的目标是构建父项目并使用“jetty:run”运行它。项目是在没有任何错误和警告的情况下生成的。但是在构建之后,localhost:8080/listusers上没有响应 以下是父pom: <modelVersion>4.0.0</modelVersion&

我试图用两个模块创建一个多模块maven项目:“listUsersRest”(使用SpringRest)和“listUsersDomain”(使用SpringDataJPA)。REST模块依赖于域,这在pom中得到了澄清。我的目标是构建父项目并使用“jetty:run”运行它。项目是在没有任何错误和警告的情况下生成的。但是在构建之后,localhost:8080/listusers上没有响应

以下是父pom:

<modelVersion>4.0.0</modelVersion>
<groupId>com.vis</groupId>
<artifactId>listUsersParent</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>

<build>
    <finalName>dpr-data</finalName>
    <pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.eclipse.jetty</groupId>
                <artifactId>jetty-maven-plugin</artifactId>
                <version>9.3.0.M1</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
        </plugins>
    </pluginManagement>
</build>
<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<modules>
    <module>listUsersDomain</module>
    <module>listUsersRest</module>
</modules>
4.0.0
com.vis
listUsersParent
0.0.1-快照
聚甲醛
dpr数据
org.eclipse.jetty
jetty maven插件
9.3.0.M1
1.8
1.8
UTF-8
listUsersDomain
listUsersRest

以下是REST pom:

<parent>
        <groupId>com.vis</groupId>
        <artifactId>listUsersParent</artifactId>
        <version>0.0.1-SNAPSHOT</version>
    </parent>
    <artifactId>listUsersRest</artifactId>
    <packaging>jar</packaging>
    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.eclipse.jetty</groupId>
                    <artifactId>jetty-maven-plugin</artifactId>
                    <version>9.3.0.M1</version>
                </plugin>
            </plugins>
        </pluginManagement>

    </build>
    <dependencies>
        <dependency>
            <groupId>com.vis</groupId>
            <artifactId>listUsersDomain</artifactId>
            <version>0.0.1-SNAPSHOT</version>
        </dependency>
        ...

com.vis
listUsersParent
0.0.1-快照
listUsersRest
罐子
org.eclipse.jetty
jetty maven插件
9.3.0.M1
com.vis
listUsersDomain
0.0.1-快照
...
这是REST控制器:

@RestController
public class UserListController {

    @Autowired
    private UserService userService;

    @RequestMapping(value = "/userlist", method=RequestMethod.GET)
    public List<User> userlist() {
        List<User> userList = userService.findAll();
        return userList;
    }
}
@RestController
公共类UserListController{
@自动连线
私人用户服务;
@RequestMapping(value=“/userlist”,method=RequestMethod.GET)
公共列表用户列表(){
List userList=userService.findAll();
返回用户列表;
}
}
UserService是在域中定义的。

我想这样做:

  • mvn清洁包
    在父级上
  • mvn jetty:在rest模块上运行

  • 然后尝试将rest模块中的打包更改为
    war

    我已经完成了所描述的顺序。但是,在“mvn码头:运行”之后在rest模块上,我收到以下错误:015-03-20 13:52:32.406:INFO://:main:Spring WebApplicationInitializers在类路径上检测到:WARN:oejuc.AbstractLifeCycle:main:FAILED org.eclipse.jetty.annotations。ServletContainerInitializersStarter@16c8b7bd:java.lang.NoClassDefFoundError:org/springframework/context/annotation/AnnotationConfigRegistry什么可能是问题?不确定,您能否编辑问题并放置完整的pom.xml文件?全部3个