Skip to content

Instantly share code, notes, and snippets.

@kknd22
Last active August 29, 2015 14:03
Show Gist options
  • Save kknd22/3fdfa3c45a2cf7e93a0c to your computer and use it in GitHub Desktop.
Save kknd22/3fdfa3c45a2cf7e93a0c to your computer and use it in GitHub Desktop.
gradle javaExec task
/*
* This build file was auto generated by running the Gradle 'init' task
* by 'chris' at '7/4/14 3:35 PM' with Gradle 1.9
*
* This generated file contains a commented-out 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 http://gradle.org/docs/1.9/userguide/tutorial_java_projects.html
*/
// Apply the java plugin to add support for Java
apply plugin: 'java'
// In this section you declare where to find the dependencies of your project
repositories {
// Use 'maven central' for resolving your dependencies.
// You can declare any Maven/Ivy/file repository here.
mavenCentral()
}
// In this section you declare the dependencies for your production and test code
dependencies {
// The production code uses the SLF4J logging API at compile time
compile 'org.slf4j:slf4j-api:1.7.5'
compile 'org.springframework:spring-core:4.0.3.RELEASE'
// Declare the dependency for your favourite test framework you want to use in your tests.
// TestNG is also supported by the Gradle Test task. Just change the
// testCompile dependency to testCompile 'org.testng:testng:6.8.1' and add
// 'test.useTestNG()' to your build script.
testCompile "junit:junit:4.11"
}
task runit( type : JavaExec, dependsOn: classes) {
main 'me.Me'
classpath sourceSets.main.output
classpath configurations.runtime
//classpath sourceSets.main.runtimeClasspath
args 'the-args'
jvmArgs '-Da=aValue', '-Db=2'
}
task t() << {
def a = configurations.compile
def a2 = configurations.compile.asPath
def b = sourceSets.main.runtimeClasspath
println("configurations.compile: ${ configurations.compile}")
println("configurations.compile.asPath: ${ configurations.compile.asPath}")
println("sourceSets.main.runtimeClasspath: ${sourceSets.main.runtimeClasspath}")
}
package me;
import java.util.Enumeration;
import java.util.Properties;
/**
* Created with IntelliJ IDEA.
* User: chris
* Date: 7/4/14
* Time: 3:54 PM
* To change this template use File | Settings | File Templates.
*/
public class Me {
public static void main(String[] args) {
//System.getProperties().list(System.out);
Properties p = System.getProperties();
Enumeration keys = p.keys();
while (keys.hasMoreElements()) {
String key = (String)keys.nextElement();
String value = (String)p.get(key);
System.out.println(key + ": " + value);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment