Comments (6)
Hello,
I'm afraid there's no way to do it right now as project.sourceSets.main.output is always added in front of classpath.
The only way I can see to achieve this is to put instrumented classes in sourceSets.main.output (build/main/classes) folder overriding default classes.
from gretty.
Furthermore I've added support for beforeClassPath in gretty-1.2.6-SNAPSHOT:
gretty {
beforeClassPath "${buildDir}/instrumentedClasses"
}
from gretty.
Thanks. I tried it but it does not seem to be working. When using beforeClassPath
it still uses the normal, uninstrumented, code.
Currently I have it working using the following work around:
cobertura {
// cobertura in the servlet containter started by gretty looks for the datafile in this
// location. TODO: pass the location of this file to the servlet using system properties
coverageOutputDatafile = file("$projectDir/cobertura.ser")
coverageReportDatafile = file("$projectDir/cobertura.ser")
}
afterEvaluate {
tasks.appBeforeIntegrationTest {
gretty {
servletContainer = 'jetty9'
// add the instrumented classes to the class path
classPath "${project.buildDir}/instrumented_classes"
// add the libraries needed by cobertura to the class path
configurations.cobertura.each {
classPath it
}
}
}
.doFirst {
// move the classes out of the way so gretty can only see the instrumented_classes
file("${project.buildDir}/classes/main.nope").deleteDir()
file("${project.buildDir}/classes/main").renameTo("${project.buildDir}/classes/main.nope")
}
}
afterEvaluate {
tasks.appAfterIntegrationTest.finalizedBy 'generateCoberturaReport'
// move the classes back
tasks.generateCoberturaReport.doFirst {
file("${project.buildDir}/classes/main.nope").renameTo("${project.buildDir}/classes/main")
}
}
from gretty.
Nice to hear you found a workaround. I'll take a look again today.
from gretty.
Well, using following configuration I was able to achive success with gretty-1.2.6-SNAPSHOT
buildscript {
repositories {
mavenLocal()
jcenter()
mavenCentral()
}
dependencies {
classpath "ru.shadam.gretty:gretty:$gretty_version"
classpath "net.saliman:gradle-cobertura-plugin:2.3.1"
}
}
repositories {
mavenLocal()
jcenter()
maven { url 'http://oss.jfrog.org/artifactory/oss-snapshot-local' }
}
apply plugin: 'groovy'
apply plugin: 'org.akhikhl.gretty'
apply plugin: 'net.saliman.cobertura'
dependencies {
compile 'org.webjars:bootstrap:3.2.0'
compile 'org.webjars:jquery:2.1.1'
// We use Velocity for example of template processing within the webapp.
compile 'org.apache.velocity:velocity:1.7'
}
cobertura {
coverageOutputDatafile = file("$projectDir/cobertura.ser")
coverageReportDatafile = file("$projectDir/cobertura.ser")
}
afterEvaluate {
tasks.appBeforeIntegrationTest {
gretty {
servletContainer = 'jetty9'
jvmArgs = ['-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005']
beforeClassPath "${project.buildDir}/instrumented_classes/"
// add the libraries needed by cobertura to the class path
configurations.cobertura.each {
classPath it
}
}
}
tasks.appAfterIntegrationTest.finalizedBy 'coberturaReport'
}
dependencies {
testCompile "org.codehaus.groovy:groovy-all:$groovy_version"
testCompile "org.spockframework:spock-core:$spock_version"
testCompile "org.gebish:geb-spock:$gebVersion"
testCompile "org.seleniumhq.selenium:selenium-support:$seleniumVersion"
testCompile "org.seleniumhq.selenium:selenium-firefox-driver:$seleniumVersion"
}
test {
include '**/Test*.*'
include '**/*Test.*'
exclude '**/*IT.*'
}
task integrationTest(type: Test, dependsOn: 'test') {
outputs.upToDateWhen { false }
include '**/*IT.*'
doFirst {
systemProperty 'geb.build.reportsDir', reporting.file('geb')
}
}
You should use
maven { url 'http://oss.jfrog.org/artifactory/oss-snapshot-local' }
instead of mavenLocal() to reproduce my build.
from gretty.
Yes, I'm not sure what I did wrong earlier but it works. Many thanks!
from gretty.
Related Issues (20)
- Task - "integrationTest" always assumes, it needs to start tomcat before and stop after tests HOT 5
- java.lang.NoClassDefFoundError when dependencies with mulit level project HOT 1
- Trigger hot deployment reload with a keypress HOT 3
- Allow farm/webapp task to include dependencies from repo HOT 5
- Support breaking changes in 2.14
- Product archive name should include version
- The Tomcat container has a horrible issue with fetching resources HOT 3
- org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':farmBeforeIntegrationTest' HOT 4
- Add integration test for dependency in farm
- Run testExamples on CI instead of just buildExamples
- Check plugin compatibility with Gradle 3.0M1
- Add integration tests for farm with overlays and farm with dependencies
- Gretty does not shutdown Jetty process after abnormally terminating HOT 3
- Logger dependencies
- Overlays for repository based web apps in a farm HOT 9
- Code coverage for server side libraries in integration tests HOT 2
- Error using restartMode='redeploy' on tomcat 8
- LiveReload support HOT 1
- NPE with liveReload HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gretty.