Ändern der Hauptklasse und dependencys in maven

Hi,


habe hier ein sehr simples maven Projekt das einfach nicht starten will.
angelegt mit netbans, ohne speziellen archetype, einfach "Java Application".

Die pom.xml:
Code:
<?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.mycompany</groupId>
    <artifactId>xml_parsen2</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>jar</packaging>
    <dependencies>
        <dependency>
            <groupId>org.jsoup</groupId>
            <artifactId>jsoup</artifactId>
            <version>1.10.3</version>
        </dependency>
    </dependencies>
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
    </properties>
</project>


Und hier die Klasse:
Code:
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.mycompany.xml_parsen2;

import java.io.File;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.parser.Parser;
import org.jsoup.select.Elements;

/**
 *
 * @author JJU
 */
public class Lala {

    public static void main(String[] args) {
      
        Document doc = Jsoup.parse("src\\main\\java\\myparser.xml");

        Element subtitle = doc.select("company").first();
        System.out.println(subtitle.toString());

        /*Element content = doc.getElementById("content");
        Elements links = content.getElementsByTag("a");
        for (Element link : links) {
            String linkHref = link.attr("href");
            String linkText = link.text();
        }*/
    }
}

Wie unschwer zu erkennen ist die Klasse ganz hervorragend benannt, eigentlich ein simples Projekt.
Ein Netbeans "Run" gibt mir aber:
Code:
Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:exec (default-cli) on project xml_parsen2: Command execution failed. Process exited with an error: 1 (Exit value: 1) -> [Help 1]

Was eigentlich nicht sein kann da ich nur eine Klasse im von Netbeans erstelltem Paket erstellt habe, warum findet maven die Main in der Klasse nicht?
 
Anscheinend legt netbeans das Projekt an ohne das es mit exec:java von Maven lauffähig ist.
Mit dieser Erweiterung in der pom.xml
Code:
<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>com.mycompany.xml_parsen2.Lala</mainClass>
                   
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

klappt das Maven goal exec:java dennoch.
Schade nur das er exec:java nicht anbietet zum anklicken links unten wenn man das Projekt selektiert, dort werden diverse Goals aufgelistet nur nicht exec:java
 

Neue Themen


Oben