Skip to content

Commit f186903

Browse files
authored
Reorganize Maven workflow documentation (#4011)
1 parent 6ccd7db commit f186903

40 files changed

+120
-304
lines changed

docs/TODO.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
## Tooling & Build Flow Modernization
1111

1212
- [ ] Rewrite `Working-With-CodenameOne-Sources.asciidoc` around the Maven multi-module build in `/maven`, including local test commands, dependency management tips, and how our GitHub Actions replace the old Ant targets for CI.【F:docs/developer-guide/Working-With-CodenameOne-Sources.asciidoc†L1-L85】【F:maven/README.adoc†L1-L68】
13+
- [ ] Rework `Working-With-CodenameOne-Sources.asciidoc` to fold in the Maven project workflow guidance now embedded in the developer guide and eliminate duplicated setup steps between the chapters.【F:docs/developer-guide/Working-With-CodenameOne-Sources.asciidoc†L1-L85】【F:docs/developer-guide/Maven-Project-Workflow.asciidoc†L1-L14】
1314
- [ ] Retire or substantially revise `Travis-CI-Integration.asciidoc` to highlight our current CI guidance (GitHub Actions templates, self-hosted options) and archive Travis-specific screenshots and steps.【F:docs/developer-guide/Travis-CI-Integration.asciidoc†L1-L112】
1415
- [ ] Update the Designer/tooling coverage in `basics.asciidoc` so it walks through launching the modern Designer distribution from Maven projects without relying on `designer_1.jar` shell commands.【F:docs/developer-guide/basics.asciidoc†L1050-L1070】
1516
- [ ] Rebuild `Working-With-The-GUI-Builder.asciidoc` around the current GUI Builder experience (with Java 11+ support, IntelliJ/VScode integration), moving legacy troubleshooting for `guibuilder_1.jar` into an appendix or "legacy" callout.【F:docs/developer-guide/Working-With-The-GUI-Builder.asciidoc†L1-L126】

docs/developer-guide/Advanced-Topics-Under-The-Hood.asciidoc

Lines changed: 1 addition & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,6 @@ Here is the current list of supported arguments, notice that build hints are add
2828
|android.installLocation
2929
|Maps to android:installLocation manifest entry defaults to auto. Can also be set to internalOnly or preferExternal.
3030

31-
|android.gradle
32-
|Deprecated, this mode is no longer supported. true/false defaults to false prior to 3.3 and true after. Uses Gradle instead of Ant to build the Android app
33-
3431
|android.xapplication
3532
|defaults to an empty string. Allows developers of native Android code to add text within the application block to define things such as widgets, services etc.
3633

@@ -88,7 +85,7 @@ Here is the current list of supported arguments, notice that build hints are add
8885
|*Deprecated, please android.playService.+++*+++!* Indicates whether Goolge Play Services should be included into the build, defaults to false but that might change based on the functionality of the application and other build hints. Adding Google Play Services support allows us to use a more refined location implementation and invoke some Google specific functionality from native code.
8986

9087
|android.playService.plus, android.playService.auth, android.playService.base, android.playService.identity, android.playService.indexing, android.playService.appInvite, android.playService.analytics, android.playService.cast, android.playService.gcm, android.playService.drive, android.playService.fitness, android.playService.location, android.playService.maps, android.playService.ads, android.playService.vision, android.playService.nearby, android.playService.panorama, android.playService.games, android.playService.safetynet, android.playService.wallet, android.playService.wearable
91-
|Allows including only a specific play services library portion. Notice that this setting conflicts with the deprecated `android.includeGPlayServices` and only works with the gradle build (which is on by default but can be toggled using `android.gradle`). +
88+
|Allows including only a specific play services library portion. Notice that this setting conflicts with the deprecated `android.includeGPlayServices` and only works with the Gradle-based Android build pipeline. +
9289

9390
If none of the services are defined to true then plus, auth, base, analytics, gcm, location, maps & ads will be set to true. If one or more of the `android.playService` entries are defined to something then all entries will default to false.
9491

@@ -2156,43 +2153,6 @@ In the drop target you can override the following methods:
21562153

21572154

21582155

2159-
=== Continuous Integration & Release Engineering
2160-
2161-
Codename One was essentially built for continuous integration since the build servers are effectively a building block for such an architecture. However, there are several problems with that: the first of which is limited server capacity.
2162-
2163-
If all users would start sending builds with every commit the servers would instantly become unusable due to the heavy load. To circumvent this CI support is limited only on the Enterprise level which allows Codename One to stock more servers and cope with the rise in demand related to the feature.
2164-
2165-
To integrate with any CI solution just use the standard Ant targets such as `build-for-android-device`, `build-for-iphone-device` etc.
2166-
2167-
Normally, this would be a problem since the build is sent but since it isn't blocking you wouldn't get the build result and wouldn't be able to determine if the build passed or failed. To enable this just edit the build XML and add the attribute `automated="true"` to the codeNameOne tag in the appropriate
2168-
targets.
2169-
2170-
This will deliver a `result.zip` file under the `dist` folder containing the binaries of a successful build. It will
2171-
also block until the build is completed. This should be pretty easy to integrate with any CI system together with
2172-
our automated testing solutions .
2173-
2174-
E.g. we can do a synchronous build like this:
2175-
2176-
[source,xml]
2177-
----
2178-
<target name="build-for-javascript-sync" depends="clean,copy-javascript-override,copy-libs,jar,clean-override">
2179-
<codeNameOne
2180-
jarFile="${dist.jar}"
2181-
displayName="${codename1.displayName}"
2182-
packageName = "${codename1.packageName}"
2183-
mainClassName = "${codename1.mainName}"
2184-
version="${codename1.version}"
2185-
icon="${codename1.icon}"
2186-
vendor="${codename1.vendor}"
2187-
subtitle="${codename1.secondaryTitle}"
2188-
automated="true"
2189-
targetType="javascript"
2190-
/>
2191-
</target>
2192-
----
2193-
2194-
This allows us to build a JavaScript version of the app automatically as part of a release build script.
2195-
21962156
=== Android Lollipop ActionBar Customization
21972157

21982158
When running on Android Lollipop (5.0 or newer) the native action bar will use the Lollipop design. This isn't applicable

docs/developer-guide/Index.asciidoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,13 +248,13 @@ Import the generated Maven project into your preferred IDE and use the Codename
248248
* *Eclipse* – use *File > Import > Existing Maven Projects*, then use the Codename One launch shortcuts provided by the plugin for simulator and build tasks.
249249
* *Command line* – invoke Maven goals directly whenever you need to integrate with CI/CD pipelines or scripting.
250250

251-
For deeper coverage of the Maven goals and project structure, see the https://shannah.github.io/codenameone-maven-manual/[Codename One Maven Manual].
251+
For deeper coverage of the Maven goals, project structure, and automation tasks, continue with <<maven-project-workflow>>.
252252

253253
NOTE: Arbitrary Maven dependencies probably won't work for Codename One. Many dependencies assume a full JDK which Codename One can't provide and they often assume functionality that might not be available e.g. reflection, Spring, etc.
254254

255255
.Legacy onboarding resources
256256
****
257-
The retired Ant-based IDE plugins for NetBeans, Eclipse and IntelliJ IDEA – together with the simulator screenshots from those workflows – are still available in the legacy documentation for teams maintaining older projects. New projects should follow the Maven-based instructions above.
257+
Legacy Ant-based project instructions remain available for teams maintaining older codebases. New projects should follow the Maven workflows described in this guide.
258258
****
259259

260260
==== Important Notes for New Projects

docs/developer-guide/codenameone-maven-manual/appendix_api.adoc renamed to docs/developer-guide/Maven-Appendix-API.adoc

File renamed without changes.

docs/developer-guide/codenameone-maven-manual/appendix_archetypes.adoc renamed to docs/developer-guide/Maven-Appendix-Archetypes.adoc

File renamed without changes.

docs/developer-guide/codenameone-maven-manual/appendix_control_center.adoc renamed to docs/developer-guide/Maven-Appendix-Control-Center.adoc

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@ The Codename One Settings app (aka Codename One Preferences, aka Control Center)
88
=== Opening Codename One Settings
99

1010
==== Opening Codename One Settings from Command-line
11-
++++
12-
<env cli ></env>
13-
++++
1411

1512
Use the `run.sh` (or run.bat, if on Windows) to open Codename One settings:
1613

@@ -20,36 +17,27 @@ Use the `run.sh` (or run.bat, if on Windows) to open Codename One settings:
2017
----
2118

2219
==== Opening Codename One Settings from IntelliJ
23-
++++
24-
<env intellij ></env>
25-
++++
2620

2721
Click on the "Configuration" menu in the upper right of the toolbar, and select "Tools" > "Codename One Settings" as shown below.
2822

29-
image::images/intellij-open-settings.png[]
23+
image::img/intellij-open-settings.png[]
3024

3125

3226
==== Opening Codename One Settings from NetBeans
33-
++++
34-
<env netbeans></env>
35-
++++
3627

3728
Right-click on the project in the project inspector, and select "Maven" > "Open Control Center" as shown below:
3829

39-
image::images/netbeans-open-control-center.png[]
30+
image::img/netbeans-open-control-center.png[]
4031

4132
==== Opening Codename One Settings from Eclipse
42-
++++
43-
<env eclipse ></env>
44-
++++
4533

46-
Press the image:images/eclipse-run-as-button.png[] button, and select the "_My Project_ Settings" option. (Where _My Project_ is the name of your project). E.g.
34+
Press the image:img/eclipse-run-as-button.png[] button, and select the "_My Project_ Settings" option. (Where _My Project_ is the name of your project). E.g.
4735

48-
image:images/eclipse-open-settings.png[]
36+
image:img/eclipse-open-settings.png[]
4937

5038
[#dashboard]
5139
=== The Dashboard
5240

5341
Once inside Codename One Settings, you'll see a dashboard like the following:
5442

55-
image::images/control-center-dashboard.png[]
43+
image::img/control-center-dashboard.png[]

docs/developer-guide/codenameone-maven-manual/appendix_goals.adoc renamed to docs/developer-guide/Maven-Appendix-Goals.adoc

File renamed without changes.

docs/developer-guide/codenameone-maven-manual/appendix_rich_properties_file.adoc renamed to docs/developer-guide/Maven-Appendix-Rich-Properties.adoc

File renamed without changes.

docs/developer-guide/codenameone-maven-manual/creating-cn1libs.adoc renamed to docs/developer-guide/Maven-Creating-CN1Libs.adoc

Lines changed: 35 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,7 @@ TIP: Codename One supports a subset of JavaSE8, as well as addition APIs for acc
2929

3030
Use the `cn1lib-archetype` for generating a new Codename One library project as follows:
3131

32-
==== CLI
33-
++++
34-
<env cli></env>
35-
++++
32+
==== Command Line
3633

3734
[source,bash]
3835
----
@@ -74,64 +71,58 @@ And follow the prompts. This will, result in fewer prompts because you have alr
7471

7572
This will create a new project for you in the current directory, in a newly created directory named after the `artifactId` that you entered.
7673

77-
==== IntelliJ
78-
++++
79-
<env intellij></env>
80-
++++
74+
==== IntelliJ IDEA
8175

8276
. Select "File" > "New Project"...
8377
+
84-
image::images/intellij-new-project-menu.png[]
78+
image::img/intellij-new-project-menu.png[]
8579
. Select "Maven" in the left menu.
8680
+
87-
image::images/intellij-new-project-dialog-maven.png[]
88-
. Check the "Create from Archetype" checkbox. image:images/intellij-create-from-archetype-checkbox.png[]. This should allow you to choose from of archetypes that are already known to IntelliJ.
81+
image::img/intellij-new-project-dialog-maven.png[]
82+
. Check the "Create from Archetype" checkbox. image:img/intellij-create-from-archetype-checkbox.png[]. This should allow you to choose from of archetypes that are already known to IntelliJ.
8983
. If you don't see an option for "com.codenameone:cn1lib-archetype", then IntelliJ doesn't know about it yet. If, however you *do* see this option, you can skip to the next step. Press the "Add Archetype..." button. This will display a dialog for you to enter the details of the archetype.
9084
+
91-
image::images/intellij-add-archetype.png[]
85+
image::img/intellij-add-archetype.png[]
9286
+
9387
Fill in this dialog as shown in the above image. Specifically `groupId`="com.codenameone", `artifactId`="cn1lib-archetype", and `version`="LATEST"
9488
+
9589
Then press "OK".
9690
. Select the option that says "com.codenameone:cn1lib-archetype"
9791
+
98-
image::images/intellij-select-cn1lib-archetype.png[]
92+
image::img/intellij-select-cn1lib-archetype.png[]
9993
+
10094
Then press "Next"
10195
. This will display a form where you can enter the details of your project such as its location (where you want to create the project folder), the name, the artifact ID, and the groupID. Fill in this form as you see fit.
10296
+
103-
image::images/intellij-new-cn1lib-project-details-form.png[]
97+
image::img/intellij-new-cn1lib-project-details-form.png[]
10498
+
10599
Then click "Next"
106100
. The final form in this wizard summarizes the project details and gives you an opportunity to add additional properties to pass to the `archetype:generate` goal. In our case we don't need to add any additional properties. If the information looks correct, you can just press "Next".
107101
+
108-
image::images/intellij-new-cn1lib-project-details-summary.png[]
102+
image::img/intellij-new-cn1lib-project-details-summary.png[]
109103

110104
At this point you will be prompted to open the project.
111105

112106
==== NetBeans
113-
++++
114-
<env netbeans></env>
115-
++++
116107

117108
. Select "File" > "New Project..."
118109
+
119-
image::images/netbeans-new-project-menu.png[]
110+
image::img/netbeans-new-project-menu.png[]
120111
. In the "New Project" dialog, select "Java with Maven" in the left panel, and "Project from Archetype" in the right panel, as shown below.
121112
+
122-
image::images/netbeans-new-project-maven-dialog.png[]
113+
image::img/netbeans-new-project-maven-dialog.png[]
123114
+
124115
Then press "Next"
125116
. This will bring you to the "Maven Archetype" dialog as shown below:
126117
+
127-
image::images/netbeans-maven-archetype-cn1lib-dialog.png[]
118+
image::img/netbeans-maven-archetype-cn1lib-dialog.png[]
128119
+
129120
Enter "com.codenameone" or "cn1lib-archetype" into the search field. Then select "cn1lib-archetype" in the "Known archetypes:" panel. This will prefill the *Group ID*, *Artifact ID* and *Version* fields for you. You may want to change *Version* to LATEST to ensure that it tries to use the latest available version of the archetype.
130121
+
131122
Then click "Next"
132123
. This will bring you to the "Name and Location" panel of the wizard.
133124
+
134-
image::images/netbeans-new-project-name-and-location.png[]
125+
image::img/netbeans-new-project-name-and-location.png[]
135126
+
136127
Enter in the project name (which you'll be forced to use as the artifact ID also), project location, groupId,
137128
version, and package. The "Package" is unimportant here as it isn't used anywhere in the project.
@@ -140,28 +131,25 @@ Once you have entered the information to your liking press the "Finish" button.
140131

141132
This will create a new libary project for you at the location you specified.
142133

143-
==== Eclipse
144-
++++
145-
<env eclipse></env>
146-
++++
134+
==== Eclipse IDE
147135

148136
. Select "File" > "New Project..."
149137
. In the _New Project_ dialog, expand the _Maven_ item, and select _Maven Project_
150138
+
151-
image::images/eclipse-new-project-wizard.png[]
139+
image::img/eclipse-new-project-wizard.png[]
152140
+
153141
Then press "Next"
154142
. The next panel will look like the below image. The default settings on this panel should be fine. Press _Next_
155143
+
156-
image::images/eclipse-new-project-wizard-new-maven-project.png[]
144+
image::img/eclipse-new-project-wizard-new-maven-project.png[]
157145
. In the next panel, enter "cn1lib" in the _Filter_ field. After a moment the _cn1lib-archetype_ should appear in the area below as shown here:
158146
+
159-
image::images/eclipse-new-maven-project-cn1lib.png[]
147+
image::img/eclipse-new-maven-project-cn1lib.png[]
160148
+
161149
Select that option, and press _Next_
162150
. The next panel, allows you to enter your project details, such as group ID, and artifact ID. Your project information here and then press _Finish_.
163151
+
164-
image:images/eclipse-new-maven-project-details.png[]
152+
image:img/eclipse-new-maven-project-details.png[]
165153

166154
This will create a new libary project for you at the location you specified.
167155

@@ -185,61 +173,49 @@ tests::
185173
An application project for writing unit tests against your library. This module is in the "tests" directory of the main project.
186174

187175

188-
===== IntelliJ
189-
++++
190-
<env intellij></env>
191-
++++
176+
===== IntelliJ IDEA IDEA
192177

193178
The project inspector will look like:
194179

195-
image::images/intellij-myfirstlib-project-inspector.png[]
180+
image::img/intellij-myfirstlib-project-inspector.png[]
196181

197182
This top-level view of the module structure may seem daunting. Most of your development will occur inside the "common" module. If we expand that module it will look more familiar to developers who have used the old Ant project structure:
198183

199-
image::images/intellij-myfirstlibrary-common-project-files.png[]
184+
image::img/intellij-myfirstlibrary-common-project-files.png[]
200185

201186
Your cross-platform Java source would go in the `common/src/main/java` directory. Your CSS files go in the `common/src/main/css` directory.
202187

203188
===== NetBeans
204-
++++
205-
<env netbeans></env>
206-
++++
207189

208190
The project inspector will look like:
209191

210-
image::images/netbeans-myfirstlibrary-project-inspector.png[]
192+
image::img/netbeans-myfirstlibrary-project-inspector.png[]
211193

212194
This top-level view of the modules doesn't provide a clear view of the project landscape, however, since 99% of your development will occur inside the `common` submodule. Let's open that "common" sub-module project as well and take a peek.
213195

214196
Right click on the "Common" sub-module, and select "Open Project" as shown below:
215197

216-
image::images/netbeans-myfirstlibrary-open-common-submodule.png[]
198+
image::img/netbeans-myfirstlibrary-open-common-submodule.png[]
217199

218200
With the common subproject open, the project inspector will look like:
219201

220-
image::images/netbeans-myfirstlibrary-project-inspector-with-common.png[]
202+
image::img/netbeans-myfirstlibrary-project-inspector-with-common.png[]
221203

222204
In this screenshot I have expanded "Source Packages" and "Other Sources/css" to highlight where your Java source files and CSS source files will be located.
223205

224206
The project inspector hides a few important files, however, so here is a screenshot of the File inspector for the common project:
225207

226-
image::images/netbeans-my-first-library-file-inspector-common.png[]
208+
image::img/netbeans-my-first-library-file-inspector-common.png[]
227209

228-
===== Eclipse
229-
++++
230-
<env eclipse></env>
231-
++++
210+
===== Eclipse IDE IDE
232211

233212
The package explorer will look like:
234213

235-
image::images/eclipse-cn1lib-package-explorer.png[]
214+
image::img/eclipse-cn1lib-package-explorer.png[]
236215

237216
In this screenshot, I have expanded the _common/src/main/css_ and _common/src/main/java_ directories as this is where most of your module source will go.
238217

239-
===== CLI
240-
++++
241-
<env cli></env>
242-
++++
218+
===== Command Line
243219

244220
If we do a file listing on the project directory, it shows the following:
245221

@@ -375,10 +351,7 @@ Other non-java resources that you want to have included in the classpath.
375351
[#building-library]
376352
==== Building the Library
377353

378-
===== CLI
379-
++++
380-
<env cli></env>
381-
++++
354+
===== Command Line
382355

383356
To build the library, simply run the "install" goal on the root module as follows:
384357

@@ -387,34 +360,25 @@ To build the library, simply run the "install" goal on the root module as follow
387360
mvn install
388361
----
389362

390-
===== IntelliJ
391-
++++
392-
<env intellij></env>
393-
++++
363+
===== IntelliJ IDEA IDEA
394364

395-
Press the "build" image:images/intellij-build-icon.png[] button on the toolbar.
365+
Press the "build" image:img/intellij-build-icon.png[] button on the toolbar.
396366

397367
===== NetBeans
398-
++++
399-
<env netbeans></env>
400-
++++
401368

402369
Right click on the "root" module in the project explorer and select "Build".
403370

404-
image::images/netbeans-right-click-build.png[]
371+
image::img/netbeans-right-click-build.png[]
405372

406373
IMPORTANT: You must build the root module and not one of the submodules.
407374

408-
Alternatively you could have just selected the "root" module in the project explorer and pressed the "build" image:images/netbeans-build-button.png[] button on the toolbar.
375+
Alternatively you could have just selected the "root" module in the project explorer and pressed the "build" image:img/netbeans-build-button.png[] button on the toolbar.
409376

410-
===== Eclipse
411-
++++
412-
<env eclipse></env>
413-
++++
377+
===== Eclipse IDE IDE
414378

415379
Right click on the "root" module in the project explorer and select _Run as_ > _Maven Install_
416380

417-
image::images/eclipse-build-cn1lib.png[]
381+
image::img/eclipse-build-cn1lib.png[]
418382

419383
TIP: If the build fails for any reason, check to make sure that your project is using the latest version of the Codename One plugin. You can do this by opening the _pom.xml_ file, and changing the `cn1.version` and `cn1.plugin.version` properties to reference the latest version. Check for the latest version https://search.maven.org/artifact/com.codenameone/codenameone[here].
420384

0 commit comments

Comments
 (0)