我试图将旧的Java项目转换为maven构建,但面临排除源文件的困难:
当我为父项目设置目标以为所有项目编译和构建jar文件时,它仍然尝试编译提到的排除的java文件。下面是该项目的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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.app</groupId>
<artifactId>CCAPS.Impl</artifactId>
<version>1.0.0</version>
<parent>
<groupId>com.app</groupId>
<artifactId>parent</artifactId>
<version>1.0</version>
<relativePath>../Maven.Convertion/parent</relativePath>
</parent>
<properties>
...
</properties>
<dependencies>
...
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<excludes>
<exclude>**/adjudication/mapper/BusinessAddendumItemDBOMapper.java</exclude>
<exclude>**/adjudication/mapper/ContactInfoDBOMapper.java</exclude>
<exclude>**/adjudication/mapper/IncomeDBOMapper.java</exclude>
<exclude>**/adjudication/mapper/IncomeItemDBOMapper.java</exclude>
<exclude>**/adjudication/mapper/InternationalAddressDBOMapper.java</exclude>
<exclude>**/adjudication/mapper/ReferralSourceDBOMapper.java</exclude>
<exclude>**/adjudication/interceptor/*.java</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
<sourceDirectory>${project.basedir}/src/net/ccapsws/ds/adjudication</sourceDirectory>
</build>
</project>
排除的最后一行是编译时错误抛出的位置:
[ERROR] \Maven Convertion\CCAPSAdjudication\DataSource.CCAPS.Impl\src\net\gc\ccapsws\ds\adjudication\interceptor\CCAPSDTOAuditInterceptor.java:[8,46] error: package net.ccapsws.validation.dictionary does not exist
事情是我尝试使用exclude声明,但由于src路径是自定义的($ {project.basedir} / src / net / ccapsws / ds / adjudicationm,例如,是src路径),我怀疑maven没有不承认这条路?任何人都可以帮忙吗?
请注意,我不是在询问资源文件,我想在src文件夹中编译文件,但也愿意在编译期间排除特定的java文件。
编辑:还有一个项目引用了这个项目,但是在父POM中,我把这个项目放在反应堆序列中,所以我认为其他任何地方都没有引用这个项目。答案 0 :(得分:0)