Skip to content
This repository has been archived by the owner on Jul 26, 2019. It is now read-only.

Add a gradle task for building the project into a jar file #161

Open
damithc opened this issue Oct 27, 2018 · 0 comments
Open

Add a gradle task for building the project into a jar file #161

damithc opened this issue Oct 27, 2018 · 0 comments

Comments

@damithc
Copy link
Contributor

damithc commented Oct 27, 2018

Some students use AB-3 as the basis for their project. They need a gradle task to build their product as a jar file.

Fix suggested by @pyokagan

diff --git a/build.gradle b/build.gradle
index 0a42902..255ef06 100644
--- a/build.gradle
+++ b/build.gradle
@@ -7,8 +7,13 @@ import org.gradle.api.tasks.testing.logging.TestLogEvent
 plugins {
     id 'java'
     id 'org.asciidoctor.convert' version '1.5.6'
+    id 'com.github.johnrengelman.shadow' version '2.0.3'
+    id 'application'
 }

+// Specifies the entry point of the application
+mainClassName = 'seedu.addressbook.Main'
+
 sourceCompatibility = JavaVersion.VERSION_1_9
 targetCompatibility = JavaVersion.VERSION_1_9

@@ -41,6 +46,12 @@ dependencies {
     testImplementation group: 'junit', name: 'junit', version: '4.12'
 }

+shadowJar {
+    archiveName = 'addressbook.jar'
+
+    destinationDir = file("${buildDir}/jar/")
+}
+
 task wrapper(type: Wrapper) {
     gradleVersion = '4.8.1'
 }
yingrong1996 pushed a commit to yingrong1996/addressbook-level3 that referenced this issue Apr 14, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant