When I try to test a locally written iteration, the compiler says there is a duplicate class

The program doesn’t compile while locally it passed all the test.
This is the compiler output:

[ERROR] /tmp/solution/src/main/java/src/Tournament.java:[7,8] duplicate class: Tournament
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.0:compile (default-compile) on project exercise: Compilation failure
[ERROR] /tmp/solution/src/main/java/src/Tournament.java:[7,8] duplicate class: Tournament
[ERROR] → [Help 1]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] MojoFailureException - Apache Maven - Apache Software Foundation

These are the files I edited and submitted locally (I don’t see any reason to put the whole code in here) using this command:

Exercism submit Tournament.java Team.java

I see that if I comment the package src; line, it shows the error above, but if I don’t it says that I didn’t implement the methods:

Message: Please implement the Tournament.applyResults() method.
Exception: java.lang.UnsupportedOperationException: Please implement the Tournament.applyResults() method.
at TournamentTest.typicalInput(TournamentTest.java:109)


package src;

import java.lang.reflect.*;
import java.util.ArrayList;
import java.util.Collections;

public class Tournament {
    String unformString;
    ArrayList<Team> teams;
    //Team teams[] = new Team[0];

    private static final int NUM_OF_SPACES = 31;
    private static final int FIRST_TEAM = 0;
    private static final int SECOND_TEAM = 1;
    private static final int RESULT = 2;
    public Tournament() {
        teams = new ArrayList<Team>();

And this is Team.java:

package src;

public class Team implements Comparable<Team>{
    String name;
    int MP;
    int W;
    int D;
    int L;
    int P;

    public Team(String name) {
        this.name = name;
        MP = W = D = L = P =0;

I can’t seem to create 2 files in the online editor therefore I can’t just copy the code to the online editor.


For us to better see what the problem is, it would be great if you could tell us:

  • Do you have the most recent version of the exercise? You can check this by going to the exercise page and if you don’y see an yellow banner, then you have the exercise updated.
  • What files did you edit locally?
  • What files did you submit via the CLI? (what command did you run?)
  • The contents of the files you changed. You can use a service like https://fluffy.cc/ to paste you code and provide the link. Only the files you’ve actually changed are needed.

You can also submit the exercise via exercism submit and request mentoring.

And you can show code here, using fence blocks:


class HelloWorld
    // Your program begins with a call to main().
    // Prints "Hello, World" to the terminal window.
    public static void main(String args[])
        System.out.println("Hello, World");

Hey @sagochka - thanks for posting and welcome to the Exercism Forum, great to have you here.

I moved this post into the #support category as I feel it is more relevant there.

I’m sure everything will get solved with the phenomenal help of the Exercism Community.

1 Like