Skip to content

Czooi/Gradle1

Repository files navigation

/*

  • This file was generated by the Gradle 'init' task.
  • This is a general purpose Gradle build.
  • Learn more about Gradle by exploring our samples at https://docs.gradle.org/7.6.1/samples */

plugins { id 'java' }

group 'com.example' version '1.0-SNAPSHOT'

repositories { mavenCentral() }

dependencies { // Add JUnit dependency for testing testImplementation 'junit:junit:4.13.2' }

// Define a task to Run a Test task RunTest(type: Test) { // Specify the directory containing test classes testClassesDirs = sourceSets.test.output.classesDirs

// Optionally configure test options
testLogging {
    // Configure which events to log during test execution
    events 'passed', 'skipped', 'failed'
}

}

// Define a task to build an executable JAR file task BuildJar(type: Jar) { manifest { attributes 'Main-Class': 'com.example.Main' // Set the main class for the JAR }

from sourceSets.main.output // Include compiled classes in the JAR
archiveBaseName = 'my-application' // Name of the JAR file
destinationDirectory = file('build/libs') // Output directory for the JAR file

}

// Task to copy resource files to a specific directory task copyResources(type: Copy) { from 'src/main/resources' into 'build/resources/main' }

// Task to create a zip archive of the project task createZip(type: Zip) { from 'build' archiveFileName = 'project-name.zip' destinationDirectory = file('build/distributions') }

// Task push build folder to GitHub task pushToGitHub(type: Exec) { workingDir 'build' // Initialize git commandLine 'git', 'init' exec() // Add all files commandLine 'git', 'add', '.' exec() // Commit the changes commandLine 'git', 'commit', '-m', 'Automated deployment' exec() // Set the branch name commandLine 'git', 'branch', '-M', 'main' exec() // Add the remote repository commandLine 'git', 'remote', 'add', 'origin','https://github.com/Czooi/Gradle1.git' exec() // Push to the remote repository commandLine 'git', 'push', '-u', 'origin', 'main' exec() }

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published