我想将现有项目转换为Maven项目。它有3个模块,其中一个模块有多个源文件夹。 http://i.imgur.com/jZCnR.pngMaven编译器插件,构建助手插件不会生成类文件
maven clean and install或eclipse clean不会在类和test-classes文件夹中创建类文件。项目结构是由那里没有任何类文件创建的。
以下插件配置在父pom中定义。
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<id>add-source</id>
<phase>generate-sources</phase>
<goals><goal>add-source</goal></goals>
<configuration>
<sources>
<source>src/main/java/**/*.*</source>
<source>src/report/java/**/*.*</source>
<source>src/architect/java/**/*.*</source>
</sources>
</configuration>
</execution>
<execution>
<id>add-test-source</id>
<phase>generate-test-sources</phase>
<goals><goal>add-test-source</goal></goals>
<configuration>
<sources>
<source>src/test/java/**/*.*</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.0</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<debug>false</debug>
</configuration>
<executions>
<execution>
<id>default-compile</id>
<phase>compile</phase>
<goals><goal>compile</goal></goals>
<configuration>
<includes>
<include>src/main/java/**/*.*</include>
<include>src/report/java/**/*.*</include>
<include>src/architect/java/**/*.*</include>
</includes>
</configuration>
</execution>
<execution>
<id>default-testCompile</id>
<phase>test-compile</phase>
<goals><goal>testCompile</goal></goals>
<configuration>
<testIncludes>
<include>src/test/java/**/*.*</include>
</testIncludes>
</configuration>
</execution>
</executions>
</plugin>
我在做什么错?
为什么添加与src/main/java或src/test/java不同的位置?这真的有必要吗? – khmarbaise
因为在这个遗留项目中有多个源文件夹,并且它们之间存在双向依赖关系。如果我做了一个特定的来源,比如说。在这种情况下,“报告”src文件夹,作为一个单独的maven模块,那么我不知道如何解决这种双向依赖。 – blaks
根据您提供的信息,您需要将多个源文件夹分隔为不同的模块。 – khmarbaise