You are here: Foswiki>Applications Web>AppHowToMain>AppHowToProjectSetup (12 Jan 2023, AndreasSchaller)Edit Attach

Creating a new Maven Project

In Eclipse Project Explorer

Adjust the pom.xml file

  • Provide a description of your project if you have missed to edit the archetype property (In <description>)
  • Adjust the URL to your documentation webpage
  • Adjust the properties bundle.mainClass and git.organization (the organization of your git project in https://git.acc.gsi.de/ if present)
<properties>
<!-- Adjust this to point to your main class -->
<bundle.mainClass>please.set.the.bundle.properties</bundle.mainClass>

<!-- Adjust this to point to the Git Organisation name where you want to share the project --> <git.organization>fcc-applications</git.organization> </properties> <scm>
<connection>scm:git:${git.view.url}/${git.organization}/${project.artifactId}.git</connection> <developerConnection>scm:git:${git.dev.url}/${git.organization}/${project.artifactId}.git</developerConnection> <url>${git.view.url}/${git.organization}/${project.artifactId}/commits/branch/${scmBranch}</url> <tag>HEAD</tag> </scm>
  • Adjust the URL to your continuous integration location for the project
  • Adjust the URL to your projects bugtracker
  • Add yourself as developer in the <developers> part (change URL to your persons web page)
    • provide the correct roles of all developers since these roles are used to generate documentations
    • possible roles are: owner, architect, developer, release engineer and tester
  • Replace dependencies by e.g.
<dependencies>
    <dependency>
        <groupId>de.gsi.fcc.commons</groupId>
        <artifactId>common-widgets</artifactId>
        <version>17.0.0</version> <!-- look for newer version -->
    </dependency>
    <dependency>
        <groupId>de.gsi.fcc.commons</groupId>
        <artifactId>common-dependencies</artifactId>
        <version>17.0.0</version> <!-- look for newer version -->
    </dependency>
</dependencies>

If your project needs some configuration properties, specify them using How To Configuration (more dynamically).

Checklist for new Applications

  1. Use the Standard GSI Frame to guarantee a common look: GsiFrame
  2. System Properties are stored in the common-config repository: Configuration / Startup Options
  3. Use diagnostic Logging: How to logging
  4. Use the language translator to internationalize your Application: Language Selector

Build your project

  • Right click on project -> run as -> maven build ...
  • use goals "clean package" to just ensure your project can be build and to test it locally
    or
    use goals "compile exec:java" to run the newly created application
    or
    use goals "clean install" to install your project to your local maven repository and build zip file for rollout (ensure the correct codebase is set!)
    or
  • use "clean deploy" to deploy your project to the nexus

Next Steps

Rename the main class and controller

Once you feel safe enough with the project setup you should rename the main method and controller to the actual name of the application. Using our archetype TemplateApp as starting point we want to rename it for example to BeamApp.
You will have to rename or edit the selected files in the screenshot.
new-project-rename.png
  1. Make sure the project is in a compiling state without errors (see eclipse "Problems" view)
  2. Edit pom.xml and change the last part of bundle.mainClass from TemplateApp to BeamApp
  3. Right click on TemplateApp.java then choose Refactor -> Rename... enter BeamApp.java and confirm the following information dialogs with next or finish
    • (Shortcut Alt+Shift+R if you feel comfortable using it)
  4. Open TemplateApp.java and change APP_TITLE to "Beam App" and APP_STYLESHEET to "BeamApp.css"
  5. Rename the following files in the same way using the Refactor -> Rename... function (you can use the shortcut Ctrl+Shift+R to find the files)
    • TemplateAppResourceBundle_en.java -> BeamAppResourceBundle _en.java
    • TemplateAppResourceBundle.java -> BeamAppResourceBundle.java
    • TemplateAppController.java -> BeamAppController.java
    • TemplateAppModel.java -> BeamAppModel.java
    • TemplateApp.fxml -> BeamApp.fxml
    • TemplateApp.css -> BeamApp.css
  6. Done. If everything went well there should be no "Problems" and you can still run the app by clicking on the project name in the "Package Explorer", select Run As -> Maven build... then Goals: "clean compile exec:java" -> Run

new-project-rename-after.png

Creating a git project and upload your code

Please make sure to read AppHowToGitInEclipseForBeginners at least up to and including 2.1.

We will create a project in our personal git organisation which can later be move to one of the bigger organisations like fcc-applications or fcc-commons.

Create the gitea project

Visit https://git.acc.gsi.de/ and Please follow the screenshots.
1. Chose new repository from the "+" menu

01-new-repo.png
2. Enter you project name and information

02-new-repo-settings.png
  • Owner: You name
  • Chose a repository name that resembles or even is the same as the maven artifact name
  • Private repository is only if you want to hide the project, none of your collegues will be able to see the project
  • Leave the gitignore, license and especially the "initialize repository" option empty. We already have code that we want to upload and don't want do get any conflict
  • Hit "Create Repository"
3. Repository created, copy URL

03-new-repo-success.png
  • Repository created successfully - make sure to copy the marked http repository URL.
4. Initialize the local git repository

Now we have to do some command line work. Open a bash shell and navigate to the source files of your project. (To get the path, in Eclipse: select Project -> Properties -> Location might help you)

Enter the following commands from the main project directory (were pom.xml is)
cd DIRECTORY_OF_THE_PROJECT
git init
# download a default gitignore file that will prevent eclipse project files from being uploaded
wget https://git.acc.gsi.de/buildsystem-common/csco-java-fx-template/raw/branch/main/.gitignore
# Adjust the complete URL to the previously copied one
git remote add origin https://git.acc.gsi.de/REPLACE_COMPLETE_WITH_THE_URL_YOU_HAVE_COPIED_BEFORE
# Add and commit all these changes with the following commands
git add -A
git commit -m 'Initial commit'
# We will then push the changes using eclipse in the next step
5. Push the repository using eclipse
  1. Now we switch back to eclipse, select our project in the repository explorer and do a "-> refresh" or hit F5 while the project is selected
  2. Select Team -> Push Branch "master"...
    • (highlighted blue in the screenshot below)
    • if you only have the options "Apply patch", "Share Project", and "Share Projects", choose "Share Project", select GIT and finish, repeate step 2
  3. There might be a prompt for your local keystore password, enter it or cancel the keystore dialog
  4. Click on Preview and Push in the following dialog pages
04-push-branch-master.png
6. Success

You can see an entry in your eclipse "history" view now and if you refresh you gitea project page.

05-success-history.png

06-success-gitea.png

See also

-- AndreasSchaller - 23 Sep 2014
Topic revision: r18 - 12 Jan 2023, AndreasSchaller
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki? Send feedback