Maven 3神器问题 [英] Maven 3 Artifact problem

查看:123
本文介绍了Maven 3神器问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用struts2-archtype-starter在eclipse中创建了一个新的struts项目。



在我的项目中有一些错误,在做任何事情之前。解决了大多数,但有1仍然给我一些问题。



缺少的工件com.sun:tools:jar:1.5.0:系统pom.xml



我尝试将tools.jar手动添加到我的存储库,但没有解决问题。 >

我的pom看起来像这样

 <?xml version =1.0 encoding =UTF-8?> 

< project xmlns =http://maven.apache.org/POM/4.0.0xmlns: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.divespot< / groupId>
< artifactId>网站< / artifactId>
< packaging> war< / packaging>
< version> 0.0.1-SNAPSHOT< / version>
< name> E-Divespot潜水社区< / name>
< url> http://www.e-divespot.com< / url>
< description>一个支持世界各地潜水员的网站。< / description>

<依赖关系>
<! - Junit - >
<依赖关系>
< groupId> junit< / groupId>
< artifactId> junit< / artifactId>
< version> 4.8.2< / version>
< scope> test< / scope>
< / dependency>

<! - Struts 2 - >
<依赖关系>
< groupId> org.apache.struts< / groupId>
< artifactId> struts2-core< / artifactId>
< version> 2.0.11.2< / version>
< / dependency>
<依赖关系>
< groupId> org.apache.struts< / groupId>
< artifactId> struts2-sitemesh-plugin< / artifactId>
< version> 2.0.11.2< / version>
< / dependency>
<依赖关系>
< groupId> org.apache.struts< / groupId>
< artifactId> struts2-spring-plugin< / artifactId>
< version> 2.0.11.2< / version>
< / dependency>

<! - Servlet& Jsp - >
<依赖关系>
< groupId> javax.servlet< / groupId>
< artifactId> servlet-api< / artifactId>
< version> 2.4< / version>
< scope>已提供< / scope>
< / dependency>
<依赖关系>
< groupId> javax.servlet< / groupId>
< artifactId> jsp-api< / artifactId>
< version> 2.0< / version>
< scope>已提供< / scope>
< / dependency>

<! - 雅加达Commons - >
<依赖关系>
< groupId> commons-fileupload< / groupId>
< artifactId> commons-fileupload< / artifactId>
< version> 1.1.1< / version>
< / dependency>

<! - Dwr - >
<依赖关系>
< groupId> uk.ltd.getahead< / groupId>
< artifactId> dwr< / artifactId>
< version> 1.1-beta-3< / version>
< / dependency>
< / dependencies>

< build>
< finalName>网站< / finalName>
< plugins>
< plugin>
< artifactId> maven-compiler-plugin< / artifactId>
< configuration>
< source> 1.6< / source>
< target> 1.6< / target>
< / configuration>
< / plugin>
< plugin>
< groupId> org.mortbay.jetty< / groupId>
< artifactId> maven-jetty-plugin< / artifactId>
< version> 6.1.5< / version>
< configuration>
< scanIntervalSeconds> 10< / scanIntervalSeconds>
< / configuration>
< / plugin>
< / plugins>
< / build>
< / project>


解决方案

您所看到的错误可能是因为您没有您的JAVA_HOME路径设置正确。您是否看到类似于 C:\ {directories to jre} \..\lib\tools.jar



您可以通过更改eclipse.ini并添加类似于

 的内建JDK启动eclipse。 -vm 
C:\ {directory to JDK} \bin\javaw.exe

我学到的是,eclipse默认情况下会使用你的系统jre来启动eclipse。您可能已经看到一个消息,当启动eclipse类似于Eclipse运行在一个JRE和m2eclipse需要JDK一些插件将无法工作



如果你去eclipse)帮助 - >安装详细信息,并寻找一个-vm,你可能会看到它指向的地方没有它期望的路径结构。



注意:无论什么原因,当我遇到这个问题,在maven中的java.home被评估从哪里启动eclipse。所以当它尝试从所看到的java.home中将tools.jar拉出来时,可能不是你实际设置为JAVA_HOME作为一个env /系统变量。


I made a new struts project in eclipse using the struts2-archtype-starter.

A few errors where in my project already before doing anything. Solved most of them but there is 1 the still give me some problems.

Missing artifact com.sun:tools:jar:1.5.0:system pom.xml

I tried to add the tools.jar to my repository manually but that didn't solve the issue.

My pom looks like this

<?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.divespot</groupId>
    <artifactId>website</artifactId>
    <packaging>war</packaging>
    <version>0.0.1-SNAPSHOT</version>
    <name>E-Divespot diving community</name>
    <url>http://www.e-divespot.com</url>
    <description>A website to support divers from all around the world.</description>

    <dependencies>
        <!-- Junit -->
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.8.2</version>
            <scope>test</scope>
        </dependency>

        <!--  Struts 2 -->
        <dependency>
            <groupId>org.apache.struts</groupId>
            <artifactId>struts2-core</artifactId>
            <version>2.0.11.2</version>
        </dependency>
        <dependency>
            <groupId>org.apache.struts</groupId>
            <artifactId>struts2-sitemesh-plugin</artifactId>
            <version>2.0.11.2</version>
        </dependency>
        <dependency>
            <groupId>org.apache.struts</groupId>
            <artifactId>struts2-spring-plugin</artifactId>
            <version>2.0.11.2</version>
        </dependency>

        <!-- Servlet & Jsp -->
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>servlet-api</artifactId>
            <version>2.4</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>jsp-api</artifactId>
            <version>2.0</version>
            <scope>provided</scope>
        </dependency>

        <!-- Jakarta Commons -->
        <dependency>
            <groupId>commons-fileupload</groupId>
            <artifactId>commons-fileupload</artifactId>
            <version>1.1.1</version>
        </dependency>

        <!-- Dwr -->
        <dependency>
            <groupId>uk.ltd.getahead</groupId>
            <artifactId>dwr</artifactId>
            <version>1.1-beta-3</version>
        </dependency>
    </dependencies>

    <build>
      <finalName>website</finalName>
        <plugins>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                   <source>1.6</source>
                   <target>1.6</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.mortbay.jetty</groupId>
                <artifactId>maven-jetty-plugin</artifactId>
                <version>6.1.5</version>
                <configuration>
                    <scanIntervalSeconds>10</scanIntervalSeconds>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

解决方案

The error you are seeing is probably because you dont have your JAVA_HOME path set up correctly. Are you seeing something like C:\{directories to jre}\..\lib\tools.jar?

You can have eclipse start up using your built in JDK by altering the eclipse.ini and adding something like

-vm
C:\{directories to JDK}\bin\javaw.exe

What I have learned is that eclipse by default will use your system jre to start eclipse. You probably have seen a message when starting eclipse similar to "Eclipse is running under a JRE and m2eclipse requires a JDK some plugins will not work"

If you go to (in eclipse) Help -> Installation Details and look for a -vm you will probably see it pointing to somewhere that does not have the path structure that it is expecting.

Note: For whatever reason when I encountered this issue java.home in maven was evaluated from where eclipse was launched from. So when it tries to pull the tools.jar from what it sees as java.home it may not be what you actually set as JAVA_HOME as an env/system variable.

这篇关于Maven 3神器问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