Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
codenameone-cli
Advanced tools
Readme
Command-line tools for Codename One
Project Status: This project is at a very early stage. If you want to get started with Codename One, building cross-platform mobile apps in Java, I recommend you start with the official Codename One Getting Started Tutorial. Once you are familiar with the toolkit, you may want to revisit this command-line tool as it aims to boost development productivity, especially for developers who are comfortable with the command-line.
npm install -g codenameone-cli
sudo npm install -g codenameone-cli
NOTE: The above commands will install it globally, and you require admin permissions to do this typically (hence the sudo
in the linux/mac command). You can also install it locally, using npm install codenameone-cli
in which case the command will be installed at ./node_modules/.bin/cn1
.
Usage: codenameone-cli [command]
Commands:
create - Create a new Codename One Project
settings - Open project settings for project in current directory.
css - CSS-related commands
test - Unit-test related commands
install-jars - Install latest jars into project
install-tests - Install tests.xml file with some test targets
install-appium-tests - Install appium.xml file with some appium tests defined.
git-init - Same as git init, but adds suitable .gitignore file.
git-clone - Same as git clone, but installs jars.
cn1 create <dest-dir> <package-id> <main-class-name> [-i Netbeans|Eclipse|IntelliJ] [-t http://example.com/project/template.zip]
Creating a basic project in directory named "helloworld":
cn1 create helloworld com.mycompany.hello HelloWorld
Follow the prompt for the other details (e.g. package id, main class, IDE, template, etc...)
Using the GUI "create project wizard" ... Just add -g
flag:
cn1 create helloworld -g
This will open a GUI form that allows you to browse and select a template to use for the project.
You can click on any of the templates, and get more details about it, or run the template inside the Codename One simulator directly.
Specifying Template and IDE in Command-line
cn1 create helloworld com.mycompany.hello HelloWorld \
-i Netbeans \
-t https://github.com/codenameone/SQLSample/archive/master.zip
Navigate to any Codename One project directory, and type:
cn1 settings
This will open the Codeame One settings app so you can configure your project (e.g. add cn1libs, set up iOS signing, add build-hints etc..
The templates listed in the "Create Project Form" are all loaded from this json file hosted on Github. To add your own templates, you can simply fork the codenameone-templates project, and add your template to that JSON file. Then issue a pull request. We'll review it and merge it if appropriate.
Of course, templates don't need to be listed there to be available for use. If your Codename One project is on Github, you can simply provide the "master.zip" URL as the -t
parameter of cn1 create
and the template will be used.
Generally, when we host Codename One projects on Github, we strip out the common binaries like CodenameOne.jar, JavaSE.jar, etc... This can be a little annoying when you are cloning projects because you have to first copy the jar files back into the project before you can build it. The cn1 git-clone
command is a thin wrapper around git clone
that will automatically perform this housekeeping for you.
Example Usage
Let's take the KitchenSink project, for example.
$ cn1 git-clone https://github.com/codenameone/KitchenSink
Cloning into 'KitchenSink'...
Installing jars into KitchenSink...
Downloading 11606508 bytes
Download completed!
Project ready at KitchenSink
NOTE: It also works to specify only the project using "ownername/projectname", e.g. cn1 git-clone codenameone/KitchenSink
Now we can immediately build this project:
$ cd KitchenSink
$ ant jar
Or run it in the Codename One simulator:
$ ant run
Bonus Points: You can clone and run the project in a single line with:
$ cn1 git-clone https://github.com/codenameone/KitchenSink && cd KitchenSink && ant run
Use the list-demos
command to find Codename One projects that can be cloned using the git-clone
command.
Example
You'll get a readout like:
The list-demos
command lists all projects on Github that are tagged with both the codenameone
and demo
topics. If you have a demo project that you are hosting on Github, all you need to do is add these topics to your project, and your project will be returned by the list-demos
command.
FAQs
Toolkit for building Cross-platform mobile applications in Java
The npm package codenameone-cli receives a total of 40 weekly downloads. As such, codenameone-cli popularity was classified as not popular.
We found that codenameone-cli demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.