SYS-CON MEDIA Authors: Liz McMillan, Carmen Gonzalez, Zakia Bouachraoui, Roger Strukhoff, David Linthicum

Blog Feed Post

Creating a Maven Archetype from a #KFCStandard JavaFX Project

In this article I will discuss the creation of a Maven Archetype that my students or anyone else can use to begin developing a JavaFX application. Like so many adventures in programming this process began quickly and then bogged down in dealing with specific details. If you want to create your own archetype then this article will be helpful. Don’t forget to read the Sip of Whine section at the end.

The source code for the sample JavaFX project is at

The archetype folder ready for installation on your system is in the release of

Step 1: Write a program

Archetypes can be created using either a bottom up or top down approach. By far the easiest approach is top down. You begin by writing a very simple Maven managed JavaFX application. You are providing a skeleton of an application that contains required or recommended packages, resources and source code.

The application I created is a simple JavaFX Stage with one Scene with a button that when pressed display some text. The code that delivers this experience is in the format that I want my students to follow. A few years ago some students created a hash tag to poke fun at my stringent rules, #KFCStandard. That I how I describe any rules or instructions that I provide to students that must be followed. This project exemplifies a number of #KFCStandards in the areas of pom files, how to start a JavaFX application, how to do unit testing and how to comment code. If you are not one of my students then you may have issues with my archetype. I would really like to hear your thoughts. Living in academia I worry that I loose site of the real world of software development.

Do your best to ensure that the program works. If you are creating an archetype where the files are empty waiting for the user to fill them in then this is likely not going to be a problem. If your code does something, as mine does, spend some time with it to get it right.

Archetype Tip #1: Always create packages that begin with the maven groupId and optionally the artifactId. This allows the user of your archetype to use their own package names.

Archetype Tip #2: If you reference the mainClass in the pom.xml as:


Change it to


Archetype Tip #3: If you need to have a package created when the archetype is used but you don’t have anything to place in the package then add an empty file. Maven will not create packages if there are no files in it.

pom.xml note: When I compile with NetBeans I get two warnings regarding the pom.xml. One tells me that ${groupId} is deprecated in favour of ${project.groupId} and the second tells me that ${artifactId} is deprecated in favour of ${project.artifactId}. The NetBeans 8.01 editor only recognizes ${project.groupId} and not the other. Therefore for now I am using the deprecated versions.

Step 2: Install Maven

I use NetBeans, my personal preference for an IDE and what I used in developing the archetype code. In one course that I teach I must use Eclipse. Both of these IDEs and others now provide good support for Maven. People who know me will now roll their eyes as I say that creating an archetype is easier to do at the command line. Download and install Maven from Read the install notes at You need to have Maven’s bin folder in the executable path and Windows users must have a JAVA_HOME environment variable.

Maven note: Some IDEs, such as NetBeans, contain the maven command line program. I recommend downloading Maven so that you are working with the most recent version.

Step 3: Clean up the project

Locate the folder your project is in. Delete everything in the project’s folder except for the src folder and the pom.xml file. You may want to make a copy of the project folder because you will be changing one file that will cause an exception to thrown if you run the project after the change.

Step 4: Alter the fxml file

If you are creating a project with an fxml file in the resources folder it likely contains a reference to its java controller file. In this project the file Scene.fxml contains:


You need to replace the part of the package that matches the groupId and artifactId with the matching properties. The change looks like:


Step 5: Archetype Resolution or Generating the Archetype

Archetype Resolution is the term that the Maven developers use to describe using Maven to generate the archetype. This task will create a new target folder that contains the archetype version of your code.

Open a command window in the project’s root folder. In my case that is D:\mvnbuild\ArchetypeJavaFX. At the prompt issue the command:

mvn archetype:create-from-project

You may ignore all the warnings.

If all has gone well you will you will have the following folder that is not normally part of a Maven build:


Step 6: Make the fxml files filterable

The project in the archetype folder now contains two files named archetype-metadata.xml. This xml file determines which files will go into the archetype and whether or not they get filtered. To filter is to substitute a property with a value. That is why we changed the Scene.fxml file in the previous step. The archetype-metadata.xml files do not show that files in the fxml folder of resources are filterable. Locate these two files, mine are in:




Edit the files, they are identical, to change:

<fileSet encoding="UTF-8">

to read

<fileSet filtered="true" encoding="UTF-8">


Step 7: Install the Archetype in your repository

Open a command window in your archetype folder and at the prompt enter the following commnd:

D:\NetBeansProjects\javafxarchetype\target\generated-sources\archetype>mvn install

Ignore any warnings. The archetype should be safely in


where ever your .m2 folder is.

Step 8a: Test if it works with the Maven command line

Create a new folder on your computer for the test. I created D:\mvntest. Open a command window in this folder. Run the command:

D:\mvntest>mvn archetype:generate -DarchetypeCatalog=local

What follows next is pretty straight forward. Here is my output. Notice that you need to enter the groupId, artifactId, version and package. The package should be made up from the groupId and artifactId.

[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] ------------------------------------------------------------------------
[INFO] >>> maven-archetype-plugin:2.4:generate (default-cli) > generate-sources @ standalone-pom >>>
[INFO] <<< maven-archetype-plugin:2.4:generate (default-cli) < generate-sources @ standalone-pom <<<
[INFO] --- maven-archetype-plugin:2.4:generate (default-cli) @ standalone-pom ---
[INFO] Generating project in Interactive mode
[INFO] No archetype defined. Using maven-archetype-quickstart (org.apache.maven.archetypes:maven-archetype-quickstart:1.0)
Choose archetype:
1: local -> com.kfcstandard:javafxarchetype-archetype (Standard starting point for JavaFX programs for students of Ken Fogel)
Choose a number or apply filter (format: [groupId:]artifactId, case sensitive contains): : 1
Define value for property 'groupId': : com.squirrel
Define value for property 'artifactId': : moose
Define value for property 'version': 1.0-SNAPSHOT: :
Define value for property 'package': com.squirrel: : com.squirrel.moose
Confirm properties configuration:
groupId: com.squirrel
artifactId: moose
version: 1.0-SNAPSHOT
package: com.squirrel.moose
 Y: : y
[INFO] ----------------------------------------------------------------------------
[INFO] Using following parameters for creating project from Archetype: javafxarchetype-archetype:0.1
[INFO] ----------------------------------------------------------------------------
[INFO] Parameter: groupId, Value: com.squirrel
[INFO] Parameter: artifactId, Value: moose
[INFO] Parameter: version, Value: 1.0-SNAPSHOT
[INFO] Parameter: package, Value: com.squirrel.moose
[INFO] Parameter: packageInPathFormat, Value: com/squirrel/moose
[INFO] Parameter: package, Value: com.squirrel.moose
[INFO] Parameter: version, Value: 1.0-SNAPSHOT
[INFO] Parameter: groupId, Value: com.squirrel
[INFO] Parameter: artifactId, Value: moose
[INFO] project created from Archetype in dir: D:\mvntest\moose
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 30.660 s
[INFO] Finished at: 2015-09-01T20:48:04-04:00
[INFO] Final Memory: 13M/243M
[INFO] ------------------------------------------------------------------------

In the project that has been created in the mvnbuild folder examine the Scene.fxml file and ensure that it has the path to the controller based on the groupId and artifactId you entered. Check out the pom.xml in the project and verify that the mainClass has the proper package.

Step 8b: Testing with NetBeans

 Start NetBeans and select:

File -> New Project

In the dialog choose Maven on the left and Project from Archetype on the right and click on Next.


Scroll down to find javafxarchetype-archetype, select it and click on Next.


On the next screen you can fill in the Project Name that becomes the Artifact Id, the Group Id, and Version. It’s unusual to change the Package which defaults to Group Id plus Artifact Id.


