apply plugin: 'java'最初にある「apply plugin:」というのは、Gradleのプラグインを使うためのものです。
apply plugin: 'application'もう1つ、プラグインが追加されていますね。この「applicationn」は、アプリケーションに関する機能を提供するプラグインです。先に「run」でアプリケーションを実行しましたが、これがapplicationプラグインによって提供されたタスクです。
mainClassName = 'App'途中を少し飛ばして、最後にある「mainClassName」という値を見て下さい。これは、applicationプラグインで使われるもので、メインクラスを指定するものです。runでアプリケーションを実行できたのも、このmainClassNameでメインクラスが指定されていたからです。
※リストが表示されない場合
AddBlockなどの広告ブロックツールがONになっているとリストなどが表示されない場合があります。これらのツールをOFFにしてみてください。
/* * This build file was generated by the Gradle 'init' task. * * This generated file contains a sample Java project to get you started. * For more details take a look at the Java Quickstart chapter in the Gradle * user guide available at https://docs.gradle.org/4.2.1/userguide/tutorial_java_projects.html */ // Apply the java plugin to add support for Java apply plugin: 'java' // Apply the application plugin to add support for building an application apply plugin: 'application' // In this section you declare where to find the dependencies of your project repositories { // Use jcenter for resolving your dependencies. // You can declare any Maven/Ivy/file repository here. jcenter() } dependencies { // This dependency is found on compile classpath of this component and consumers. compile 'com.google.guava:guava:22.0' // Use JUnit test framework testCompile 'junit:junit:4.12' } // Define the main class for the application mainClassName = 'App'
次へ >> |