I'm trying to build a project in java and I'm struggling with maven. When I run
mvn compile
,
everything seems to work, but when I try to run mvn exec:java
the same error comes up, no matter what I do:
[INFO] Scanning for projects...
[INFO]
[INFO] -------------------------< MK_Degens:32er_Bot >-------------------------
[INFO] Building 32er_Bot 1.0
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- exec-maven-plugin:1.6.0:java (default-cli) @ 32er_Bot ---
[WARNING]
java.lang.ClassNotFoundException: src.com.statsbot.Bot
at java.net.URLClassLoader.findClass (URLClassLoader.java:445)
at java.lang.ClassLoader.loadClass (ClassLoader.java:587)
at java.lang.ClassLoader.loadClass (ClassLoader.java:520)
at org.codehaus.mojo.exec.ExecJavaMojo$1.run (ExecJavaMojo.java:270)
at java.lang.Thread.run (Thread.java:833)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.549 s
[INFO] Finished at: 2023-05-09T13:51:13+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.6.0:java (default-cli) on project 32er_Bot: An exception occured while executing the Java class. src.com.statsbot.Bot -> [Help 1]
[ERROR]
[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]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
this is my pom.xml:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>MK_Degens</groupId>
<artifactId>32er_Bot</artifactId>
<version>1.0</version>
<name>32er_Bot</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>org.telegram</groupId>
<artifactId>telegrambots</artifactId>
<version>6.0.1</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.6.0</version>
<executions>
<execution>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
<configuration>
<mainClass>src.com.statsbot.Bot</mainClass>
</configuration>
</plugin>
</plugins>
</build>
</project>
and my .java file is in the directory src and the first line is package com.statsbot;
. The class is called Bot
What do I have to do for maven to find my class?
So far I've tried running mvn exec:exec
and mvn clean install
and every conceivable way to put the mainClass into the pom.