|
1 | 1 | == Introduction |
2 | 2 |
|
3 | | -Codename One is a Write Once Run Anywhere mobile development platform for Java/Kotlin developers. It integrates with IntelliJ/IDEA, Eclipse or NetBeans to provide seamless native mobile development. |
| 3 | +Codename One is a Write Once Run Anywhere mobile development platform for Java/Kotlin developers. It fits naturally into modern Maven-capable IDEs such as IntelliJ IDEA, NetBeans, VS Code and Eclipse, and it can also be driven entirely from the command line. |
4 | 4 |
|
5 | 5 | Codename One's mission statement is: |
6 | 6 |
|
@@ -219,17 +219,43 @@ This means that in runtime a user might revoke a permission. A good example in t |
219 | 219 |
|
220 | 220 | === Installing Codename One |
221 | 221 |
|
222 | | -IMPORTANT: The minimum JDK for Codename One is JDK 8 notice that newer JDKs might not be supported immediately. Currently JDK 11 is known to work and JDK 17 support is in beta stages. |
| 222 | +IMPORTANT: Codename One requires either JDK 11 or JDK 8. Other JDK versions are not supported at this time. |
223 | 223 |
|
224 | | -IMPORTANT: The IDE plugins for Codename One are no longer supported. They are required for legacy Ant applications which is why they are still available for download! |
| 224 | +Codename One projects are built with Maven. Typical Maven targets such as `package`, `clean` and `install` work out of the box, but the Codename One integrations that ship with each IDE provide dedicated Run and Build actions for a smoother workflow. |
225 | 225 |
|
226 | | -Starting with version 7.0 a Codename One project is a standard Maven project. Typical Maven targets such as package, clean and install should work as expected. Dependencies can be added just like any other project. |
| 226 | +To create a new Codename One project visit https://start.codenameone.com/ and generate a starter project, or run the Codename One Application Project Archetype (`cn1app-archetype`) directly on the command line: |
227 | 227 |
|
228 | | -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. |
| 228 | +[source,bash] |
| 229 | +---- |
| 230 | +mvn archetype:generate \ |
| 231 | + -DarchetypeGroupId=com.codenameone \ |
| 232 | + -DarchetypeArtifactId=cn1app-archetype \ |
| 233 | + -DarchetypeVersion=LATEST \ |
| 234 | + -DgroupId=YOUR_GROUP_ID \ |
| 235 | + -DartifactId=YOUR_ARTIFACT_ID \ |
| 236 | + -Dversion=1.0-SNAPSHOT \ |
| 237 | + -DmainName=YOUR_MAIN_NAME \ |
| 238 | + -DinteractiveMode=false |
| 239 | +---- |
229 | 240 |
|
230 | | -To create a new Codename One project visit https://start.codenameone.com/ and generate a starter project. For further details about configuring maven check out https://shannah.github.io/codenameone-maven-manual/ |
| 241 | +This command generates a project in the current directory. The folder name matches the `artifactId` value. For example, specifying `-DartifactId=myapp` produces a project inside a new `myapp` directory. |
231 | 242 |
|
232 | | -The Codename One maven plugin supports for IntelliJ/IDEA, VSCode, Eclipse, NetBeans and the Command Line. Other targets might work. |
| 243 | +Import the generated Maven project into your preferred IDE and use the Codename One Run in Simulator task from the IDE toolbar or Run/Debug buttons: |
| 244 | + |
| 245 | +* *IntelliJ IDEA* – use *File > Open* on the project directory, then choose the Codename One Run in Simulator action from the toolbar or standard Run/Debug controls. |
| 246 | +* *NetBeans* – use *File > Open Project*, select the generated Maven project, and rely on the Codename One toolbar actions to run and debug the simulator. |
| 247 | +* *VS Code* – install the Java and Codename One extensions, open the folder, and trigger the Run in Simulator task from the command palette or the Run/Debug buttons. |
| 248 | +* *Eclipse* – use *File > Import > Existing Maven Projects*, then use the Codename One launch shortcuts provided by the plugin for simulator and build tasks. |
| 249 | +* *Command line* – invoke Maven goals directly whenever you need to integrate with CI/CD pipelines or scripting. |
| 250 | + |
| 251 | +For deeper coverage of the Maven goals and project structure, see the https://shannah.github.io/codenameone-maven-manual/[Codename One Maven Manual]. |
| 252 | + |
| 253 | +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. |
| 254 | + |
| 255 | +.Legacy onboarding resources |
| 256 | +**** |
| 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. |
| 258 | +**** |
233 | 259 |
|
234 | 260 | ==== Important Notes for New Projects |
235 | 261 |
|
@@ -258,16 +284,13 @@ To come up with the right package name use a reverse domain notation. So if my w |
258 | 284 |
|
259 | 285 | ==== Runtime |
260 | 286 |
|
261 | | -Once maven is set up we can run the `HelloWorld` application by pressing the `Play` or `Run` button in the IDE. When we do that the Codename One simulator launches. You can use the menu of the simulator to control and inspect details related to the device. You can rotate it, determine it's location in the world, monitor networking calls etc. |
| 287 | +Once Maven is set up we can run the `HelloWorld` application by selecting the Codename One Run in Simulator task from the IDE run menu. The Codename One simulator launches and you can use its menus to control and inspect details related to the device. You can rotate it, determine its location in the world, monitor networking calls etc. |
262 | 288 |
|
263 | 289 | With the `Skins` menu you can download device skins to see how your app will look on different devices. |
264 | 290 |
|
265 | 291 | TIP: Some skins are bigger than the screen size, uncheck the `Scrollable` flag in the `Simulator` menu to handle them more effectively |
266 | 292 |
|
267 | | -Debug works just like `Run` by pressing the IDE's debug button. It allows us to launch the simulator in debug mode where we can set breakpoints, inspect variables etc. |
268 | | - |
269 | | -.HelloWorld Running on the Simulator with an iPhone X Skin |
270 | | -image::img/developer-guide/codenameone-hello-world-simulator.png[HelloWorld Running on the Simulator with an iPhone X Skin,scaledwidth=50%] |
| 293 | +Use your IDE's Debug button with the Run in Simulator task to launch the simulator under the debugger. |
271 | 294 |
|
272 | 295 | .Simulator vs. Emulator |
273 | 296 | **** |
|
0 commit comments