-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathcli-tool.html
More file actions
212 lines (190 loc) · 6.88 KB
/
cli-tool.html
File metadata and controls
212 lines (190 loc) · 6.88 KB
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
<!doctype html>
<html lang="en">
<head>
<title>ebeaninit | Getting started | Ebean</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="shortcut icon" href="/images/favicon.ico">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto|Source+Sans+Pro|Ubuntu&display=swap">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.1.0/css/all.css" integrity="sha384-lKuwvrZot6UHsBSfcMvOkWwlCMgc0TaWr+30HWe3a4ltaBwTZhyTEggF5tJv8tbt" crossorigin="anonymous">
<link rel="stylesheet" href="/css/reset3.css">
<link rel="stylesheet" href="/css/site3.css">
<link rel="stylesheet" href="/css/pygments3.css">
</head>
<body>
<div id="main">
<div id="banner">
<header>
<nav id="top">
<h1 id="breadcrumb">
<a class="nav-logo" href="/"><img src="/images/logo-200.png" height="35"></a> <a href="/docs">Documentation</a><span class="sep"> / </span><a href="/docs/getting-started/">Getting started</a><span class="sep"> / </span><span class="last">CLI tool - ebeaninit</span>
</h1>
<ul>
<li> <a href="https://github.com/ebean-orm/website-source/blob/master/docs/getting-started/cli-tool.html"><i class="fab fa-github"></i> edit page</a>
</li>
<li><a onclick="toggleTheme();" title="switch dark light theme"><i class="fas fa-adjust"></i></a></li>
</ul>
</nav>
</header>
</div>
<div class="grid grid-docs">
<aside>
<nav class="side">
<ul>
<li class="nav0 active">
<a class="active" href="/docs/getting-started">Getting started</a>
<ul>
<li class="nav1 ">
<a href="/docs/getting-started/intellij-idea">IntelliJ</a>
</li>
<li class="nav1 ">
<a href="/docs/getting-started/eclipse-ide">Eclipse</a>
</li>
<li class="nav1 ">
<a href="/docs/getting-started/maven">Maven</a>
</li>
<li class="nav1 ">
<a href="/docs/getting-started/gradle">Gradle</a>
</li>
<li class="nav1 ">
<a href="/docs/getting-started/ebean-test">Test setup</a>
</li>
</ul>
</li>
<li class="nav0 ">
<a href="/docs/intro">Introduction</a>
</li>
<li class="nav0 ">
<a href="/docs">Documentation</a>
</li>
<li class="nav0 ">
<a href="/support">Getting help</a>
</li>
<li class="nav0 ">
<a target="_blank" href="/apidoc/13">API Javadoc</a>
</li>
<li class="nav0 ">
<a href="/videos">Videos</a>
</li>
<li class="nav0 ">
<a href="/docs/upgrading">Upgrading</a>
</li>
<li class="nav0 ">
<a href="/docs/deprecated">Deprecated</a>
</li>
<li class="nav0 ">
<a href="/releases">Releases</a>
</li>
</ul>
</nav>
</aside>
<article>
<form action="https://www.google.com/search" method="get" class="inline-form">
<input type="hidden" name="as_sitesearch" value="ebean.io">
<div id="page-search">
<div class="input-group">
<input class="frm" name="q" id="searchinput" type="text" placeholder="Search... (press 's' to focus)" data-placeholder-focus="Search... (use '↑', '↓' and '⏎' to select results)" data-placeholder-blur="Search... (press 's' to focus)" autocomplete="off">
<div class="input-group-btn">
<button class="frm" type="submit"><i class="fas fa-search"></i></button>
</div>
</div>
<div id="page-search-results" style="display: none;">
<ul id="search-results-container" class="search-results"><li class=" active"><a href="/docs" title="Docs"><span style="color:#777;">Docs</span> Documentation </a></li><li class=""><small style="color:#999;">And 101 more...</small></li></ul>
</div>
</div>
</form>
<h2>CLI Tool - ebeaninit</h2>
<p>
Ebean has a CLI tool that we use to: setup a project with configuration
</p>
<ul>
<li>Setup configuration files</li>
<li>Setup dependencies and plugins for Maven and Gradle</li>
<li>Add code to generate DB migrations</li>
<li>Generate Finders for entities</li>
</ul>
<h3>Install Command line tool</h3>
<div class="syntax text"><div class="highlight"><pre><span></span>## Linux install
curl -s https://ebean.io/cli-dist/install | bash
</pre></div>
</div>
<p>
This tool can automatically setup a Maven or Gradle project adding test config files,
dependencies and plugins.
</p>
<p>
If you have trouble with the cli install try the <a href="cli-tool-manualinstall">manual install</a> instructions.
</p>
<h3>Setup project</h3>
<p>
<code>ebeaninit</code> can setup an existing Maven or Gradle project and we are ready
to run the sample CustomerTest.
</p>
<p>
Below shows it being run for a maven project.
</p>
<div class="syntax text"><div class="highlight"><pre><span></span>$ ebeaninit
-------------------------------------------------------------
ebeaninit - interactive ebean initialiser - v1.10
-------------------------------------------------------------
It looks like Ebean is not configured for this project.
Do you want to run project setup to add dependencies and configuration ? [y/n] >
Using Java or Kotlin? [j/k] >
Add dependencies and enhancement plugin to pom? [y/n] >
Add JDBC driver dependency?
0 - No, I'll add it myself
p - Postgres
m - MySql or MariaDB
s - SQL Server
o - Oracle
h - Hana
c - Clickhouse
l - Sqlite
Select an option: [0/p/m/s/o/h/c/l] >
...updated pom.xml adding dependencies and enhancement plugin
Add a sample Entity bean? [y/n] >
Enter a package that will contain the entity beans (e.g. org.myapp.domain) >
...added sample code - BaseModel.java, Customer.java and CustomerTest.java
Add ebean.mf manifest to control enhancement? [y/n] >
Select a package that will contain the entity beans
0 - org.myapp.domain
1 - Other
Select an option: [0/1] >
Select the top level package @Transactional is used
0 - org.example.myapp
1 - Other
2 - None, I don't want to use @Transactional
Select an option: [0/1/2] >
... added ebean.mf
Add application-test.yaml to configure testing? [y/n] >
... added application-test.yaml
Add GenerateDbMigration to generate database migrations? [y/n] >
... added GenerateDbMigration.java
Please re-build the project and then you are all set to go.
You can re-run ebeaninit later to generate finders if you like.
Try running CustomerTest ...
Bye
</pre></div>
</div>
<nav class="next">
<p class="next">
<b>Next:</b>
<a class="btn btn-info" href="maven">Maven</a>
<a class="btn btn-info" href="gradle">Gradle</a>
</p>
</nav>
</article>
</div>
</div>
<script src="https://code.jquery.com/jquery-3.4.1.slim.min.js" integrity="sha384-J6qa4849blE2+poT4WnyKhv5vZF5SrPo0iEjwBvKU7imGFAV0wwj1yYfoRSJoZ+n" crossorigin="anonymous"></script>
<script src="/js/site3.js"></script>
<script src="/js/search3.js"></script>
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-75181644-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-75181644-1');
</script>
</body>
</html>