This repository has been archived by the owner on Dec 16, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tell-me-more.html
268 lines (233 loc) · 16.1 KB
/
tell-me-more.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<title>tell me more</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="A powerfull pure Java build and automation tool">
<meta name="author" content="Jerome Angibaud">
<meta name="keywords" content="build,java,tool,automation,maven,ant,gradle,buildr,sbt,make,compiler,tester,jacoco,pure java build tool,java build tool,build tool,100% java build tool">
<meta name="generator" content="JBake">
<!-- Le styles -->
<link href="css/bootstrap.css" rel="stylesheet">
<!-- <link href="css/bootstrap.min.css" rel="stylesheet"> -->
<link href="css/asciidoctor.css" rel="stylesheet">
<link href="css/base.css" rel="stylesheet">
<link href="css/prettify.css" rel="stylesheet">
<link href="css/jerkar.css" rel="stylesheet">
<!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
<!--[if lt IE 9]>
<script src="js/html5shiv.min.js"></script>
<![endif]-->
<!-- Fav and touch icons -->
<!--<link rel="apple-touch-icon-precomposed" sizes="144x144" href="../assets/ico/apple-touch-icon-144-precomposed.png">
<link rel="apple-touch-icon-precomposed" sizes="114x114" href="../assets/ico/apple-touch-icon-114-precomposed.png">
<link rel="apple-touch-icon-precomposed" sizes="72x72" href="../assets/ico/apple-touch-icon-72-precomposed.png">
<link rel="apple-touch-icon-precomposed" href="../assets/ico/apple-touch-icon-57-precomposed.png">-->
<link rel="shortcut icon" href="favicon.ico">
<!-- highlight.js -->
<script src="js/highlight.pack.js"></script>
<script>hljs.initHighlightingOnLoad();</script>
<link rel="stylesheet" href="css/highlight-idea.css">
<!-- sidebar css -->
<link href="css/sidebar.css" rel="stylesheet">
</head>
<body onload="prettyPrint()">
<div id="wrap">
<!-- Fixed navbar -->
<div class="navbar navbar-default navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand">
<img style="max-width:80px;margin-top: -10px;" src="img/logo/PNG-04.png">
</a>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li><a href="index.html">Home</a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Documentation<b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="https://github.com/jerkar/jerkar/blob/master/org.jerkar.core/src/main/doc/Getting%20Started.md">Getting Started</a></li>
<li><a href="https://github.com/jerkar/jerkar/tree/master/org.jerkar.core/src/main/doc/Reference%20Guide">Reference Guide</a></li>
<li><a href="doc/reference.html">Reference Guide (Single Page)</a></li>
<li><a href="https://github.com/jerkar/jerkar-examples">Examples</a></li>
<li><a href="https://github.com/jerkar/jerkar/blob/master/org.jerkar.core/src/main/doc/FAQ.md">Frequently Asked Questions</a></li>
<li><a href="javadoc/index.html">Javadoc</a></li>
</ul>
</li>
<li><a href="about.html">About</a></li>
</ul>
</div>
</div>
</div>
<div class="container">
<p>
<h2>What is it ?</h2><p><strong>Jerkar</strong> is a Java build tool ala <strong><em>Gradle</em></strong>, <strong><em>Ant/Ivy</em></strong> or <strong><em>Maven</em></strong>. It differs from the others in that it requires <strong>pure Java code</strong> instead of XML files or dynamic language scripts to describe builds.</p><h2>Into the box</h2>
<ul>
<li>Complete Java build tool : Java compilation, resources processing, test execution/reporting, jar/war packaging</li>
<li>Powerful dependency management fully compliant with <em>Maven</em> and <em>Ivy</em></li>
<li>Powerful multi-project support</li>
<li>Plugable architecture with builtin plugins for <em>Eclipse</em>, <em>IntelliJ</em>, <em>Jacoco</em> and <em>SonarQube</em></li>
<li>Multi-techno support for building projects embedding any other technology than Java.</li>
<li>Swiss-knife library for performing all kind of build related stuff as file and I/O manipulation, logging, PGP signing, external tool launcher, ...</li>
<li>Multi-level configuration to fit in enterprise environment</li>
<li>Hierarchical logs</li>
<li>Ability to rely on convention only (no build script needed at all)</li>
<li>Facility to migrate <em>Maven</em> projects</li>
<li>Scaffolding feature for creating projects from scratch</li>
</ul><p>Also as an <strong>automation tool</strong> Jerkar provides :</p>
<ul>
<li>The ability to treat Java sources as scripts : Java sources are <strong>compiled on-the-fly</strong> prior to be instantiated then method invoked</li>
<li><strong>full dependency handling</strong> to compile scripts : script dependencies can be made on Maven repositories, local jars or external projects</li>
</ul><h2>Motivation</h2><p>As a <strong>Java developer</strong> you may have already been frustrated of not being able to write your build scripts with your favorite language and, moreover, with the <strong>same language as the project to build</strong>.<br/>Indeed most of mainstream and JVM languages have first class build tool where definitions are expressed using the language itself : <strong>Gradle</strong> for <strong>Groovy</strong>, <strong>Nodejs</strong> based tools for <strong>Javascript</strong>, <strong>SBT</strong> for <strong>Scala</strong>, <strong>PyBuilder</strong> for <strong>Python</strong>, <strong>Rake</strong> for <strong>Ruby</strong>, <strong>Leiningen</strong> for <strong>Clojure</strong>, <strong>Kobalt</strong> for <strong>Kotlin</strong> ...</p><p><strong>Jerkar</strong> purposes to fill the gap by providing a <strong>full-featured build tool</strong> allowing Java developers to build their projects by just writing <strong>regular Java classes</strong> as they are so familiar with. </p><h3>Benefits</h3><p>As said, with Jerkar, build definitions are <strong>plain old java classes</strong>. This bare metal approach brings concrete benefits :</p>
<ul>
<li>for Java developers, it's <strong>trivial to add logic</strong> in build scripts</li>
<li>when editing build definition, Java developers leverage of <strong>compilation</strong>, <strong>code-completion</strong> and <strong>debug</strong> facilities provided by their <strong>IDE</strong></li>
<li>Java developers have <strong>no extra language</strong> or <strong>XML soup</strong> to master</li>
<li>build definitions can be <strong>launched/debugged</strong> directly from the IDE as any class providing a Main method</li>
<li>the tool is quite <strong>simple and fast</strong> : in essence, Jerkar engine simply performs direct method invocations on build classes. <strong>No black box</strong> : it's quite easy to discover what the build is actually doing under the hood. <strong>Jerkar source code and javadoc</strong> are a primary source of documentation.</li>
<li>scripts can directly leverage of any Java <strong>3rd party libraries</strong> without needing to wrap it in a plugin or a specific component</li>
<li>it's straightforward to <strong>extend</strong></li>
<li><strong>refactoring</strong> build definition is easy and safe (thanks to statically typed nature of Java)</li>
<li>build scripts leverage the regular Java mechanisms (Inheritance, composition, jar module dependency) to <strong>re-use build elements</strong> or share settings</li>
</ul><h2>How does it look like ?</h2><p>All related Jerkar files lies within the project to build, under 'jerkar' diectory.</p>
<pre><code>myproject
+ jerkar
+ def <----- Java code that build your project goes here (this should be identifed as a java source folder in your IDE)
+ Build.java
+ output <---- Build artifacts are generated here
+ src <---- Sources of the project to build according build class defined below.
...
</code></pre><p><br/>The following <em>Build.java</em> mimics a Ant file defining various Jave build tasks. Every public no-args void methods is callable from the command line.<br/>Moreover, public fields value can be set from command line.<br/>For instance : <code>jerkar clean compile test -forkTest=true</code> will inject <code>true</code> value to <em>forkTest</em> field then invoke <em>clean</em>, <em>compile</em> and <em>test</em> methods. </p>
<pre><code class="java">@JkImport("commons-httpclient:commons-httpclient:3.1") // Import HttpClient and its deps for usage in this script
class Build extends JkRun {
@JkDoc("Run test in a forked process if true.")
public boolean forkTest;
private JkPathTree src = getBaseTree().goTo("src");
private Path classDir = getOutputDir().resolve("classes");
private Path jarFile = getOutputDir().resolve("capitalizer.jar");
private Path testSrc = getBaseDir().resolve("test");
private Path testClassDir = getOutputDir().resolve("test-classes");
private Path reportDir = getOutputDir().resolve("junitRreport");
private JkClasspath classpath;
private JkClasspath testClasspath;
Build() { // Here, classpath is made of local jars + jars hosted in Maven Central
JkResolveResult deps = JkDependencyResolver.of(JkRepo.ofMavenCentral()).resolve(JkDependencySet.of()
.and("org.hibernate:hibernate-entitymanager:5.4.2.Final")
.and("com.h2database:h2:1.4.199"));
List<Path> localJars = getBaseTree().andMatching("libs/compile/*.jar").getFiles();
classpath = JkClasspath.of(localJars).and(deps.getFiles());
testClasspath = classpath.and(getBaseTree().andMatching("libs/test/*.jar").getFiles());
}
public void runDefault() {
clean(); compile(); test(); jar();
}
public void compile() {
JkJavaCompiler.ofJdk().compile(
JkJavaCompileSpec.of()
.setClasspath(classpath)
.addSources(src)
.setOutputDir(classDir));
src.andMatching(false,"**/*.java").copyTo(classDir); /// copy resources
}
@JkDoc("Create jar file on already compiled classes.")
public void jar() {
JkManifest.ofEmpty().addMainClass("org.jerkar.samples.RunClass").writeToStandardLocation(classDir);
JkPathTree.of(classDir).zipTo(jarFile);
}
private void compileTest() {
JkJavaCompiler.ofJdk().compile(
JkJavaCompileSpec.of()
.setClasspath(testClasspath)
.addSources(testSrc)
.setOutputDir(testClassDir));
src.andMatching(false,"**/*.java").copyTo(testClassDir); /// copy test resources
}
public void test() {
compileTest();
JkUnit.of()
.withReportDir(reportDir).withReport(JunitReportDetail.FULL)
.withForking(forkTest)
.run(testClasspath.and(classDir), JkPathTree.of(testClassDir));
}
@JkDoc("Performs some http client tasks")
public void seleniumLoadTest() throws IOException {
HttpClient client = new HttpClient();
GetMethod getMethod = new GetMethod("http://my.url");
client.executeMethod(getMethod);
// ....
}
public static void main(String[] args) {
JkInit.instanceOf(TaskBuild.class, args).runDefault();
}
}
</code></pre><p><br/>The example below shows how Java plugin helps to build Java project with minimal typing. This plugin simply exposes a pre-configured <code>JkJavaProject</code> instance that you can reshape.<br/>Executing <code>jerkar java#pack java#publish</code> invokes <em>pack</em> and <em>publish</em> methods on the Java plugin. This leads in compilation, test compilation, test executions, packaging jars and publish artifacts to default Maven repositoy.</p>
<pre><code class="java">class JavaPluginBuild extends JkRun {
final JkPluginJava javaPlugin = getPlugin(JkPluginJava.class);
@Override
protected void setup() {
JkJavaProject project = javaPlugin.getProject();
project.setVersionedModule("org.jerkar:examples-java-template", "1.0-SNAPSHOT");
project.getCompileSpec().setSourceAndTargetVersion(JkJavaVersion.V8);
project.addDependencies(JkDependencySet.of()
.and("com.google.guava:guava:18.0")
.and("junit:junit:4.12", TEST)
);
}
public static void main(String[] args) {
JkInit.instanceOf(ClassicBuild.class, args).javaPlugin.clean().pack();
}
}
</code></pre><p><br/>Jerkar also allows to activate plugins on the fly without explicitly instantiating it in the build class :<br/><code>jerkar sonar# jacoco# java#pack</code> processes test coverage along SonarQube analysis prior publishing artifacts. </p><h2>Multi-techno projects</h2><p>Beside <strong>building Java projects</strong>, Jerkar can be used for <strong>any automation purpose</strong>, for example, <a href="https://github.com/jerkar/jerkar.github.io/blob/master/_jbake-site-sources/build/def/jerkar/github/io/SiteBuild.java">Jerkar is used</a> to generate this site.</p><p>For building <strong>multi-techno</strong> projects embedding other technologies than java, we suggest the following approach : </p>
<ul>
<li>Each <strong>sub-project</strong> builds using its <strong>own 'native' tool</strong> (e.g. <em>nodejs/Webpack</em> for web-client, <em>Jerkar</em> for java server and <em>Haskell Cabal</em> for <em>Haskell</em> modules)</li>
<li><strong>Jerkar</strong> performs the <strong>master build</strong> by <strong>orchestrating sub-builds</strong> and glues all together to pack the whole distribution.</li>
</ul><h2>Library</h2><p>Jerkar can also be <strong>embedded</strong> in your product as a simple jar library, to leverage directly the fluent API for manipulating files, launch external tools or other. It is available on <a href="http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22org.jerkar%22%20AND%20a%3A%22core%22">Maven Central</a>. </p><p>Icing on the cake : Jerkar has <strong>zero dependency</strong>.</p>
</p>
<hr />
</div>
<div id="push"></div>
</div>
<div id="footer">
<div class="container">
<p class="muted credit">© 2014 | Mixed with <a href="http://getbootstrap.com/">Bootstrap v3.1.1</a> | Baked with <a href="http://jbake.org">JBake v2.3.2</a></p>
</div>
</div>
<!-- javascript =========================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="js/jquery-1.11.1.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/prettify.js"></script>
<script>
lastSelect = null;
$('.liexpandable').click(function(evt) {
var li = $(evt.target).parents("li").first();
var ul = li.find(".sub-menu").first();
console.log(ul.is(':visible'));
evt.stopPropagation();
if (ul.is(':visible') && li.html() !== lastSelect) {
lastSelect = li.html();
return;
}
lastSelect = li.html();
ul.toggle();
});
</script>
<!-- Google Analytics -->
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-103449580-1', 'auto');
ga('send', 'pageview');
</script>
</body>
</html>