Click on Finish and you will a have a project loaded. You should be able to Clean and Build and then Run this project.


You are now ready to add your code to the project.

Step 8c: Testing with Eclipse

Start Eclipse and then choose File -> New -> Other. Open Maven in this dialog and select Maven Project.


There is nothing to change in the next dialog so just click on Next.


In the next dialog you should see all the archetypes available to Eclipse. On my system the local archetypes appear first so the archetype we created should be first. Select it and click on Next.


Now you can fill in the Group Id, Artifact Id, Version and Package. Like NetBeans the Package is made up of the Group Id and Artifact Id. Click on Finish.


The project will appear in the Package Explorer. Right mouse click on the project and choose Run As -> Maven Build and at the dialog just choose Run. The program should open. Close it and you are now ready to add your code to the project.

A Sip of Whine

In learning how to create a maven archetype I was confronted with a serious issue in regards to what I found on the web. Almost every blog, post or stackoverflow answer was nothing more than paraphrasing the Apache Maven documentation. It looks to me these authors have never used Maven or Archetypes in real world situations. The same holds true for the Apache Maven documentation. It lacks any real world examples and is far from being written in plain language.

There is also a bug in the Maven Archetype system. It took me two days to track it down. If you have a package made up of the groupId and artifactId in the src/main/java folder and you have the exact same package in src/test/java then the archetype will be damaged and will not work. The solution was to place the tests in a folder one level below the package. I will report it.

Read the original blog entry...

More Stories By Ken Fogel

