L
L
LikeKey2021-04-04 14:18:18
Java
LikeKey, 2021-04-04 14:18:18

How to solve error when starting project with maven?

I start the bot with

mvn exec:java -Dexec.mainClass="com.likekey.telegram.TelegramBotApplication"

But an error pops up:
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:java (default-cli) on project TelegramBotSend: An exception occured while executing the Java class. TelegramBotApplication -> [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

pom file:
<?xml version="1.0" encoding="UTF-8"?>
<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>com.likekey.telegrambotsend</groupId>
    <artifactId>TelegramBotSend</artifactId>
    <version>1.0-SNAPSHOT</version>

    <properties>
        <maven.compiler.source>15</maven.compiler.source>
        <maven.compiler.target>15</maven.compiler.target>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.telegram</groupId>
            <artifactId>telegrambots</artifactId>
            <version>5.1.1</version>
        </dependency>

        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-core</artifactId>
            <version>5.4.30.Final</version>
        </dependency>

        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>8.0.23</version>
        </dependency>

        <dependency>
            <groupId>com.qiwi</groupId>
            <artifactId>bill-payments-java-sdk</artifactId>
            <version>1.5.0</version>
        </dependency>
        <dependency>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>exec-maven-plugin</artifactId>
            <version>1.2.1</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <version>1.2.1</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>java</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <mainClass>TelegramBotApplication</mainClass>
                </configuration>
            </plugin>
        </plugins>
    </build>

</project>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
BorLaze, 2021-04-04
@BorLaze

Well, maven directly tells you - to see the full stacktrace, add the -e flag.
But so, offhand, there are suspicions that if exec.mainClass="com.likekey.telegram.TelegramBotApplication" is specified, then the mainClass tag should also contain the full path, and not just TelegramBotApplication

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question