Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 37 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,39 @@
language: java
# the following will skip the installation of dependencies.
install: true

script: ./gradlew build
# the following forces the use of JDK 8
# adding comment to kick off build
# matrix:
# include:
# - jdk: oraclejdk8

script:
- gradle clean build
- gradle dist --rerun-tasks
# - gradle distSetup --rerun-tasks
# - gradle zipDist --rerun-tasks
# - gradle zipTest --rerun-tasks

before_deploy:
- git config --global user.email "[email protected]"
- git config --global user.name "Travis CI"
- export GIT_TAG=$TRAVIS_BRANCH.$48
- git tag $GIT_TAG -a -m "Generated tag from TravisCI for build $48"
- git push -q https://[email protected]/drlehr/java-hello-world-with-gradle --tags
- ls -R

deploy:
skip_cleanup: true
provider: releases
api_key:
secure: $GITPERM

file:
- "README.md"
- "build.gradle"
- ".travis.yml"

on:
tags: false
all_branches: true
79 changes: 52 additions & 27 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,7 @@
* user guide available at https://docs.gradle.org/2.8/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 'jcenter' for resolving your dependencies.
// You can declare any Maven/Ivy/file repository here.
jcenter()
}

// 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.12'

// 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.12'
}
*/

apply plugin: 'java'
apply plugin: 'eclipse'
Expand All @@ -51,17 +29,64 @@ jar {
// end::jar[]

// tag::dependencies[]
sourceCompatibility = 1.7
targetCompatibility = 1.7
sourceCompatibility = 1.8
targetCompatibility = 1.8

dependencies {
compile "joda-time:joda-time:2.2"
testCompile "junit:junit:4.12"
testCompile "org.junit.jupiter:junit-jupiter-api:5.0.1"
// the following is a work around to fix the warning:
// warning: unknown enum constant Status.STABLE
testCompileOnly "org.apiguardian:apiguardian-api:1.0.0"
}
// end::dependencies[]


task dist {
description "Generate the dist(s) into the dist folder."
}

task distSetup {
description "Generate the dist folder."
delete "${projectDir}/dist"
copy {
from "${buildDir}/libs"
into "${projectDir}/dist/main"
}
copy {
from "${projectDir}/build/classes/test/Output"
into "${projectDir}/dist/test"
}
}

task zipDist(type: Zip, dependsOn: distSetup) {
from "${projectDir}/dist/main"
from "${projectDir}/Readme.md"
destinationDir = file("${projectDir}/dist")
version = "${version}"
appendix = "Main"
doLast {
println "Created ${zipDist.archiveName}"
}
}

task zipTest(type: Zip, dependsOn: distSetup) {
from "${projectDir}/dist/test"
from "${projectDir}/Readme.md"
destinationDir = file("${projectDir}/dist")
version = "${version}"
appendix = "Test Output"
doLast{
println "Created ${zipTest.archiveName}"
}
}

distSetup.dependsOn(build)

dist.dependsOn(zipDist)
dist.dependsOn(zipTest)
// tag::wrapper[]
task wrapper(type: Wrapper) {
wrapper {
gradleVersion = '3.5'
}
// end::wrapper[]
// end::wrapper[]
Binary file added build/classes/java/main/hello/Greeter.class
Binary file not shown.
Binary file added build/classes/java/main/hello/HelloWorld.class
Binary file not shown.
Binary file added build/classes/java/test/hello/TestGreeter.class
Binary file not shown.
Binary file added build/distributions/HelloWorld.tar
Binary file not shown.
Binary file added build/distributions/HelloWorld.zip
Binary file not shown.
Binary file added build/libs/jb-hello-world-0.1.0.jar
Binary file not shown.
161 changes: 161 additions & 0 deletions build/reports/tests/test/classes/hello.TestGreeter.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta http-equiv="x-ua-compatible" content="IE=edge"/>
<title>Test results - Class hello.TestGreeter</title>
<link href="../css/base-style.css" rel="stylesheet" type="text/css"/>
<link href="../css/style.css" rel="stylesheet" type="text/css"/>
<script src="../js/report.js" type="text/javascript"></script>
</head>
<body>
<div id="content">
<h1>Class hello.TestGreeter</h1>
<div class="breadcrumbs">
<a href="../index.html">all</a> &gt;
<a href="../packages/hello.html">hello</a> &gt; TestGreeter</div>
<div id="summary">
<table>
<tr>
<td>
<div class="summaryGroup">
<table>
<tr>
<td>
<div class="infoBox" id="tests">
<div class="counter">1</div>
<p>tests</p>
</div>
</td>
<td>
<div class="infoBox" id="failures">
<div class="counter">1</div>
<p>failures</p>
</div>
</td>
<td>
<div class="infoBox" id="ignored">
<div class="counter">0</div>
<p>ignored</p>
</div>
</td>
<td>
<div class="infoBox" id="duration">
<div class="counter">0.002s</div>
<p>duration</p>
</div>
</td>
</tr>
</table>
</div>
</td>
<td>
<div class="infoBox failures" id="successRate">
<div class="percent">0%</div>
<p>successful</p>
</div>
</td>
</tr>
</table>
</div>
<div id="tabs">
<ul class="tabLinks">
<li>
<a href="#tab0">Failed tests</a>
</li>
<li>
<a href="#tab1">Tests</a>
</li>
</ul>
<div id="tab0" class="tab">
<h2>Failed tests</h2>
<div class="test">
<a name="newtestJGGreeterFail"></a>
<h3 class="failures">newtestJGGreeterFail</h3>
<span class="code">
<pre>org.junit.ComparisonFailure: expected:&lt;[racecar]&gt; but was:&lt;[carrace]&gt;
at org.junit.Assert.assertEquals(Assert.java:115)
at org.junit.Assert.assertEquals(Assert.java:144)
at hello.TestGreeter.newtestJGGreeterFail(TestGreeter.java:47)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.runTestClass(JUnitTestClassExecutor.java:110)
at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.execute(JUnitTestClassExecutor.java:58)
at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.execute(JUnitTestClassExecutor.java:38)
at org.gradle.api.internal.tasks.testing.junit.AbstractJUnitTestClassProcessor.processTestClass(AbstractJUnitTestClassProcessor.java:62)
at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.processTestClass(SuiteTestClassProcessor.java:51)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
at org.gradle.internal.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:32)
at org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93)
at com.sun.proxy.$Proxy2.processTestClass(Unknown Source)
at org.gradle.api.internal.tasks.testing.worker.TestWorker.processTestClass(TestWorker.java:118)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
at org.gradle.internal.remote.internal.hub.MessageHubBackedObjectConnection$DispatchWrapper.dispatch(MessageHubBackedObjectConnection.java:175)
at org.gradle.internal.remote.internal.hub.MessageHubBackedObjectConnection$DispatchWrapper.dispatch(MessageHubBackedObjectConnection.java:157)
at org.gradle.internal.remote.internal.hub.MessageHub$Handler.run(MessageHub.java:404)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1135)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
at java.base/java.lang.Thread.run(Thread.java:844)
</pre>
</span>
</div>
</div>
<div id="tab1" class="tab">
<h2>Tests</h2>
<table>
<thead>
<tr>
<th>Test</th>
<th>Duration</th>
<th>Result</th>
</tr>
</thead>
<tr>
<td class="failures">newtestJGGreeterFail</td>
<td class="failures">0.002s</td>
<td class="failures">failed</td>
</tr>
</table>
</div>
</div>
<div id="footer">
<p>
<div>
<label class="hidden" id="label-for-line-wrapping-toggle" for="line-wrapping-toggle">Wrap lines
<input id="line-wrapping-toggle" type="checkbox" autocomplete="off"/>
</label>
</div>Generated by
<a href="http://www.gradle.org">Gradle 5.3.1</a> at Apr 16, 2019, 7:35:53 PM</p>
</div>
</div>
</body>
</html>
Loading