eclipse 運行Maven時報錯總結

Non-resolvable parent POM

複製代碼
[INFO] Scanning for projects...
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]   
[ERROR]   The project com.iflytek.ossp:ossp-resserver-service:1.0.0-SNAPSHOT (C:\Users\moon\Desktop\ossp-resservice-maven\ossp-resserver-service\pom.xml) has 1 error
[ERROR]     Non-resolvable parent POM: Could not find artifact com.iflytek.ossp:ossp-resserver-all:pom:1.0.0-SNAPSHOT and 'parent.relativePath' points at wrong local POM @ line 11, column 10 -> [Help 2]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException
[ERROR] [Help 2] http://cwiki.apache.org/confluence/display/MAVEN/UnresolvableModelException
複製代碼

無法解析父級的POM文件,應該是是POM文件中使用了繼承。

<parent>
        <groupId>com.iflytek.ossp</groupId>
        <artifactId>ossp-resserver-all</artifactId>
        <version>1.0.0-SNAPSHOT</version>
</parent>

可以嘗試加入<relativePath>

<parent>
        <groupId>com.iflytek.ossp</groupId>
        <artifactId>ossp-resserver-all</artifactId>
        <version>1.0.0-SNAPSHOT</version>
        <relativePath>../ossp-resserver-all/pom.xml</relativePath>
</parent>

 

Unable to locate the Javac Compiler in

複製代碼
Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project ossp-resserver-service: Compilation failure
[ERROR] Unable to locate the Javac Compiler in:
[ERROR] C:\Java\jre6\..\lib\tools.jar
[ERROR] Please ensure you are using JDK 1.4 or above and
[ERROR] not a JRE (the com.sun.tools.javac.Main class is required).
[ERROR] In most cases you can change the location of your Java
[ERROR] installation by setting the JAVA_HOME environment variable.
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
複製代碼

出現類似的錯誤應該是Jre配置問題:

右擊項目->Java Buid Path->Libraries->JRE->Edit->Install JREs...->Edit->JRE system libraries->Add External JREs..->找到缺少的jar(toos.jar)添加進去。

 

No goals have been specified for this build.

Maven Buid時出現下面這個錯誤:

複製代碼
[ERROR] No goals have been specified for this build. You must specify a valid lifecycle phase or a goal in the format <plugin-prefix>:<goal> or <plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>. Available lifecycle phases are: validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy, pre-clean, clean, post-clean, pre-site, site, post-site, site-deploy. -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/NoGoalSpecifiedException
複製代碼

是因爲沒有指定buid goal,在POM文件中的buid節中加入默認值就行了。

<defaultGoal>compile</defaultGoal>

 

將第三方jar包發佈到私服

1、首先要修改eclipse中的Maven配置。

不要使用內嵌的默認配置。

指向Maven的安裝目錄。

 

2、配置Maven的setting.xml

複製代碼
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
  <pluginGroups>
  </pluginGroups>
  <proxies>
  </proxies>
  <servers>
    <server>
      <id>nexus-releases</id>
      <username>admin</username>
      <password>123</password>
    </server>
    <server>
      <id>nexus-snapshots</id>
      <username>admin</username>
      <password>123</password>
    </server>
  </servers>
  <mirrors>
  </mirrors>

  <profiles>
    <profile>
      <id>dev</id>
      <repositories>
        <repository>
          <id>local-nexus</id>
          <url>http://192.168.77.214:9088/nexus/content/groups/public/</url>
          <releases>
            <enabled>true</enabled>
          </releases>
          <snapshots>
            <enabled>true</enabled>
          </snapshots>
        </repository>
      </repositories>
    </profile>
  </profiles>
  <activeProfiles>
    <activeProfile>dev</activeProfile>
  </activeProfiles>
</settings>
複製代碼

 

3、發佈第三方jar包

作者:zhanjindong
出處:http://www.cnblogs.com/magialmoon
個人博客:http://zhanjindong.info
關於:一個程序員而已
說明:目前的技術水平有限,博客定位於學習心得和總結。
導入一個Maven項目之後發現有一個如下的錯誤:

Project configuration is not up-to-date with pom.xml. Run project configuration update


其實這個問題解決非常簡單:
在項目上右鍵——【Maven】——【Update Project Configuration……】
這時會打開一個(Update Maven Dependencies)的對話框,然後勾選住出錯的項目,點擊Ok
這樣就搞定了。



發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章