LoginSignup
Tattya
@Tattya

Are you sure you want to delete the question?

If your question is resolved, you may close it.

Leaving a resolved question undeleted may help others!

We hope you find it useful!

VSCODEでWARファイルの作成ができなくなりました。初心者で解決方法がわからず困っています。

VSCODEでWARファイルの作成ができなくなりました。解決方法を教えてください。

VSCODEでプロジェクトを作成しているのですが急にWARを作成するコマンドが実行できなくなりました。
VSCODEのターミナルに--warning-mode allを実行してみろ的なエラーが出ていたので実行してみたところ次のようなエラーが出ました。

発生している問題・エラー

PS C:\workspace\board-app-sample> gradle :build:app:war --warning-mode all             

> Configure project :app
The compile configuration has been deprecated for dependency declaration. This will fail with an error in Gradle 7.0. Please use the implementation configuration instead. Consult the upgrading guide for further information: https://docs.gradle.org/6.8.2/userguide/upgrading_version_5.html#dependencies_should_no_longer_be_declared_using_the_compile_and_runtime_configurations
        at build_44phxzx733luf61bnicjmj8p0$_run_closure2.doCall(C:\workspace\board-app-sample\app\build.gradle:33)
        (Run with --stacktrace to get the full stack trace of this deprecation warning.)
The AbstractArchiveTask.archiveName property has been deprecated. This is scheduled to be removed in Gradle 7.0. Please use the archiveFileName property instead. See https://docs.gradle.org/6.8.2/dsl/org.gradle.api.tasks.bundling.AbstractArchiveTask.html#org.gradle.api.tasks.bundling.AbstractArchiveTask:archiveName for more details.
        at build_44phxzx733luf61bnicjmj8p0$_run_closure5.doCall(C:\workspace\board-app-sample\app\build.gradle:48)
        (Run with --stacktrace to get the full stack trace of this deprecation warning.)

FAILURE: Build failed with an exception.

* What went wrong:
Project 'build' not found in root project 'board-app-sample'.

* Try:
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.gradle 

33行目と48行目が分かるようにこのコードには場所を記しています。

/*
 * This file was generated by the Gradle 'init' task.
 *
 * This generated file contains a sample Java application project to get you started.
 * For more details take a look at the 'Building Java & JVM projects' chapter in the Gradle
 * User Manual available at https://docs.gradle.org/6.7/userguide/building_java_projects.html
 */

plugins {
    // Apply the application plugin to add support for building a CLI application in Java.
    id 'application'

    id 'war' // add
}

repositories {
    // Use JCenter for resolving dependencies.
    jcenter()
}

dependencies {
    // Use JUnit Jupiter API for testing.
    testImplementation 'org.junit.jupiter:junit-jupiter-api:5.6.2'

    // Use JUnit Jupiter Engine for testing.
    testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine'

    // This dependency is used by the application.
    implementation 'com.google.guava:guava:29.0-jre'

    providedCompile 'javax.servlet:javax.servlet-api:3.1.0' // add

   33行目ここでエラーが出ている compile group: 'mysql', name: 'mysql-connector-java', version: '5.1.49' // add
}

application {
    // Define the main class for the application.
    mainClass = 'board.app.sample.App'
}

tasks.named('test') {
    // Use junit platform for unit tests.
    useJUnitPlatform()
}

// ファイル末尾に追記
war {
   48行目ここでエラーが出ている archiveName 'boardsample.war'
}
tasks.withType(JavaCompile) {
    options.encoding = 'UTF-8'
}

自分で試したこと

48行目のarchiveNameをarchiveFileNameに変えてみましたがダメでした。
Gradleいろいろ調べてみましたが全然理解できず困っています。

0

No Answers yet.

Your answer might help someone💌