Maven问题缺少神器(jsf-api.jar)

时间:2010-07-13 07:14:31

标签: java maven-2 jsf-2

我为Eclipse安装了M2Eclipse Plug-In。我对maven不太熟悉。我的问题是我无法下载两个文物:

    13.07.10 08:53:30 MESZ: Build errors for test; org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal on project test: Missing:
----------
1) com.sun.faces:jsf-api:jar:2.0.0-b13

  Try downloading the file manually from the project website.

  Then, install it using the command: 
      mvn install:install-file -DgroupId=com.sun.faces -DartifactId=jsf-api -Dversion=2.0.0-b13 -Dpackaging=jar -Dfile=/path/to/file

  Alternatively, if you host your own repository you can deploy the file there: 
      mvn deploy:deploy-file -DgroupId=com.sun.faces -DartifactId=jsf-api -Dversion=2.0.0-b13 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]

  Path to dependency: 
   1) de.studi:Studentenportal:pom:pom:0.0.1-SNAPSHOT
   2) com.sun.faces:jsf-api:jar:2.0.0-b13

2) com.sun.faces:jsf-impl:jar:2.0.0-b13

  Try downloading the file manually from the project website.

  Then, install it using the command: 
      mvn install:install-file -DgroupId=com.sun.faces -DartifactId=jsf-impl -Dversion=2.0.0-b13 -Dpackaging=jar -Dfile=/path/to/file

  Alternatively, if you host your own repository you can deploy the file there: 
      mvn deploy:deploy-file -DgroupId=com.sun.faces -DartifactId=jsf-impl -Dversion=2.0.0-b13 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]

  Path to dependency: 
   1) de.studi:Studentenportal:pom:pom:0.0.1-SNAPSHOT
   2) com.sun.faces:jsf-impl:jar:2.0.0-b13

----------
2 required artifacts are missing.

for artifact: 
  de.studi:Studentenportal:pom:0.0.1-SNAPSHOT

from the specified remote repositories:
  central (http://repo1.maven.org/maven2, releases=true, snapshots=false)

这是我的POM.XML:

<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>de.test</groupId>
  <artifactId>test</artifactId>
  <packaging>war</packaging>
  <version>0.0.1-SNAPSHOT</version>
  <name>Studentenportal Maven Webapp</name>
  <url>http://maven.apache.org</url>
  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
    <!-- JSF/JSTL/Facelets -->
    <dependency>
      <groupId>com.sun.faces</groupId>
      <artifactId>jsf-api</artifactId>
      <version>2.0.3</version>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>com.sun.faces</groupId>
      <artifactId>jsf-impl</artifactId>
      <version>2.0.3</version>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>javax.servlet</groupId>
      <artifactId>jstl</artifactId>
      <version>1.2</version>
    </dependency>
    <dependency>
      <groupId>javax.servlet</groupId>
      <artifactId>servlet-api</artifactId>
      <version>2.5</version>
    </dependency>
  </dependencies>
  <build>
   <finalName>test</finalName>
  </build>
</project>

我尝试使用几个版本的JSF2但没有成功。


我在pom.xml中添加了以下内容:

<repositories>
    <repository>
      <id>maven2-repository.dev.java.net</id>
      <name>Java.net Repository for Maven</name>
      <url>http://download.java.net/maven/2/</url>
      <layout>default</layout>
    </repository>
</repositories>

但问题仍然存在。那有什么不对吗?


好的,我明白了!该项目可以建立。不幸的是我不知道为什么。我没有改变一些东西:-)

现在我只收到Maven的警告:

