Class not found

0

I am testing a .jar where I will pass named parameters to the command line, etc. The problem is that it is not finding my main class. Someone help me?

package appOptions;

import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.CommandLineParser;
import org.apache.commons.cli.DefaultParser;
import org.apache.commons.cli.Options;
import org.apache.commons.cli.ParseException;

public class Main {

    public static void main(String[] args) throws ParseException {
        Options options = new Options();
        options.addOption("t", true, "Teste");

        CommandLineParser parser = new DefaultParser();
        CommandLine cmd = parser.parse( options, args);

        if(cmd.hasOption("t")) {
            System.out.println("Funcionou");
        }
        else {
            System.out.println("Não funcionou");
        }

    }

}

And my pom file:

<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.roknauta</groupId>
    <artifactId>appOptions</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-jar-plugin</artifactId>
            <version>2.3.2</version>
            <configuration>
                <archive>
                    <manifest>
                        <mainClass>com.roknauta.addOption.src.main.java.addOptions.Main</mainClass>
                    </manifest>
                </archive>
            </configuration>
        </plugin>
        </plugins>
    </build>
    <dependencies>
        <dependency>
            <groupId>commons-cli</groupId>
            <artifactId>commons-cli</artifactId>
            <version>1.3.1</version>
        </dependency>
    </dependencies>
</project>

I've changed my way and nothing.

    
asked by anonymous 31.01.2017 / 18:35

1 answer

0

Change this:

<mainClass>com.roknauta.addOption.src.main.java.addOptions.Main</mainClass>

To:

<mainClass>appOptions.Main</mainClass>
    
31.01.2017 / 19:17