如何克服windows中Gradle的“文件名或扩展名太长”错误
在windows中运行如何克服windows中Gradle的“文件名或扩展名太长”错误,windows,gradle,jhipster,gatling,Windows,Gradle,Jhipster,Gatling,在windows中运行gradlew gatlingRun失败,在Jhipster中使用以下配置生成的默认应用程序上运行stacktrace失败 { "generator-jhipster": { "baseName": "jhipster", "packageName": "com.mycompany.myapp", "packageFolder": "com/mycompany/myapp", "authenticationType": "session
gradlew gatlingRun
失败,在Jhipster中使用以下配置生成的默认应用程序上运行stacktrace失败
{
"generator-jhipster": {
"baseName": "jhipster",
"packageName": "com.mycompany.myapp",
"packageFolder": "com/mycompany/myapp",
"authenticationType": "session",
"hibernateCache": "hazelcast",
"clusteredHttpSession": "no",
"websocket": "spring-websocket",
"databaseType": "sql",
"devDatabaseType": "h2Memory",
"prodDatabaseType": "mysql",
"searchEngine": "no",
"useCompass": false,
"buildTool": "gradle",
"frontendBuilder": "grunt",
"javaVersion": "8",
"rememberMeKey": "93ff732a10ab7d74fc26c1518ee79338de1cd149"
}
}
在gradle论坛上看到了一个类似的bug,但这个bug似乎已经过时了
我试图减少我的类路径,但没有用,仍然是相同的错误。该死的窗户!!gradle添加的类路径太长,包含所有生成的缓存文件夹名称。看到这篇文章,我想知道是否有一些配置可以让gatling在带有gradle的windows上工作
有gradle专家来营救plz吗
完整跟踪:
Gatling 2.2(尚未发布,也没有ETA)将通过将类路径作为仅清单的jar传递来绕过Windows命令行长度限制,请参阅
在发布之前,您可以使用2.2.0-SNAPSHOT。
不要使用Windows,而是使用Linux或OSX。以下是解决此问题的有效修复方法,这要感谢@atomfrede Manifest jar需要命名为gatlingBooter.jar,Gatling版本需要为2.1.6
task manifestJar(dependsOn:'compileTestScala',type: Jar) {
dependsOn configurations.testCompile
archiveName 'gatlingBooter.jar'
doFirst {
manifest {
// uri is just needed for Windows-compatibility
attributes 'Class-Path': configurations.testCompile.files.collect{ project.uri(it) }.join(' ')
}
}
}
task gatlingRun(dependsOn:'manifestJar', type: JavaExec) {
group = "gatling"
standardInput = System.in
final def sourceSet = sourceSets.test
File configFile = file('src/test/gatling/conf/gatling.conf')
def String gatlingDataFolder = "$project.rootDir.absolutePath/src/test/gatling/data"
def String gatlingReportsFolder = "$project.buildDir.absolutePath/reports/gatling"
def String gatlingBodiesFolder = "$project.rootDir.absolutePath/src/test/gatling/bodies"
def String gatlingSimulationsFolder = "$project.rootDir.absolutePath/src/test/gatling/simulations"
classpath sourceSet.output + files(manifestJar.archivePath) + files("src/test/gatling/conf")
main = "io.gatling.app.Gatling"
environment GATLING_HOME:''
args '-df', gatlingDataFolder
args '-rf', gatlingReportsFolder
args '-bdf', gatlingBodiesFolder
args "-sf", gatlingSimulationsFolder
}
我没有标记这个答案,因为它不能解决我的问题我不使用Gatling,但这个答案对我解决类似的Gradle JavaExec问题很有帮助!
task manifestJar(dependsOn:'compileTestScala',type: Jar) {
dependsOn configurations.testCompile
archiveName 'gatlingBooter.jar'
doFirst {
manifest {
// uri is just needed for Windows-compatibility
attributes 'Class-Path': configurations.testCompile.files.collect{ project.uri(it) }.join(' ')
}
}
}
task gatlingRun(dependsOn:'manifestJar', type: JavaExec) {
group = "gatling"
standardInput = System.in
final def sourceSet = sourceSets.test
File configFile = file('src/test/gatling/conf/gatling.conf')
def String gatlingDataFolder = "$project.rootDir.absolutePath/src/test/gatling/data"
def String gatlingReportsFolder = "$project.buildDir.absolutePath/reports/gatling"
def String gatlingBodiesFolder = "$project.rootDir.absolutePath/src/test/gatling/bodies"
def String gatlingSimulationsFolder = "$project.rootDir.absolutePath/src/test/gatling/simulations"
classpath sourceSet.output + files(manifestJar.archivePath) + files("src/test/gatling/conf")
main = "io.gatling.app.Gatling"
environment GATLING_HOME:''
args '-df', gatlingDataFolder
args '-rf', gatlingReportsFolder
args '-bdf', gatlingBodiesFolder
args "-sf", gatlingSimulationsFolder
}