13.07.10 10:04:04 MESZ: Unable to update index for central|http://repo1.maven.org/maven2
13.07.10 10:03:42 MESZ: [WARN] Missing POM for com.sun.faces:jsf-api:jar:2.0.0
13.07.10 10:03:43 MESZ: Updating index central|http://repo1.maven.org/maven2
13.07.10 10:04:04 MESZ: [WARN] Missing POM for com.sun.faces:jsf-impl:jar:2.0.0
13.07.10 10:04:04 MESZ: Unable to download Repository[d9d714e11cb097b3ffcec91cccc65d3e|http://repo1.maven.org/maven2/.index]/nexus-maven-repository-index.properties: java.net.ConnectException: Connection timed out: no further information
13.07.10 10:04:25 MESZ: Downloading http://repo1.maven.org/maven2/com/sun/faces/jsf-impl/2.0.0/jsf-impl-2.0.0.jar
13.07.10 10:04:25 MESZ: Downloading http://repo1.maven.org/maven2/com/sun/faces/jsf-api/2.0.0/jsf-api-2.0.0.jar
13.07.10 10:04:25 MESZ: Downloaded http://repo1.maven.org/maven2/com/sun/faces/jsf-api/2.0.0/jsf-api-2.0.0.jar
13.07.10 10:04:25 MESZ: Downloaded http://repo1.maven.org/maven2/com/sun/faces/jsf-impl/2.0.0/jsf-impl-2.0.0.jar
13.07.10 10:04:25 MESZ: [WARN] *** CHECKSUM FAILED - Checksum failed on download: local = 'a2477a115d96ab5bddd88400beb176eaf43816d7'; remote = '<!--' - RETRYING
13.07.10 10:04:25 MESZ: [WARN] *** CHECKSUM FAILED - Checksum failed on download: local = '83e1d5e415a35d55de79ab2c9a79bdd3182aa48a'; remote = '<!--' - RETRYING
13.07.10 10:04:26 MESZ: Downloading http://repo1.maven.org/maven2/com/sun/faces/jsf-api/2.0.0/jsf-api-2.0.0.jar
13.07.10 10:04:26 MESZ: Downloaded http://repo1.maven.org/maven2/com/sun/faces/jsf-api/2.0.0/jsf-api-2.0.0.jar
13.07.10 10:04:26 MESZ: Downloading http://repo1.maven.org/maven2/com/sun/faces/jsf-impl/2.0.0/jsf-impl-2.0.0.jar
13.07.10 10:04:26 MESZ: Downloaded http://repo1.maven.org/maven2/com/sun/faces/jsf-impl/2.0.0/jsf-impl-2.0.0.jar
13.07.10 10:04:26 MESZ: [WARN] *** CHECKSUM FAILED - Checksum failed on download: local = 'b912ac4338d2bd37982d2d887fb82ac8fc5d54a2'; remote = '<!--' - IGNORING
13.07.10 10:04:26 MESZ: [WARN] *** CHECKSUM FAILED - Checksum failed on download: local = '5e645760133f915dbc0da3d16edd304fdf8e8113'; remote = '<!--' - IGNORING
13.07.10 10:04:26 MESZ: Maven Builder: FULL_BUILD requireFullBuild
13.07.10 10:04:28 MESZ: [WARN] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
13.07.10 10:04:28 MESZ: [INFO] Copying 0 resource
13.07.10 10:04:28 MESZ: [INFO] No sources to compile
13.07.10 10:04:28 MESZ: [WARN] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
13.07.10 10:04:28 MESZ: [INFO] skip non existing resourceDirectory C:\StudiPortal\Workspaces\Studentenportal\src\test\resources
13.07.10 10:05:05 MESZ: Refreshing [/Studentenportal/pom.xml]
13.07.10 10:05:05 MESZ: Maven Builder: AUTO_BUILD requireFullBuild
13.07.10 10:05:05 MESZ: [WARN] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
13.07.10 10:05:05 MESZ: [INFO] Copying 0 resource
13.07.10 10:05:05 MESZ: [INFO] No sources to compile
13.07.10 10:05:05 MESZ: [WARN] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
13.07.10 10:05:05 MESZ: [INFO] skip non existing resourceDirectory C:\StudiPortal\Workspaces\Studentenportal\src\test\resources

它看起来并不那么好 - 尤其是失踪的POM警告令人焦虑。


更新

首先我将其更改为myfaces,然后将相应的存储库添加到.m2目录中的settings.xml。像那样:

<profile>
  <id>jdk-1.6</id>

  <activation>
    <jdk>1.6</jdk>
  </activation>

  <repositories>
        <repository>
        <id>JBOSS</id>
        <name>JBoss Repository</name>
        <url>http://repository.jboss.org/maven2/</url>
    </repository>
  </repositories>
</profile>

但是仍然存在maven无法找到工件的问题。请帮助: - )

2 个答案:

答案 0 :(得分:4)

你的groupId依赖是错误的。输入mvnrepository并在那里查找您的依赖项。

com.sun.faces应该是javax.faces(版本号也可能是错的)

如果你从某个博客或网页获得了这种依赖性,试着找出从哪里下载它。

答案 1 :(得分:0)

您的pom.xml及其父级,以及settings.xml中定义的maven存储库列表中都没有,您可以访问这些工件。

通常情况下,遇到这类问题时,我的第一步是检查mvnbrowser可用工件的位置。对于jsf-api,回复为quite simple:您必须将JavaNet存储库添加到您的pom.xml repositories