尝试从Jhipster项目获取WAR文件。

huangapple go评论125阅读模式
英文:

trying to get the war file from Jhipster project

问题

I'm trying to get the war file from JHipster project using this command

./gradlew -Pprod -Pwar clean bootWar

这是我得到的错误信息


构建失败:发生异常。

  • 出现了什么问题:
    任务 'bootWar' 未在根项目 'account' 中找到。一些可能的候选项是:'bootRun'。

  • 尝试:
    运行 gradlew tasks 以获取可用任务列表。使用 --stacktrace 选项运行以获取堆栈跟踪。使用 --info 或 --debug 选项运行以获取更多日志输出。使用 --scan 运行以获取完整的洞察。

  • 获取更多帮助请访问 https://help.gradle.org

在 0 秒内构建失败


这是我的 build.gradle 内容

// 以下是 build.gradle 的内容
import org.gradle.internal.os.OperatingSystem

// buildscript 代码块
buildscript {
    repositories {
        mavenLocal()
        jcenter()
        maven { url "https://repo.spring.io/plugins-release" }
        maven { url "https://plugins.gradle.org/m2/" }
    }
    dependencies {
        classpath "org.springframework.boot:spring-boot-gradle-plugin:${spring_boot_version}"
        classpath "io.spring.gradle:propdeps-plugin:0.0.9.RELEASE"
        classpath "gradle.plugin.com.gorylenko.gradle-git-properties:gradle-git-properties:1.4.17"
        //jhipster-needle-gradle-buildscript-dependency - JHipster 将在此添加其他 gradle 构建脚本插件
    }
}

// plugins 代码块
plugins {
    id "org.sonarqube" version "2.5"
    id "net.ltgt.apt-eclipse" version "0.13"
    id "net.ltgt.apt-idea" version "0.13"
    id "net.ltgt.apt" version "0.13"
    id "io.spring.dependency-management" version "1.0.3.RELEASE"
    //jhipster-needle-gradle-plugins - JHipster 将在此添加其他 gradle 插件
}

// 其他配置代码块...

以上是您提供的信息的翻译部分,其余内容不再重复翻译。如果您需要更多帮助,请告诉我。

英文:

i'm trying to get the war file from Jhipster project project using this command

./gradlew -Pprod -Pwar clean bootWar

this the error that i got


FAILURE: Build failed with an exception.

  • What went wrong:
    Task 'bootWar' not found in root project 'account'. Some candidates are: 'bootRun'.

  • Try:
    Run gradlew tasks to get a list of available tasks. Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

BUILD FAILED in 0s


this my bild.gradle

