AspectJ抛出ClassCastException

时间:2020-04-29 09:19:05

标签: java gradle aspectj

在将构建从某些较旧的gradle版本迁移到gradle 6.3之后,我尝试使用方面构建Java 1.6应用程序。由于gradle版本较新,因此我使用的是Java 9。

方面编译器抛出ClassCastException(链接到下面的日志),如果我理解正确,则是由于编译器未找到java.lang.Object类引起的。我只是猜测这可能与使用Java 9运行构建有关,但目标是与Java 1.6兼容。如果是这种情况,我如何告诉编译器在哪里找到它?我试图将-1.6参数传递给ajc,但没有任何改变。

我还包含了build.gradle的内容-我很抱歉在gradle 6.3中并不完全,因为在完全迁移它之前,我一直困扰于AspectJ编译问题。

在此先感谢您的回复。

build.gradle内容:

buildscript {
   repositories {
      maven {
        url "${artifactoryURL}/libs-releases"
      }
   }
   dependencies {
      classpath "io.freefair.gradle:aspectj-plugin:5.0.0-rc6"
      classpath "gradle.plugin.org.myire:quill:2.3.1"
   }
}

apply plugin: 'java'
apply plugin: 'io.freefair.aspectj.post-compile-weaving'
apply plugin: 'org.myire.quill.cobertura'
apply from: 'https://localnet/public/gradle/trunk/repositories.gradle'

java {
   sourceCompatibility = JavaVersion.VERSION_1_6
}

group = "cz.svt"
version = "${version}"

aspectj {
   version = "1.6.8"
}

configurations.all {
    transitive = false
}

dependencies {
   compile('avalon:avalon:4.2.0')
   compile('cglib:cglib-nodep:2.2')
   compile('commons-beanutils:commons-beanutils:1.7.0')
   compile('commons-codec:commons-codec:1.3')
   compile('commons-collections:commons-collections:3.1')
   compile('org.apache.commons:commons-compress:1.4.1')                             
   compile('commons-digester:commons-digester:1.6')
   compile('commons-fileupload:commons-fileupload:1.1')
   compile('commons-io:commons-io:1.3.1')
   compile('commons-lang:commons-lang:2.0')
   compile('commons-logging:commons-logging:1.0.4')
   compile('commons-net:commons-net:2.0')
   compile('commons-pool:commons-pool:1.2')
   compile('commons-validator:commons-validator:1.1.3')
   compile('com.ibm.db2:jdbc3-driver:9.5')
   compile('dom4j:dom4j:1.6.1')
   compile('org.codehaus.groovy:groovy-all:1.5.7')
   compile('org.apache.xmlgraphics:fop:0.94')
   compile('com.google.guava:guava:13.0.1')
   compile('org.codehaus.groovy:groovy-all:1.5.7')
   compile('cz.svt:hibernate-svt:3.6.8.Final')
   compile('com.itextpdf:itextpdf:5.0.2')
   compile('joda-time:joda-time:2.1')
   compile('javax.servlet:jstl:1.0.6')
   compile('junit:junit:3.8.1')
   compile('log4j:log4j:1.2.15')
   compile('mail:mail:1.0.3')
   compile('org.springframework:spring-core:1.2.9')
   compile('org.springframework:spring-beans:1.2.9')
   compile('org.springframework:spring-mock:1.2.9')
   compile('taglibs:standard:1.0.6')
   compile('struts:struts:1.2.4')
   compile('struts:struts-el:1.2.4')
   compile('strutstest:strutstest:2.1.3-1.2-2.3')
   compile('velocity:velocity:1.4')
   compile('org.apache.ant:ant:1.7.1')
   compile('org.apache.tomcat:jsp-api:6.0.18')
   compile('org.apache.tomcat:servlet-api:6.0.18')
   compile('org.apache.tomcat:catalina:6.0.18')
   compile('org.apache.tomcat:dbcp:6.0.18')
   compile('org.easymock:easymock:3.0')
   compile('cz.svt:easymock-propeq:1.3')
   compile('org.testng:testng:5.11:jdk15')

   testCompile('org.apache.ftpserver:ftplet-api:1.0.0')
   testCompile('org.apache.ftpserver:ftpserver-core:1.0.0')
   testCompile('org.apache.mina:mina-core:2.0.0-M4')

   testRuntime('org.slf4j:slf4j-api:1.6.1')
   testRuntime('org.slf4j:slf4j-log4j12:1.6.1')
   testRuntime('org.uncommons:reportng:1.0')
   testRuntime('asm:asm:3.0')
   testRuntime('asm:asm-tree:3.0')
   testRuntime('org.hibernate:hibernate-commons-annotations:3.2.0.Final')
   testRuntime('org.hibernate.javax.persistence:hibernate-jpa-2.0-api:1.0.1.Final')
   testRuntime('javax.transaction:jta:1.1')
   testRuntime('antlr:antlr:2.7.6')
   testRuntime("org.objenesis:objenesis:1.2")
   testRuntime("oro:oro:2.0.7")
}

test {
   useTestNG() {
      suites 'src/test/resources/testng.xml'
      listeners << 'org.uncommons.reportng.HTMLReporter'
      listeners << 'org.testng.reporters.XMLReporter'
   }
}

task reports {
    dependsOn coberturaTestReport, javadoc
}

这是指向Aspectj编译器输出1

的链接

0 个答案:

没有答案