2010-06-30 51 views
1

其實我試圖在netbeans中創建maven項目,但是當我打算構建它失敗並將消息作爲「Error building POM(may not be這個項目的POM)」,所以我需要它幫助....一步一步通過在NetBeans中使用maven創建4層項目6.8

更新:低於所要求的信息:

的pom.xml:

<?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/maven-v4_0_0.xsd">   
    <modelVersion>4.0.0</modelVersion>   
    <groupId>com.demo</groupId> 
    <artifactId>DemoProject</artifactId> 
    <version>1.0-SNAPSHOT</version> 
    <packaging>pom</packaging> 

    <name>DemoProject</name> 
    <description>Demo Project</description> 

    <modules> 
     <module>DemoModel</module> 
     <module>DemoDao</module> 
     <module>DemoService</module>   
     <module>DemoWeb</module> 
    </modules> 
    <build> 
     <resources> 
      <resource> 
       <filtering>true</filtering> 
       <directory>src/test/resources</directory> 
       <includes> 
        <include>**/*.properties</include> 
       </includes> 
      </resource> 
      <resource> 
       <filtering>true</filtering> 
       <directory>src/main/resources</directory> 
       <includes> 
        <include>**/*.properties</include> 
       </includes> 
      </resource> 
      <resource> 
       <directory>src/main/resources</directory> 
       <excludes> 
        <exclude>**/*.properties</exclude> 
       </excludes> 
      </resource> 
     </resources> 
     <plugins>   
      <plugin> 
       <artifactId>maven-compiler-plugin</artifactId> 
       <version>2.0</version> 
       <configuration> 
        <source>1.5</source> 
        <target>1.5</target> 
       </configuration> 
      </plugin> 
     </plugins> 
    </build> 
    <dependencies> 

    </dependencies> 
    <reporting> 
     <plugins> 
      <plugin> 
       <artifactId>maven-surefire-report-plugin</artifactId> 
      </plugin> 
      <plugin> 
       <artifactId>maven-pmd-plugin</artifactId> 
       <configuration> 
        <targetJdk>${compileSource}</targetJdk> 
       </configuration> 
      </plugin> 
      <plugin> 
       <groupId>org.codehaus.mojo</groupId> 
       <artifactId>cobertura-maven-plugin</artifactId> 
      </plugin> 
      <plugin> 
       <artifactId>maven-checkstyle-plugin</artifactId> 
      </plugin> 
     </plugins> 
    </reporting> 

    <pluginRepositories> 
     <pluginRepository> 
      <id>maven-repo</id> 
      <name>Maven repo</name> 
      <url>http://repo1.maven.org/maven2</url> 
     </pluginRepository> 
     <pluginRepository> 
      <id>java.net</id> 
      <name>Java.net Repository for Maven2</name> 
      <url>http://download.java.net/maven/1/</url> 
      <layout>legacy</layout> 
     </pluginRepository> 

    </pluginRepositories> 
    <developers> 
    <developer> 
      <id>ttinwala</id> 
      <name>Taher Tinwala</name> 
      <email>[email protected]</email> 
      <organization>Demo Technologies Pvt. Ltd.</organization> 
      <organizationUrl>http://www.demo.com</organizationUrl> 
      <roles> 
       <role>Developer</role> 
      </roles> 
     </developer> 
    </developers> 
</project> 

錯誤日誌:

[ERROR]BUILD ERROR 
------------------------------------------------------------------------ 
Error building POM (may not be this project's POM). 


Project ID: org.apache.maven.plugins:maven-resources-plugin 

Reason: POM 'org.apache.maven.plugins:maven-resources-plugin' not found in repository: Unable to download the artifact from any repository 

    org.apache.maven.plugins:maven-resources-plugin:pom:2.3 

from the specified remote repositories: 
    central (http://repo1.maven.org/maven2), 
    unknown-jars-temp-repo (file:C:\Documents and Settings\Administrator\Desktop\taher\demomodel/lib), 
    hibernate-support (http://download.java.net/maven/2) 

for project org.apache.maven.plugins:maven-resources-plugin 
+0

請提供完整的錯誤消息(下面還有*「錯誤建築POM有用信息(可能不這個項目的POM)「*)。同時在你的問題中發佈罪魁禍首POM。在當前狀態下回答這個問題是不可能的。 – 2010-06-30 15:05:29

回答

0

該問題可能是由於不良(例如,損壞)元數據(因爲maven-resources-plugin絕對可用in the central repository)。

我建議刪除~/.m2/respository/org/apache/maven/plugins/maven-resources-plugin/並重試。

順便說一句,你不需要申報(你默認有它):

<pluginRepository> 
    <id>maven-repo</id> 
    <name>Maven repo</name> 
    <url>http://repo1.maven.org/maven2</url> 
</pluginRepository> 
相關問題