import org.gradle.internal.os.OperatingSystem
buildscript {
repositories {
mavenLocal()
jcenter()
maven { url "https://repo.spring.io/plugins-release" }
maven { url "https://plugins.gradle.org/m2/" }
}
dependencies {
classpath "org.springframework.boot:spring-boot-gradle-plugin:${spring_boot_version}"
classpath "io.spring.gradle:propdeps-plugin:0.0.9.RELEASE"
classpath "gradle.plugin.com.gorylenko.gradle-git-properties:gradle-git-properties:1.4.17"
//jhipster-needle-gradle-buildscript-dependency - JHipster will add additional gradle build script plugins here
}
}
plugins {
id "org.sonarqube" version "2.5"
id "net.ltgt.apt-eclipse" version "0.13"
id "net.ltgt.apt-idea" version "0.13"
id "net.ltgt.apt" version "0.13"
id "io.spring.dependency-management" version "1.0.3.RELEASE"
//jhipster-needle-gradle-plugins - JHipster will add additional gradle plugins here
}
apply plugin: 'java'
sourceCompatibility=1.8
targetCompatibility=1.8
tasks.withType(JavaExec) {
jvmArgs = [ '-Xmx512m','-Xms256m']
}
// Until JHipster supports JDK 9
assert System.properties['java.specification.version'] == '1.8'
apply plugin: 'maven'
apply plugin: 'org.springframework.boot'
apply plugin: 'war'
apply plugin: 'propdeps'
apply plugin: 'io.spring.dependency-management'
apply plugin: 'idea'
dependencyManagement {
imports {
mavenBom 'io.github.jhipster:jhipster-dependencies:' + jhipster_dependencies_version
//jhipster-needle-gradle-dependency-management - JHipster will add additional dependencies management here
}
}
defaultTasks 'bootRun'
group = 'com.skywriter.account'
version = '0.0.1-SNAPSHOT'
description = ''
bootRepackage {
mainClass = 'com.skywriter.account.AccountApp'
}
war {
}
springBoot {
mainClass = 'com.skywriter.account.AccountApp'
executable = true
buildInfo()
}
if (OperatingSystem.current().isWindows()) {
task pathingJar(type: Jar) {
dependsOn configurations.runtime
appendix = 'pathing'
doFirst {
manifest {
attributes 'Class-Path': configurations.runtime.files.collect {
it.toURI().toURL().toString().replaceFirst(/file:\/+/, '/').replaceAll(' ', '%20')
}.join(' ')
}
}
}
bootRun {
addResources = false
dependsOn pathingJar
doFirst {
classpath = files("$buildDir/classes/java/main", "$buildDir/resources/main", pathingJar.archivePath)
}
}
} else {
bootRun {
addResources = false
}
}
test {
exclude '**/CucumberTest*'
// uncomment if the tests reports are not generated
// see https://github.com/jhipster/generator-jhipster/pull/2771 and https://github.com/jhipster/generator-jhipster/pull/4484
// ignoreFailures true
reports.html.enabled = false
}
task cucumberTest(type: Test) {
description = "Execute cucumber BDD tests."
group = "verification"
include '**/CucumberTest*'
// uncomment if the tests reports are not generated
// see https://github.com/jhipster/generator-jhipster/pull/2771 and https://github.com/jhipster/generator-jhipster/pull/4484
// ignoreFailures true
reports.html.enabled = false
}
check.dependsOn cucumberTest
task testReport(type: TestReport) {
destinationDir = file("$buildDir/reports/tests")
reportOn test
}
task cucumberTestReport(type: TestReport) {
destinationDir = file("$buildDir/reports/tests")
reportOn cucumberTest
}
apply from: 'gradle/docker.gradle'
apply from: 'gradle/sonar.gradle'
apply from: 'gradle/liquibase.gradle'
apply from: 'gradle/mapstruct.gradle'
//jhipster-needle-gradle-apply-from - JHipster will add additional gradle scripts to be applied here
if (project.hasProperty('prod')) {
apply from: 'gradle/profile_prod.gradle'
}
if (project.hasProperty('stage')) {
apply from: 'gradle/profile_stage.gradle'
}
if (project.hasProperty('demo')) {
apply from: 'gradle/profile_demo.gradle'
} 
if (project.hasProperty('aws')) {
apply from: 'gradle/profile_aws.gradle'
} 
if (project.hasProperty('devtest')) {
apply from: 'gradle/profile_devtest.gradle'
} 
if (project.hasProperty('aws')) {
apply from: 'gradle/profile_aws.gradle'
} 
else {
apply from: 'gradle/profile_dev.gradle'
}
if (project.hasProperty('graphite')) {
apply from: 'gradle/graphite.gradle'
}
if (project.hasProperty('prometheus')) {
apply from: 'gradle/prometheus.gradle'
}
if (project.hasProperty('zipkin')) {
apply from: 'gradle/zipkin.gradle'
}
configurations {
providedRuntime
compile.exclude module: "spring-boot-starter-tomcat"
}
repositories {
mavenLocal()
jcenter()
}
dependencies {
compile 'io.logz.logback:logzio-logback-appender:v1.0.21'   
compile "org.springframework.boot:spring-boot-starter-cache"
compile "io.github.jhipster:jhipster"
compile "io.dropwizard.metrics:metrics-core"
compile "io.dropwizard.metrics:metrics-json"
compile "io.dropwizard.metrics:metrics-jvm"
compile "io.dropwizard.metrics:metrics-servlet"
compile "io.dropwizard.metrics:metrics-servlets"
compile "net.logstash.logback:logstash-logback-encoder"
compile "com.fasterxml.jackson.datatype:jackson-datatype-json-org"
compile "com.fasterxml.jackson.datatype:jackson-datatype-hppc"
compile "com.fasterxml.jackson.datatype:jackson-datatype-jsr310"
compile "com.fasterxml.jackson.datatype:jackson-datatype-hibernate5"
compile "com.fasterxml.jackson.core:jackson-annotations"
compile "com.fasterxml.jackson.core:jackson-databind"
compile "com.fasterxml.jackson.module:jackson-module-afterburner"
compile "com.ryantenney.metrics:metrics-spring"
compile "com.hazelcast:hazelcast"
compile "com.hazelcast:hazelcast-hibernate52"
compile "com.hazelcast:hazelcast-spring"
compile "javax.cache:cache-api"
compile "org.hibernate:hibernate-core"
compile "com.zaxxer:HikariCP"
compile "org.apache.commons:commons-lang3"
compile "commons-io:commons-io"
compile "javax.transaction:javax.transaction-api"
compile "org.hibernate:hibernate-entitymanager"
compile "org.hibernate:hibernate-envers"
compile "org.hibernate:hibernate-validator"
compile "org.liquibase:liquibase-core"
compile "com.mattbertolini:liquibase-slf4j"
compile "org.springframework.boot:spring-boot-actuator"
compile "org.springframework.boot:spring-boot-autoconfigure"
compile "org.springframework.boot:spring-boot-loader-tools"
compile "org.springframework.boot:spring-boot-starter-mail"
compile "org.springframework.boot:spring-boot-starter-logging"
compile "org.springframework.boot:spring-boot-starter-aop"
compile "org.springframework.boot:spring-boot-starter-data-jpa"
compile "org.springframework.boot:spring-boot-starter-security"
compile ("org.springframework.boot:spring-boot-starter-web") {
exclude module: 'spring-boot-starter-tomcat'
}
compile "org.springframework.boot:spring-boot-starter-undertow"
compile "org.springframework.boot:spring-boot-starter-thymeleaf"
compile "org.zalando:problem-spring-web"
compile "org.springframework.cloud:spring-cloud-starter"
compile "org.springframework.cloud:spring-cloud-starter-ribbon"
compile "org.springframework.cloud:spring-cloud-starter-hystrix"
compile "org.springframework.cloud:spring-cloud-starter-spectator"
compile "org.springframework.retry:spring-retry"
compile "org.springframework.cloud:spring-cloud-starter-eureka"
compile "org.springframework.cloud:spring-cloud-starter-config"
compile "org.springframework.cloud:spring-cloud-security"
compile "org.springframework.cloud:spring-cloud-starter-feign"
compile "org.springframework.cloud:spring-cloud-spring-service-connector"
compile "org.springframework:spring-context-support"
compile "org.springframework.security:spring-security-config"
compile "org.springframework.security:spring-security-data"
compile "org.springframework.security:spring-security-web"
compile "org.springframework.security.oauth:spring-security-oauth2"
compile "org.springframework.security:spring-security-jwt"
compile ("io.springfox:springfox-swagger2") {
exclude module: 'mapstruct'
}
compile "io.springfox:springfox-bean-validators"
compile "org.postgresql:postgresql"
compile "org.mapstruct:mapstruct-jdk8:${mapstruct_version}"
testCompile "com.jayway.jsonpath:json-path"
testCompile "info.cukes:cucumber-junit"
testCompile "info.cukes:cucumber-spring"
testCompile ("org.springframework.boot:spring-boot-starter-test") {
exclude group: 'com.vaadin.external.google', module: 'android-json'
}
testCompile "org.springframework.security:spring-security-test"
testCompile "org.springframework.boot:spring-boot-test"
testCompile "org.assertj:assertj-core"
testCompile "junit:junit"
testCompile "org.mockito:mockito-core"
testCompile "com.mattbertolini:liquibase-slf4j"
testCompile "org.hamcrest:hamcrest-library"
testCompile "com.h2database:h2"
optional ("org.springframework.boot:spring-boot-configuration-processor") {
exclude group: 'com.vaadin.external.google', module: 'android-json'
}
//jhipster-needle-gradle-dependency - JHipster will add additional dependencies here
}
task cleanResources(type: Delete) {
delete 'build/resources'
}
task wrapper(type: Wrapper) {
gradleVersion = '4.4'
}
task stage(dependsOn: 'bootRepackage') {
}
compileJava.dependsOn processResources
processResources.dependsOn cleanResources,bootBuildInfo
bootBuildInfo.mustRunAfter cleanResources

thanks in advance

答案1

得分: 3

为了使答案更加可见(适用于jhipster 4.x):

要创建一个可以部署到应用服务器的war文件,请使用 ./gradlew war,要创建一个可通过 java -jar 执行的可执行war文件,请使用 ./gradlew bootWar

英文:

To make the answer more visible (valid for jhipster 4.x):

for creating a war that can be deployed in an application server use ./gradlew war and for an executable war file, which can be executed via java -jar use ./gradlew bootWar.

huangapple
  • 本文由 发表于 2020年8月5日 22:26:48
  • 转载请务必保留本文链接:https://go.coder-hub.com/63267318.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定