我有一个多模块项目。该方面目前被添加到“核心”项目中。在此处执行mvn clean install
时可以使用。但是试图在父项目做一个mvn clean install
它失败,此错误编译其他项目之一时:编译时使用AspectJ编译器代替Javac时出错
类型org.hibernate.annotations.CacheConcurrencyStrategy不能得到解决。所以它不是 - 这是间接需要的.class文件
如果我在该项目中添加Hibernate核心依赖过于它的工作原理,但添加依赖于不应该依赖没有意义的项目引用一个办法。当编译javac
它工作正常。
是什么原因?我该如何解决这个问题,以便我可以使用AspectJ编译器,而不会将依赖项泄漏到不应该具有的项目上?
我在父POM此配置:
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>1.5</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<complianceLevel>1.6</complianceLevel>
</configuration>
<executions>
<execution>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
更新
我刚发现。正在运行mvn clean install
每次都失败。但是,一次运行mvn [clean] install
失败。然后运行mvn install
而没有clean
的作品。我发现目标文件夹中的builddef.lst
是它工作的原因,并根据您是否运行干净而失败。所以现在我的问题是:你如何自动生成这个文件?
父POM文件:
<?xml version="1.0" encoding="UTF-8"?>
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.mycompany</groupId>
<artifactId>core-lib</artifactId>
<name>core-lib</name>
<packaging>pom</packaging>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>1.5</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<complianceLevel>1.6</complianceLevel>
</configuration>
<executions>
<execution>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
<version>1.7.4</version>
</dependency>
</dependencies>
<modules>
<module>core-xyz</module>
<module>core-xyz2</module>
</modules>
</project>
什么是异常的堆栈跟踪,你的方面是怎样的? – SpaceTrucker
@KnightRider你应该更新你的问题,而不是添加评论。 –
@LeonardBrünings完成。 –