java ee - gradle test failing due to interceptor class not found -


i'm working through exercises in beginning java ee 7 except i'm trying adapt them use gradle instead of maven. chapter 2 interceptor exercise, wrote build.gradle:

apply plugin: 'java' repositories {   mavencentral() } dependencies {     compile 'org.slf4j:slf4j-api:1.7.5', 'org.jboss.weld.se:weld-se-core:2.2.10.final'     testcompile "junit:junit:4.11" } jar {     {         configurations.compile.collect {             it.isdirectory() ? : ziptree(it)         }     }     manifest {         attributes 'main-class': 'org.agoncal.book.javaee7.chapter02.main'     } } 

i'm using src dir directly author's github. ./gradlew -x test build succeeds , java -jar build/libs/gradletest.jar gives expected output (although spits out lot of unexpected warnings). ./gradlew test fails error:

org.jboss.weld.exceptions.deploymentexception: weld-001417: enabled interceptor class <class>org.agoncal.book.javaee7.chapter02.logginginterceptor</class> in file:/home/allen/gradletest/build/resources/main/meta-inf/beans.xml@7 not match interceptor bean: class not found, or not annotated @interceptor , still not registered through portable extension, or not annotated @dependent inside implicit bean archive 

the beans.xml , class files straight author's repo on github , appear above error says they're not. beans.xml declares interceptor, , interceptor class annotated @interceptor.

my guess problem lies gradle build. see problem is?

allen, i'm assuming doing same example: agoncal-book-javaee7/chapter02/chapter02-putting-together.

when tried "mvn test" works , found difference between build/target directory between maven , gradle. maven combines both classes , resources in 1 directory (as before packaging in jar) gradle separates two, 1 folder classes , resources. weldcontainer use testing unable pickup class when reading beans.xml.

here's build.gradle:

apply plugin: 'java' repositories {     mavencentral() } dependencies {     compile 'org.slf4j:slf4j-api:1.7.5', 'org.jboss.weld.se:weld-se-core:2.2.10.final'          compile 'org.eclipse.persistence:org.eclipse.persistence.jpa:2.5.2'          compile 'javax:javaee-api:7.0'         compile 'org.apache.derby:derby:10.10.1.1'         testcompile "junit:junit:4.11" }  test.dofirst {     copy {          'build/resources/test/meta-inf/beans.xml'         'build/classes/main/meta-inf'     }     copy {          'build/resources/test/meta-inf/beans.xml'         'build/classes/test/meta-inf'     } } 

result when running it:

> chapter02-putting-together git:(master) x gradle clean test :clean :compilejava :processresources :classes :compiletestjava :processtestresources :testclasses :test  build successful  total time: 4.302 secs 

Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -