我正在使用Intellij和同事使用Eclipse。有一个datamodel
项目,大多数组件都依赖于它具有所有JPA代码。如何添加依赖项目的生成源以构建路径?
datamodel
依赖项之一是utils
。在utils
有生成的来源。我在Eclipse中的同事将utils
的目标/生成源添加到构建路径中,并且所有内容都在Eclipse中构建并运行良好。
在Intellij中,当我转到Project Structure时,是否需要转到utils
并将utils
的目标/生成源作为Source
文件夹添加为等效的?
或者我需要添加该模块作为依赖?
编辑: 在utils的POM:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>generate-sources</id>
<phase>generate-sources</phase>
<configuration>
<tasks>
<mkdir dir="target/generated-sources" />
<exec executable="protoc">
<arg value="--java_out=target/generated-sources" />
<arg value="src/main/resources/utilities.proto" />
</exec>
</tasks>
<sourceRoot>target/generated-sources</sourceRoot>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
这些依赖项如何管理?例如,使用maven来定义依赖关系会自动包含utils.jar,因此项目变得不可知。如果通过IDE手动管理项目以编译事物,那么项目如何准确地部署其所有依赖项? –
utils是''datamodel'的maven中的依赖关系。 – Crystal
然后datamodel.jar应该是另一个项目中的一个依赖项。传递依赖关系还将包括utils.jar(除非它被特别标记为排除或标记为提供)。 –