NetBeans: Re-run Maven with the -e switch on / Plu

2020-04-07 05:16发布

问题:

i have no clue about Maven and Netbeans, i updated my netbeans and now my test is not working anymore:

Plugin org.apache.maven.plugins:maven-resources-plugin:2.5 or one of its dependencies could not be resolved: Failed    to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.5: Could not transfer artifact    org.apache.maven.plugins:maven-resources-plugin:pom:2.5 from/to central (http://repo1.maven.org/maven2): pr-dfs-bank-   00.emea.isn.corpintra.net: Unknown host pr-dfs-bank-00.emea.isn.corpintra.net -> [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.

For more information about the errors and possible solutions, please read the following articles:
[Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException

How can i activate the -e or -X switch using netbeans, i saw many examples with "mvn clean" and so on, but I installed Maven via Netbeans so i dont have it on a folder for command line. I dont get the error message and wanna check out a more detailed log.

I searched my code for this pr-dfs-bank-00.emea.isn.corpintra.net mentioned in the error message, but it is not part of my source code.

My pom.xml, its supposed to be Maven2 and Selenium

<?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>
    <version>1.0</version>

    <repositories>
        <repository>
          <id>central</id>
          <name>Maven Repository Switchboard</name>
          <layout>default</layout>
          <url>http://repo1.maven.org/maven2</url>
          <snapshots>
            <enabled>false</enabled>
          </snapshots>
        </repository>
    </repositories>

    <pluginRepositories>
        <pluginRepository>
          <id>central</id>
          <name>Maven Plugin Repository</name>
          <url>http://repo1.maven.org/maven2</url>
          <layout>default</layout>
          <snapshots>
            <enabled>false</enabled>
          </snapshots>
          <releases>
            <updatePolicy>never</updatePolicy>
          </releases>
        </pluginRepository>
    </pluginRepositories> 

    <properties>
        <maven.build.timestamp.format>yyMMdd-HHmm</maven.build.timestamp.format>
        <project.build.sourceEncoding>windows-1252</project.build.sourceEncoding>
        <lfadapter>${project.basedir}/../lib/lf_CAdapter-4.0.jar</lfadapter>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
            <version>6.3.1</version>
            <scope>test</scope>
            <type>jar</type>
        </dependency>

        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-java</artifactId>
            <version>2.17.0</version>
        </dependency>

        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-ie-driver</artifactId>
            <version>2.17.0</version>
        </dependency>

        <dependency> 
            <groupId>org.apache.poi</groupId> 
            <artifactId>poi-ooxml</artifactId> 
            <version>3.8-beta5</version> 
        </dependency>        

        <dependency>
            <groupId>org.hamcrest</groupId>
            <artifactId>hamcrest-all</artifactId>
            <version>1.1</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <testSourceDirectory>src/</testSourceDirectory>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.3.2</version>
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                    <failOnError>false</failOnError>
                    <debug>true</debug>
                    <verbose>true</verbose>
                    <showWarnings>true</showWarnings>
                    <showDeprecation>true</showDeprecation>
                    <encoding>${project.build.sourceEncoding}</encoding>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-site-plugin</artifactId>
                <version>3.0</version>
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                    <showDeprecation>true</showDeprecation>
                    <encoding>${project.build.sourceEncoding}</encoding>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.12</version>
                <configuration>
                    <disableXmlReport>false</disableXmlReport>
                    <forkMode>always</forkMode>
                    <redirectTestOutputToFile>true</redirectTestOutputToFile>
                    <failIfNoTests>false</failIfNoTests>
                    <redirectTestOutputToFile>true</redirectTestOutputToFile>
                    <workingDirectory>reports/${maven.build.timestamp}/</workingDirectory>
                    <reportsDirectory>reports/surefire/</reportsDirectory>
                    <reporting>
                        <plugins>
                            <plugin>
                                <groupId>org.apache.maven.plugins</groupId>
                                <artifactId>maven-surefire-report-plugin</artifactId>
                                <version>2.12</version>
                            </plugin>
                        </plugins>
                    </reporting>
                    <properties>
                        <property>
                            <name>showSuccess</name>
                            <value>true</value>
                        </property>
                    </properties>
                    <suiteXmlFiles>
                        <suiteXmlFile>testng-suite.xml</suiteXmlFile>
                    </suiteXmlFiles>
                </configuration>
                <executions>
                    <execution>
                        <phase>test</phase>
                        <goals>
                            <goal>test</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
                <version>2.5</version>
                <configuration>
                    <encoding>${project.build.sourceEncoding}</encoding>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>netbeans-private-testng</id>
            <activation>
                <activeByDefault>true</activeByDefault>
                <property>
                    <name>netbeans.testng.action</name>
                </property>
            </activation>
        </profile>
    </profiles>
</project>

I think my pom.xml is not really the way its supposed to be :(

Any help is appreciated :)

回答1:

most likely you have a mirror or proxy defined in one of the maven's settings.xml files (eg. in ~/.m2/settings.xml) and the definition is wrong? like pointing to a wrong server?



回答2:

NetBeans 6.9.1 - Mac OS X

To activate the switches you need through Netbeans, go to Preferences --> Miscellaneous --> Maven, then enter the following under Global Execution Options:

--debug --errors

NetBeans - Windows

Add debug and errors to Maven in NetBeans (from version 7.3 at up) as follows:

  1. Click Tools.
  2. Click Options.
  3. Click the Java icon.
  4. Click the Maven tab.
  5. Append to Global Execution Options: --debug --errors
  6. Click OK.

Maven will execute the application with debug and error information included.



回答3:

In Netbeans 8.0.2 you define this on the project properties->Actions Then select the action where you want to specify the arguments to pass



回答4:

On netbeans 8.2, Tools > Options > (see below figure)

  1. enter "maven" in the search box
  2. type "--debug --errors" in the "Global ...".