I'm used to configure the gradle build to use jQAssistent with (basically) this snippet in build.gradle:
project.ext["jqaversion"] = "1.3.0"
project.ext["jqacoreversion"] = "1.3"
configurations {
jqaRuntime
}
dependencies {
// jQA 1.2
// jqaRuntime("com.buschmais.jqassistant:commandline:${project.jqaversion}")
// jQA 1.3
jqaRuntime("com.buschmais.jqassistant:jqassistant-commandline:${project.jqaversion}")
jqaRuntime("com.buschmais.jqassistant.plugin:java:${project.jqacoreversion}")
jqaRuntime("com.buschmais.jqassistant.plugin:junit:${project.jqacoreversion}")
}
task removeJQAReport(type: Delete) {
delete 'jqassistant/report'
delete 'jqassistant/store'
}
task(jqascan, dependsOn: 'removeJQAReport', type: JavaExec) {
main = 'com.buschmais.jqassistant.commandline.Main'
classpath = configurations.jqaRuntime
args 'scan'
args '-p'
args 'jqassistant/jqassistant.properties'
args '-f'
args 'java:classpath::build/classes/main'
args 'java:classpath::build/classes/test'
}
task(jqaanalyze, type: JavaExec) {
main = 'com.buschmais.jqassistant.commandline.Main'
classpath = configurations.jqaRuntime
args 'analyze'
args '-r'
args 'jqassistant/jqassistant-rules'
}
task(jqa, dependsOn: ['jqascan', 'jqaanalyze']) {
jqaanalyze.mustRunAfter jqascan
}
task(jqs, type: JavaExec) {
main = 'com.buschmais.jqassistant.commandline.Main'
classpath = configurations.jqaRuntime
args 'server'
standardInput = System.in
}
This works fine until jQA 1.2.0. After updating to 1.3.0, I'm getting this exception:
2017-09-26 14:42:33.793 [main] INFO PluginConfigurationReaderImpl - Loaded jQAssistant plugins [Common, Core Analysis, JUnit, Java, XML].
2017-09-26 14:42:33.826 [main] INFO StoreFactory - Connecting to store at 'file:/C:/Users/jn/projects/jqa-with-gradle/jqassistant/store'
Exception in thread "main" java.lang.NoSuchFieldError: BOOLEAN
at org.neo4j.shell.ShellSettings.<clinit>(ShellSettings.java:42)
at sun.misc.Unsafe.ensureClassInitialized(Native Method)
at sun.reflect.UnsafeFieldAccessorFactory.newFieldAccessor(UnsafeFieldAccessorFactory.java:43)
at sun.reflect.ReflectionFactory.newFieldAccessor(ReflectionFactory.java:142)
at java.lang.reflect.Field.acquireFieldAccessor(Field.java:1088)
at java.lang.reflect.Field.getFieldAccessor(Field.java:1069)
at java.lang.reflect.Field.get(Field.java:393)
at org.neo4j.kernel.configuration.AnnotatedFieldHarvester.findStatic(AnnotatedFieldHarvester.java:47)
at org.neo4j.kernel.configuration.AnnotationBasedConfigurationMigrator.<init>(AnnotationBasedConfigurationMigrator.java:39)
at org.neo4j.kernel.configuration.Config.<init>(Config.java:106)
at org.neo4j.kernel.configuration.Config.<init>(Config.java:96)
at org.neo4j.kernel.impl.factory.PlatformModule.<init>(PlatformModule.java:127)
at org.neo4j.kernel.impl.factory.GraphDatabaseFacadeFactory.createPlatform(GraphDatabaseFacadeFactory.java:232)
at org.neo4j.kernel.impl.factory.GraphDatabaseFacadeFactory.initFacade(GraphDatabaseFacadeFactory.java:146)
at org.neo4j.kernel.impl.factory.GraphDatabaseFacadeFactory.newFacade(GraphDatabaseFacadeFactory.java:130)
at org.neo4j.graphdb.factory.GraphDatabaseFactory.newDatabase(GraphDatabaseFactory.java:101)
at org.neo4j.graphdb.factory.GraphDatabaseFactory.lambda$createDatabaseCreator$0(GraphDatabaseFactory.java:89)
at org.neo4j.graphdb.factory.GraphDatabaseBuilder.newGraphDatabase(GraphDatabaseBuilder.java:183)
at com.buschmais.xo.neo4j.embedded.api.FileDatastoreFactory.createGraphDatabaseService(FileDatastoreFactory.java:31)
at com.buschmais.xo.neo4j.embedded.api.FileDatastoreFactory.createGraphDatabaseService(FileDatastoreFactory.java:16)
at com.buschmais.xo.neo4j.embedded.api.EmbeddedNeo4jXOProvider.createDatastore(EmbeddedNeo4jXOProvider.java:24)
at com.buschmais.xo.impl.XOManagerFactoryImpl.<init>(XOManagerFactoryImpl.java:48)
m.buschmais.xo.impl.bootstrap.XOBootstrapServiceImpl.createXOManagerFactory(XOBootstrapServiceImpl.java:39)
at com.buschmais.xo.api.bootstrap.XO.createXOManagerFactory(XO.java:43)
at com.buschmais.jqassistant.core.store.impl.AbstractGraphStore.start(AbstractGraphStore.java:49)
at com.buschmais.jqassistant.commandline.task.AbstractTask.run(AbstractTask.java:67)
at com.buschmais.jqassistant.commandline.Main.executeTask(Main.java:253)
at com.buschmais.jqassistant.commandline.Main.interpretCommandLine(Main.java:205)
at com.buschmais.jqassistant.commandline.Main.run(Main.java:91)
at com.buschmais.jqassistant.commandline.Main.main(Main.java:62)
:jqascan FAILED
You may find a complete example at https://github.com/kontext-e/jqa-gradle
Maven projects work fine, a command line jQA version is not available to download for 1.3 (only 1.2 is there).
Any ideas? Do I have to specify the Neo4j Version explicitely for 1.3?
Apparently it is a Gradle classpath problem since the jQAssistant commandline distribution works fine. So I modified the build.gradle file the following way:
dependencies {
jqaRuntime("com.buschmais.jqassistant:jqassistant-commandline:${project.jqaversion}") {
// because jQA 1.3 comes with Neo4j 2 and 3 support, there would be a classpath conflict
exclude module: 'neo4j'
}
jqaRuntime("com.buschmais.jqassistant.plugin:java:${project.jqaversion.substring(0, 3)}")
jqaRuntime("com.buschmais.jqassistant.plugin:junit:${project.jqaversion.substring(0, 3)}")
}
The mentioned example at https://github.com/kontext-e/jqa-gradle is also updated this way.