In 1980 I bought for myself the most wonderful toy of the day, the Apple ][+. Obsession followed quickly and by 1983 I was writing software for small and medium sized businesses in Montreal for both the Apple and the IBM PC under the company name Omnibus Systems. In the evenings I taught continuing education courses that demystified the computer to the first generation of workers who found themselves with their typewriter on the scrap heap and a PC with WordStar taking its place.

In 1990 I was invited to join the faculty at Dawson College in the Computer Science Technology program. When I joined the program the primary language was COBOL and my responsibility was to teach small systems languages such as BASIC and C/C++.

Today I am now the chairperson and program coordinator of the Computer Science Technology program at Dawson. The program's primary language is Java and the focus is on enterprise programming.

I like to write about the every day problems my students and I face in using various languages and platforms to get the job done. And from time to time I stray from the path and write about what I plan to do, what I actually get around to doing, and what I imagine I am doing.


Latest Stories
The platform combines the strengths of Singtel's extensive, intelligent network capabilities with Microsoft's cloud expertise to create a unique solution that sets new standards for IoT applications," said Mr Diomedes Kastanis, Head of IoT at Singtel. "Our solution provides speed, transparency and flexibility, paving the way for a more pervasive use of IoT to accelerate enterprises' digitalisation efforts. AI-powered intelligent connectivity over Microsoft Azure will be the fastest connected pat...
There are many examples of disruption in consumer space – Uber disrupting the cab industry, Airbnb disrupting the hospitality industry and so on; but have you wondered who is disrupting support and operations? AISERA helps make businesses and customers successful by offering consumer-like user experience for support and operations. We have built the world’s first AI-driven IT / HR / Cloud / Customer Support and Operations solution.
ScaleMP is presenting at CloudEXPO 2019, held June 24-26 in Santa Clara, and we’d love to see you there. At the conference, we’ll demonstrate how ScaleMP is solving one of the most vexing challenges for cloud — memory cost and limit of scale — and how our innovative vSMP MemoryONE solution provides affordable larger server memory for the private and public cloud. Please visit us at Booth No. 519 to connect with our experts and learn more about vSMP MemoryONE and how it is already serving some of...
Darktrace is the world's leading AI company for cyber security. Created by mathematicians from the University of Cambridge, Darktrace's Enterprise Immune System is the first non-consumer application of machine learning to work at scale, across all network types, from physical, virtualized, and cloud, through to IoT and industrial control systems. Installed as a self-configuring cyber defense platform, Darktrace continuously learns what is ‘normal' for all devices and users, updating its understa...
Codete accelerates their clients growth through technological expertise and experience. Codite team works with organizations to meet the challenges that digitalization presents. Their clients include digital start-ups as well as established enterprises in the IT industry. To stay competitive in a highly innovative IT industry, strong R&D departments and bold spin-off initiatives is a must. Codete Data Science and Software Architects teams help corporate clients to stay up to date with the mod...
As you know, enterprise IT conversation over the past year have often centered upon the open-source Kubernetes container orchestration system. In fact, Kubernetes has emerged as the key technology -- and even primary platform -- of cloud migrations for a wide variety of organizations. Kubernetes is critical to forward-looking enterprises that continue to push their IT infrastructures toward maximum functionality, scalability, and flexibility. As they do so, IT professionals are also embr...
Platform9, the leader in SaaS-managed hybrid cloud, has announced it will present five sessions at four upcoming industry conferences in June: BCS in London, DevOpsCon in Berlin, HPE Discover and Cloud Computing Expo 2019.
At CloudEXPO Silicon Valley, June 24-26, 2019, Digital Transformation (DX) is a major focus with expanded DevOpsSUMMIT and FinTechEXPO programs within the DXWorldEXPO agenda. Successful transformation requires a laser focus on being data-driven and on using all the tools available that enable transformation if they plan to survive over the long term. A total of 88% of Fortune 500 companies from a generation ago are now out of business. Only 12% still survive. Similar percentages are found throug...
When you're operating multiple services in production, building out forensics tools such as monitoring and observability becomes essential. Unfortunately, it is a real challenge balancing priorities between building new features and tools to help pinpoint root causes. Linkerd provides many of the tools you need to tame the chaos of operating microservices in a cloud native world. Because Linkerd is a transparent proxy that runs alongside your application, there are no code changes required. I...
In his general session at 21st Cloud Expo, Greg Dumas, Calligo’s Vice President and G.M. of US operations, discussed the new Global Data Protection Regulation and how Calligo can help business stay compliant in digitally globalized world. Greg Dumas is Calligo's Vice President and G.M. of US operations. Calligo is an established service provider that provides an innovative platform for trusted cloud solutions. Calligo’s customers are typically most concerned about GDPR compliance, application p...
Modern software design has fundamentally changed how we manage applications, causing many to turn to containers as the new virtual machine for resource management. As container adoption grows beyond stateless applications to stateful workloads, the need for persistent storage is foundational - something customers routinely cite as a top pain point. In his session at @DevOpsSummit at 21st Cloud Expo, Bill Borsari, Head of Systems Engineering at Datera, explored how organizations can reap the bene...
"NetApp's vision is how we help organizations manage data - delivering the right data in the right place, in the right time, to the people who need it, and doing it agnostic to what the platform is," explained Josh Atwell, Developer Advocate for NetApp, in this interview at 20th Cloud Expo, held June 6-8, 2017, at the Javits Center in New York City, NY.
Druva is the global leader in Cloud Data Protection and Management, delivering the industry's first data management-as-a-service solution that aggregates data from endpoints, servers and cloud applications and leverages the public cloud to offer a single pane of glass to enable data protection, governance and intelligence-dramatically increasing the availability and visibility of business critical information, while reducing the risk, cost and complexity of managing and protecting it. Druva's...
Kubernetes as a Container Platform is becoming a de facto for every enterprise. In my interactions with enterprises adopting container platform, I come across common questions: - How does application security work on this platform? What all do I need to secure? - How do I implement security in pipelines? - What about vulnerabilities discovered at a later point in time? - What are newer technologies like Istio Service Mesh bring to table?In this session, I will be addressing these commonly asked ...
BMC has unmatched experience in IT management, supporting 92 of the Forbes Global 100, and earning recognition as an ITSM Gartner Magic Quadrant Leader for five years running. Our solutions offer speed, agility, and efficiency to tackle business challenges in the areas of service management, automation, operations, and the mainframe.