Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @echo off
- rem Instructions:
- rem 1.) Save this to a file 'C:\reproduce.bat'
- rem Subdirectories should also work, but since this bug has to do with path length,
- rem this seems to be close to the minimal path that recreates the bug
- rem 2.) Run 'C:\reproduce.bat' which will call Gradle (should be on PATH)
- rem Gradle will fail to spawn the test process with Java agent
- rem 3.) To clean up, delete 'C:\reproduce.bat' and 'C:\my-server-root-directory'
- set project_dir=.\my-server-root-directory\jenkins\workspace\top-folder\child-folder\some-fancy-project@script\top-project\category-name\child-project
- mkdir %project_dir%
- rem Create 'settings.gradle'
- set settings_file=%project_dir%\settings.gradle
- @echo rootProject.name = 'jacoco-plugin-bug' > %settings_file%
- rem Create 'build.gradle'
- set build_file=%project_dir%\build.gradle
- @echo apply plugin: 'java' > %build_file%
- @echo apply plugin: 'jacoco' >> %build_file%
- @echo sourceCompatibility = 1.8 >> %build_file%
- @echo buildDir = "$projectDir/../../build/category-name/child-project" >> %build_file%
- @echo repositories { mavenCentral() } >> %build_file%
- @echo dependencies { testCompile 'junit:junit:4.11' } >> %build_file%
- rem Create 'Sum.java'
- mkdir %project_dir%\src\main\java\com\tilodickopp
- set java_file=%project_dir%\src\main\java\com\tilodickopp\Sum.java
- @echo package com.tilodickopp; > %java_file%
- @echo public class Sum { >> %java_file%
- @echo public int add(int a, int b) { return a + b; } >> %java_file%
- @echo } >> %java_file%
- rem Create 'SumTest.java'
- mkdir %project_dir%\src\test\java\com\tilodickopp
- set test_file=%project_dir%\src\test\java\com\tilodickopp\SumTest.java
- @echo package com.tilodickopp; > %test_file%
- @echo public class SumTest { >> %test_file%
- @echo @org.junit.Test public void testAdd() { >> %test_file%
- @echo org.junit.Assert.assertEquals(2, new Sum().add(1, 1)); >> %test_file%
- @echo } >> %test_file%
- @echo } >> %test_file%
- rem Run Gradle to reproduce bug
- gradle --settings-file %settings_file% --info clean build
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement