Skip to content

tecnico-distsys/example_java-lib

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Configuration helper

This is an example of a simple Java library.

The configuration helper library loads configuration values from a property file in resources. The properties file follows the name=value syntax.

The library is tested with unit tests on an example properties file stored in the src/test/resources folder.

The min value is defined directly on the properties file.

minValue=7

The max value is defined indirectly by a property value that is replaced by Maven.

max=${max.value}

The ${propertyName} expression is replaced by the property value defined in the POM as a Maven property.

To perform the property value filtering, it is necessary to add a project/build/resources/testResources/testResource definition to the pom.xml file. The testResources definition instructs Maven to copy the files for testing, and the filtering option replaces ${} expressions with property values.

A similar definition is possible for main resources: project/build/resources/resources/resource.

Maven instructions

To print the project dependencies:

mvn dependency:tree

To compile the source code:

mvn compile

To run tests:

mvn test

To install in the local Maven repository (where it can later be found as a dependency):

mvn install

If you execute install all of the previous phases - including compile and test - are also executed.

To configure the Maven project in Eclipse

'File', 'Import...', 'Maven'-'Existing Maven Projects'

'Select root directory' and 'Browse' to the project base folder.

Check that the desired POM is selected and 'Finish'.


SD Faculty

Releases

No releases published

Packages

No packages published

Languages