exp 33333333
mvn archetype:generate -DgroupId=com.example -DartifactId=HelloMaven -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false
gradle init
tree
gedit build.gradle
/*
* This file was generated by the Gradle 'init' task.
* Modified for Experiment 4 to enable 'gradle run' for an application.
*/
plugins {
// Use the application plugin to add support for building and running a Java application
id 'application'
id 'java-library'
id 'maven-publish'
}
repositories {
mavenLocal()
maven {
url = uri('https://repo.maven.apache.org/maven2/')
}
}
dependencies {
// Use JUnit 4 for testing.
testImplementation libs.junit.junit
// Add any other dependencies from your pom.xml here if needed
// Example: implementation 'com.otherlibrary:other-library:1.0'
}
group = 'com.example'
version = '1.0-SNAPSHOT'
description = 'HelloMaven'
java.sourceCompatibility = JavaVersion.VERSION_1_8 // Or a higher version if needed
// Define the main class for the application.
// This is required by the 'application' plugin to run the application.
application {
mainClass = 'com.example.App' // Make sure this matches the package and class name of your App.java
}
// The publishing block is for publishing the library - not needed for 'gradle run'
// Keep or remove based on your project's full requirements.
publishing {
publications {
maven(MavenPublication) {
from(components.java)
}
}
}
// You can add other tasks or configurations here as needed
gradle build
gradle run
Comments
Post a Comment