toy jar

本文介绍了一个使用Gradle初始化的Java项目的结构及配置文件详解。包括build.gradle中定义的各种依赖项及其作用,以及settings.gradle的基本设置。适用于初学者了解如何通过Gradle快速启动Java项目。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

.
├── build.gradle
├── settings.gradle
└── src
    └── main
        └── java
            └── toy
                └── App.java

build.gradle

/*
 * This 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 Manual available at https://docs.gradle.org/5.4.1/userguide/tutorial_java_projects.html
 */

plugins {
    // Apply the java plugin to add support for Java
    id 'java'

    // Apply the application plugin to add support for building an application
    id 'application'
}

repositories {
    maven {
            url 'http://maven.aliyun.com/nexus/content/groups/public/'
    }
}

dependencies {
    // This dependency is found on compile classpath of this component and consumers.
    compile 'com.google.guava:guava:27.0.1-jre'
    compile 'org.apache.commons:commons-lang3:3.9'
    compile 'org.apache.commons:commons-exec:1.3'
    compile 'javax.xml.bind:jaxb-api:2.3.1'
}


jar {
    manifestContentCharset 'utf-8'
    metadataCharset 'utf-8'
    manifest {
        attributes 'Main-Class': 'toy.App'
    }
    from {
        configurations.compile.collect { it.isDirectory() ? it : zipTree(it) }
    }
}

// Define the main class for the application
mainClassName = 'toy.App'

settings.gradle

/*
 * This file was generated by the Gradle 'init' task.
 *
 * The settings file is used to specify which projects to include in your build.
 *
 * Detailed information about configuring a multi-project build in Gradle can be found
 * in the user manual at https://docs.gradle.org/5.4.1/userguide/multi_project_builds.html
 */

rootProject.name = 'toy'

 

转载于:https://www.cnblogs.com/Searchor/p/11198151.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值