forked from jhipster/jhipster.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdevelopment.html
executable file
·177 lines (158 loc) · 6.81 KB
/
development.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
---
layout: default
title: Using JHipster in development
sitemap:
priority: 0.7
lastmod: 2014-09-17T00:00:00-00:00
---
<h1><i class="fa fa-code"></i> Using JHipster in development</h1>
<i><b>Please check our <a href="{{ site.url }}/video_tutorial.html">video tutorial</a> on creating a new JHipster application!</b></i>
<h2>Configuration</h2>
<p>
By default, JHipster uses the "development" profile, so you don't have to configure anything.
</p>
<p>
If you want more information on the available profiles, please go the section titled "<a href="{{ site.url }}/profiles.html">Profiles</a>".
</p>
<h2>Running the application</h2>
<h3>As a "main" Java class</h3>
<p>
From your IDE, right-click on the "Application" class at the root of your Java package hierarchy, and run it directly. You should also be able to debug it as easily.
</p>
<p>
The application will be available on <a href="http://localhost:8080" target="_blank">http://localhost:8080</a>.
</p>
<h3>As a Maven project</h3>
<p>
You can launch the Java server with Maven:
</p>
<p>
<code>
mvn spring-boot:run
</code>
</p>
<p>
The application will be available on <a href="http://localhost:8080" target="_blank">http://localhost:8080</a>.
</p>
<p>
If you want more information on using Maven, please go to <a href="http://maven.apache.org" target="_blank">http://maven.apache.org</a>
</p>
<h3>(Optional) As a Gradle project</h3>
<p>
If you selected the Gradle option when creating the project, you can launch the Java server with Gradle:
</p>
<p>
<code>
gradle bootRun
</code>
</p>
<p>
The application will be available on <a href="http://localhost:8080" target="_blank">http://localhost:8080</a>.
</p>
<h2>Using the Java server and Grunt together</h2>
<p>
<i>We highly recommend you use this feature, as it allows to have live reloading of your client-side code.</i>
</p>
<p>
You can run Grunt to work on the client-side JavaScript application:
</p>
<p>
<code>
grunt server
</code>
</p>
<p>
This should open up your Web browser, with live reload enabled, on <a href="http://localhost:9000" target="_blank">http://localhost:9000</a>. As soon as you modify one of your HTML/CSS/JavaScript file, your browser should refresh itself automatically.
</p>
<p>
If you have generated your application with the Sass/Compass option, your templates should also be automatically compiled into CSS.
</p>
<p>
This Grunt server has a proxy to the REST endpoints on the Java server which we just launched (on <a href="http://localhost:8080/rest" target="_blank">http://localhost:8080/rest</a>), so it should be able to do live REST requests to the Java back-end.
</p>
<p>
If you want more information on using Grunt, please go to <a href="http://gruntjs.com" target="_blank">http://gruntjs.com</a>.
</p>
<h2>Using Bower to install and update JavaScript dependencies</h2>
<p>
You can use bower normally to update your JavaScript dependencies:
</p>
<p>
<code>
bower update
</code>
</p>
<p>
Or if you want to install a new JavaScript dependency:
</p>
<p>
<code>
bower install <package>
</code>
</p>
<p>
Your JavaScript dependencies will be stored in your <code>src/main/webapp/bower_components</code> folder, and we believe it is a good idea to store them in your Git repository (but JHispter does not force you to do so).
</p>
<p>
If you want more information on using Bower, please go to <a href="http://bower.io" target="_blank">http://bower.io</a>.
</p>
<h2>Using the database</h2>
<h3>(Optional) Using the H2 Database in development</h3>
<p>
If you choose the H2 database (the default option for development with an SQL database), you can access its console at <a href="http://localhost:8080/console" target="_blank">http://localhost:8080/console</a> by default.
</p>
<p>
To connect to the database, select the pre-configured options:
<ul>
<li>Driver Class: org.h2.Driver</li>
<li>JDBC URL: jdbc:h2:mem:jhipster</li>
<li>User name: <blank></li>
<li>Password: <blank></li>
</ul>
</p>
<p>
<img src="images/h2.png"/>
</p>
<h3>Database updates</h3>
<p>
If you add or modify a JPA entity, you will need to update your database schema.
</p>
<p>
JHipster uses <a href="http://www.liquibase.org" target="_blank">Liquibase</a> and stores its configuration in <code>/src/main/resources/config/liquibase/</code>.
<p>
If you use our <a href="{{ site.url }}/creating_an_entity.html">entity sub-generator</a>, a Liquibase "change set" will be automatically
generated in your <code>config/liquibase/changelog/</code> directory. You can edit it, and customize it according to your needs.
</p>
<p>
If you prefer (or need) to do a database update manually, your development process should be:
</p>
<ul>
<li>Add, modify or remove a JPA entity.</li>
<li>Create a new "change set" in your <code>config/liquibase/changelog</code> directory. The files in that directory are prefixed by their creation date (in yyyyMMddHHmmss format), and then have a title describing what they do. For example, <code>20141006152300_added_price_to_product.xml</code> is a good name.</li>
<li>This "change set" file must be referenced it in the <code>config/liquibase/master.xml</code> file.</li>
<li>Start up your application</li>
</ul>
<p>
When you startup your application, Spring Boot will update your database schema automatically using Liquibase.
</p>
<p>
If you want more information on using Liquibase, please go to <a href="http://www.liquibase.org" target="_blank">http://www.liquibase.org</a>.
</p>
<h2>Internationalization</h2>
<p>Internationalization (or i18n) is a first-class citizen in JHipster, as we believe it should be set up at the beginning of your project (and not as an afterthought).</p>
<p>
Usage is really easy thanks to <a href="https://github.com/PascalPrecht/angular-translate" target="_blank">Angular Translate</a>, which provides a simple AngularJS directive for i18n.
</p>
<p>
For example, to add a translation to the "first name" field, just add a "translate" attribute with a key:
<code><label translate="settings.form.firstname">First Name</label></code>
</p>
<p>
This key references a JSON document, which will return the translated String. AngularJS will then replace the "First Name" String with the translated version.
</p>
<p>
For example, here are the translations provided by default in JHipster for <a href="https://github.com/jhipster/generator-jhipster/blob/master/app/templates/src/main/webapp/i18n/_en.json" target="_blank">English</a> and for <a href="https://github.com/jhipster/generator-jhipster/blob/master/app/templates/src/main/webapp/i18n/_fr.json" target="_blank">French</a>.
</p>
<p>
If you speak another language and are ready to help, feel free to send us your own translations!
</p>