【问题标题】:How to run javaSE maven project on Netbeans with debug -X如何使用 debug -X 在 Netbeans 上运行 javaSE maven 项目
【发布时间】:2023-03-18 01:18:01
【问题描述】:

当我尝试运行项目时,我遇到了 BUILD FAILURE,如果我进行清理并构建,则没有错误。

我必须在哪里添加这个-X-e 参数才能看到问题出在哪里?我的 POM 没有定义任何插件。

------------------------------------------------------------------------
BUILD FAILURE
------------------------------------------------------------------------
Total time:  1.839 s
Finished at: 2020-08-27T10:54:32-03:00
 ------------------------------------------------------------------------
Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:exec (default-cli) on project validadorCliente: Command execution failed.: Process exited with an error: 1 (Exit value: 1) -> [Help 1]

To see the full stack trace of the errors, re-run Maven with the -e switch.
Re-run Maven using the -X switch to enable full debug logging.

POM

<?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</groupId>
    <artifactId>validadorCliente</artifactId>
    <version>1</version>
    <packaging>jar</packaging>
    <build>
        <resources>
            <resource>
                <targetPath>META-INF</targetPath>
                <directory>src</directory>
                <includes>
                    <include>jax-ws-catalog.xml</include>
                    <include>wsdl/**</include>
                </includes>
            </resource>
            <resource>
                <directory>src/main/resources</directory>
            </resource>
        </resources>
        <plugins>
            <plugin>
                <groupId>org.jvnet.jax-ws-commons</groupId>
                <artifactId>jaxws-maven-plugin</artifactId>
                <version>2.3</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>wsimport</goal>
                        </goals>
                        <configuration>
                            <wsdlFiles>
                                <wsdlFile>localhost_8080/saos-validador/Validador310Service.wsdl</wsdlFile>
                            </wsdlFiles>
                            <packageName></packageName>
                            <vmArgs>
                                <vmArg>-Djavax.xml.accessExternalSchema=all</vmArg>
                            </vmArgs>
                            <wsdlLocation>http://localhost:8080/saos-validador/Validador310Service?wsdl</wsdlLocation>
                            <staleFile>${project.build.directory}/jaxws/stale/Validador310Service.stale</staleFile>
                        </configuration>
                        <id>wsimport-generate-Validador310Service</id>
                        <phase>generate-sources</phase>
                    </execution>
                </executions>
                <dependencies>
                    <dependency>
                        <groupId>javax.xml</groupId>
                        <artifactId>webservices-api</artifactId>
                        <version>2.0</version>
                    </dependency>
                </dependencies>
                <configuration>
                    <sourceDestDir>${project.build.directory}/generated-sources/jaxws-wsimport</sourceDestDir>
                    <xnocompile>true</xnocompile>
                    <verbose>true</verbose>
                    <extension>true</extension>
                    <catalog>${basedir}/src/jax-ws-catalog.xml</catalog>
                </configuration>
            </plugin>
        </plugins>
    </build>
    <dependencies>
        <dependency>
            <groupId>org</groupId>
            <artifactId>SAOS-backend</artifactId>
            <version>1</version>
        </dependency>
        <dependency>
            <groupId>com.toedter</groupId>
            <artifactId>jcalendar</artifactId>
            <version>1.4</version>
        </dependency>
        <dependency>
            <groupId>org.swinglabs.swingx</groupId>
            <artifactId>swingx-all</artifactId>
            <version>1.6.5</version>
        </dependency>
        <dependency>
            <groupId>org.hotswapagent</groupId>
            <artifactId>hotswap-agent</artifactId>
            <version>1.3.0</version>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.hotswapagent</groupId>
                    <artifactId>hotswap-agent-spring-plugin</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.hotswapagent</groupId>
                    <artifactId>hotswap-agent-wildfly-el-plugin</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.hotswapagent</groupId>
                    <artifactId>hotswap-agent-tomcat-plugin</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.hotswapagent</groupId>
                    <artifactId>hotswap-agent-mojarra-plugin</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.hotswapagent</groupId>
                    <artifactId>hotswap-agent-jbossmodules-plugin</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.hotswapagent</groupId>
                    <artifactId>hotswap-agent-jersey1-plugin</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.hotswapagent</groupId>
                    <artifactId>hotswap-agent-jersey2-plugin</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.hotswapagent</groupId>
                    <artifactId>hotswap-agent-myfaces-plugin</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.hotswapagent</groupId>
                    <artifactId>hotswap-agent-owb-plugin</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.hotswapagent</groupId>
                    <artifactId>hotswap-agent-resteasy-registry-plugin</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.hotswapagent</groupId>
                    <artifactId>hotswap-agent-omnifaces-plugin</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.hotswapagent</groupId>
                    <artifactId>hotswap-agent-jetty-plugin</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.hotswapagent</groupId>
                    <artifactId>hotswap-agent-weld-plugin</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.hotswapagent</groupId>
                    <artifactId>hotswap-agent-zk-plugin</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.hotswapagent</groupId>
                    <artifactId>hotswap-agent-seam-plugin</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.hotswapagent</groupId>
                    <artifactId>hotswap-agent-deltaspike-plugin</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>javax.inject</groupId>
                    <artifactId>javax.inject</artifactId>
                </exclusion>
            </exclusions>
        </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>

【问题讨论】:

  • mvn clean package -X 是您提供-X 标志的方式。你能提供你的 pom.xml 吗?
  • 但是该命令只是构建它,构建没有错误,问题是当我尝试运行它时
  • 你有一些我在我的项目中没有的自定义依赖项。像 SAOS-Backend。
  • 是的,这是大多数@entity 和DAO 所在的后端,这个用于测试Web 服务saos-validador 的项目就像你看到的那样。我只是想知道我必须在哪里添加 IN netbeans -X
  • 啊。你没有构建问题?但是您要求-X-e 标志并最初说您遇到了构建问题。请编辑您的问题并具体说明问题所在。

标签: java maven netbeans


【解决方案1】:

问题出在 org.codehaus.mojo:exec-maven-plugin

  1. 确保您使用的是最新版本的插件(我认为是 3.0.0)
  2. 查看Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2:java (default-cli)

【讨论】:

  • 我试过了,但是遇到了另一个异常,Command execution failed. org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit value: 1) at org.apache.commons.exec.DefaultExecutor.executeInternal (DefaultExecutor.java:404) at org.apache.commons.exec.DefaultExecutor.execute (DefaultExecutor.java:166) .... .... BUILD FAILURE Total time: 2.896 s Failed to execute goal org.codehaus.mojo:exec-maven-plugin:3.0.0:exec (default-cli) on project validadorCliente: Command execution failed.:
  • 你为什么使用那个插件?需要吗?
  • 这是 Netbeans 运行每个 Maven java SE 桌面应用程序的方式
  • 好的,我明白了。查看这些解决方案stackoverflow.com/questions/20077870/…
  • 最新的 12.0,我创建了一个新项目,问题是当我创建 WS 客户端时,NB 提供的 4 种创建方法中的 2 种会引发奇怪的异常,并且在 WSDL 和 jaxws 生成源之后创建该项目不再运行,但我看不到它失败的原因,这就是为什么我想知道在哪里添加-X。我会试试 IntellJ
【解决方案2】:

在属性>操作>字段中执行目标-e -X

如果你想通过 Maven 来做:mvn -e -X "-Dexec.args= ....."

PD:我的问题与 IDE 或 Maven 无关,我有一个 NPE,我忽略了异常

 public static void main(String[] args) {
    try {
        MainView vista = new MainView(null, true);
        vista.setVisible(true);
    } catch (Exception ex) {
        //ex.printStackTrace(); <--- HERE WAS THE PROBLEM
        System.exit(1);
    }
}

感谢 Onur 和 Giorgi 抽出宝贵时间

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-07-11
    • 1970-01-01
    • 2011-04-10
    • 2013-05-08
    • 1970-01-01
    • 2016-01-12
    • 2020-05-03
    • 2015-12-19
    相关资源
    最近更新 更多