Skip to content

Upgrade Build System #7196

@shashanknr172-beep

Description

@shashanknr172-beep

What would you like to Propose?

<modelVersion>4.0.0</modelVersion>

<groupId>com.thealgorithms</groupId>
<artifactId>java</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>

<name>The Algorithms – Java</name>
<description>
    A modern Java algorithms repository using Java 21,
    strict code quality checks, testing, and security analysis.
</description>
<url>https://github.com/your-username/the-algorithms-java</url>

<licenses>
    <license>
        <name>MIT License</name>
        <url>https://opensource.org/licenses/MIT</url>
    </license>
</licenses>

<developers>
    <developer>
        <name>Shashank NR</name>
        <role>Maintainer</role>
    </developer>
</developers>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <maven.compiler.release>21</maven.compiler.release>
    <assertj.version>3.27.6</assertj.version>
</properties>

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.junit</groupId>
            <artifactId>junit-bom</artifactId>
            <version>6.0.2</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>

<dependencies>
    <!-- Testing -->
    <dependency>
        <groupId>org.junit.jupiter</groupId>
        <artifactId>junit-jupiter</artifactId>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.assertj</groupId>
        <artifactId>assertj-core</artifactId>
        <version>${assertj.version}</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.mockito</groupId>
        <artifactId>mockito-core</artifactId>
        <version>5.21.0</version>
        <scope>test</scope>
    </dependency>

    <!-- Utilities -->
    <dependency>
        <groupId>org.apache.commons</groupId>
        <artifactId>commons-lang3</artifactId>
        <version>3.20.0</version>
    </dependency>
    <dependency>
        <groupId>org.apache.commons</groupId>
        <artifactId>commons-collections4</artifactId>
        <version>4.5.0</version>
    </dependency>
</dependencies>

<build>
    <plugins>

        <!-- Compiler -->
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.14.1</version>
            <configuration>
                <compilerArgs>
                    <arg>-Xlint:all</arg>
                    <arg>-Werror</arg>
                </compilerArgs>
            </configuration>
        </plugin>

        <!-- Testing -->
        <plugin>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>3.5.4</version>
        </plugin>

        <!-- Coverage -->
        <plugin>
            <groupId>org.jacoco</groupId>
            <artifactId>jacoco-maven-plugin</artifactId>
            <version>0.8.14</version>
            <executions>
                <execution>
                    <goals>
                        <goal>prepare-agent</goal>
                    </goals>
                </execution>
                <execution>
                    <phase>test</phase>
                    <goals>
                        <goal>report</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>

        <!-- Code Style -->
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-checkstyle-plugin</artifactId>
            <version>3.6.0</version>
            <configuration>
                <configLocation>checkstyle.xml</configLocation>
                <includeTestSourceDirectory>true</includeTestSourceDirectory>
            </configuration>
        </plugin>

        <!-- Static Analysis -->
        <plugin>
            <groupId>com.github.spotbugs</groupId>
            <artifactId>spotbugs-maven-plugin</artifactId>
            <version>4.9.8.2</version>
        </plugin>

        <!-- PMD -->
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-pmd-plugin</artifactId>
            <version>3.28.0</version>
            <configuration>
                <includeTests>true</includeTests>
            </configuration>
        </plugin>

    </plugins>
</build>

Issue details

Your pom.xml is already technically strong (modern Java 21, testing, quality gates). but these changes can be to even look more structured . these what the changes i tried to make i think these seems to be correct if any thing is wrong in the code please let me know.

  1. Upgraded build configuration to Java 21 (LTS)
  2. Enabled strict compiler checks using -Xlint:all and -Werror
  3. Standardized compiler configuration using maven-compiler-plugin
  4. Integrated JUnit Jupiter (JUnit 6) for unit testing
  5. Added AssertJ for fluent, readable assertions
  6. Added Mockito for mocking and isolated unit tests
  7. Configured Maven Surefire Plugin for reliable test execution

THANK YOU

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions