我正在使用m2eclipse进行多模块项目。我设置maven来处理解析工作区依赖项。但是当我对服务模块进行更改时,立即在其他模块上看不到更改。如果我在Service层中创建新方法,则在WebApp层中不可见。有时甚至运行/ maven安装和刷新和 Project / clean 和 Maven / Update Dependencies 都不起作用。有人可以就这个问题给我一个想法吗?
我的项目结构如下:
父模块
<groupId>com.myproject</groupId>
<artifactId>einvites-parent</artifactId>
<modules>
<module>myproject-common</module>
<module>myproject-domain</module>
<module>myproject-service</module>
<module>myproject-web</module>
</modules>
服务模块
<parent>
<artifactId>myproject-parent</artifactId>
<groupId>com.myproject</groupId>
<version>1.0</version>
</parent>
<groupId>com.myproject</groupId>
<artifactId>myproject-service</artifactId>
网络模块
<parent>
<artifactId>myproject-parent</artifactId>
<groupId>com.myproject</groupId>
<version>1.0</version>
</parent>
<groupId>com.myproject</groupId>
<artifactId>myproject-web</artifactId>
<version>1.0</version>
<packaging>war</packaging>
<name>myproject-web</name>
<dependencies>
<dependency>
<groupId>com.myproject</groupId>
<artifactId>myproject-service</artifactId>
<version>1.0</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
</dependencies>
答案 0 :(得分:0)
这应该有效;它对我有用。我真的不确定这是否能解决问题,但可能会尝试更改您的POM以使用SNAPSHOT
版本,例如1.0-SNAPSHOT
(您应该使用SNAPSHOT
版本对于正在积极开发的模块。)
顺便说一句,你的POM中有很多不必要和冗余的东西。他们应该是这样的:
服务模块
<project>
...
<parent>
<artifactId>myproject-parent</artifactId>
<groupId>com.myproject</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<!--groupId>com.myproject</groupId--> <!-- no need, you inherit it -->
<artifactId>myproject-service</artifactId>
...
</project>
网络模块
<project>
...
<parent>
<artifactId>myproject-parent</artifactId>
<groupId>com.myproject</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<!--groupId>com.myproject</groupId--> <!-- no need, you inherit it -->
<artifactId>myproject-web</artifactId>
<!--version>1.0</version--> <!-- no need, you inherit it -->
<packaging>war</packaging>
<name>myproject-web</name>
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId> <!-- use the built-in properties instead -->
<artifactId>myproject-service</artifactId>
<version>${project.version}</version> <!-- use the built-in properties instead -->
<!--type>jar</type--> <!-- no need, that's the default -->
<!--scope>compile</scope--> <!-- no need, that's the default -->
</dependency>
</dependencies>
...
</project>