Departamento-de-Engenharia-Informatica / greenspace-management

0 stars 0 forks source link

Project Template

This is the project template for LEI's second semester 2023/2024 Integrative Project.

It contains didactic artifacts relevant to the Integrative Project to be developed during the second semester of the academic year of 2023-2024 in the Degree in Informatics Engineering (LEI) from Instituto Superior de Engenharia do Porto (ISEP).

In particular, it has:

How to generate the svg files

On project root folder, run the following script:

Remarks: it works for Linux and MacOS. For Windows, you have to adapt the script.

$ bin/generate-plantuml-diagrams.sh

How the project is organized

This project uses Java and Maven.

We have to declare the maven-surefire-plugin in the pom.xml file and configure the dependencies of this plugin.

We have to declare the following dependencies:

The junit-platform-surefire-provider dependency allows us to run tests that use either the “old” JUnit (3 or 4) or JUnit 5.

If we want to run tests that use JUnit 5, we have to declare the junit-jupiter-engine dependency.

Maven goals

Run the unit tests

mvn clean test

Generate javadoc for the source code

mvn javadoc:javadoc

Generate javadoc for the test code

mvn javadoc:test-javadoc

Generate Jacoco source code coverage report

mvn test jacoco:report

Check if thresholds limits are achieved

mvn test jacoco:check

Generates a PIT Mutation coverage report to target/pit-reports/YYYYMMDDHHMI

mvn org.pitest:pitest-maven:mutationCoverage

Generates a quicker PIT Mutation coverage report to target/pit-reports/YYYYMMDDHHMI

mvn org.pitest:pitest-maven:mutationCoverage -DwithHistory

Complete example

mvn test javadoc:javadoc jacoco:report org.pitest:pitest-maven:mutationCoverage -DhistoryInputFile=target/fasterPitMutationTesting-history.txt -DhistoryOutputFile=target/fasterPitMutationTesting-history.txt -Dsonar.pitest.mode=reuseReport -Dthreads=4 -DtimestampedReports=false

Jacoco dependencies

How to generate a Jar package for the project

Place the following plugin on the appropriate place of the pom.xml file.

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-assembly-plugin</artifactId>
    <version>3.6.0</version>
    <executions>
        <execution>
            <phase>package</phase>
            <goals>
                <goal>single</goal>
            </goals>
            <configuration>
                <archive>
                    <manifest>
                        <mainClass>pt.ipp.isep.dei.esoft.project.ui.Main</mainClass>
                    </manifest>
                </archive>
                <descriptorRefs>
                    <descriptorRef>jar-with-dependencies</descriptorRef>
                </descriptorRefs>
            </configuration>
        </execution>
    </executions>
</plugin>

Run the following command on the project root folder. You can use IntelliJ to run the command or the command line of your computer if you hav Maven installed.

mvn package

How to run the project from the generated Jar Package

Run the following command on the project root folder. You can use IntelliJ to run the command or the command line of your computer if you hav Maven installed.

java -jar target/project-template-1.0-SNAPSHOT-jar-with-dependencies.jar