Maven 3 Artifact problem(Maven 3 工件问题)
问题描述
我使用 struts2-archtype-starter 在 eclipse 中创建了一个新的 struts 项目.
I made a new struts project in eclipse using the struts2-archtype-starter.
在我做任何事情之前,我的项目中已经出现了一些错误.解决了大部分问题,但有 1 个仍然给我一些问题.
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.
缺少工件 com.sun:tools:jar:1.5.0:system pom.xml
我尝试手动将 tools.jar 添加到我的存储库,但这并没有解决问题.
I tried to add the tools.jar to my repository manually but that didn't solve the issue.
我的 pom 是这样的
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>
推荐答案
您看到的错误可能是因为您没有正确设置 JAVA_HOME 路径.您是否看到类似 C:{directories to jre}..lib ools.jar 的内容?
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 ools.jar?
您可以通过更改 eclipse.ini 并添加类似的内容来使用内置的 JDK 启动 eclipse
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}injavaw.exe
我了解到的是eclipse默认会使用你的系统jre来启动eclipse.您可能在启动 eclipse 时看到类似Eclipse 在 JRE 下运行并且 m2eclipse 需要 JDK 某些插件将无法工作"的消息
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"
如果您转到(在 Eclipse 中)帮助 -> 安装详细信息并查找 -vm,您可能会看到它指向的地方没有预期的路径结构.
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.
注意:无论出于何种原因,当我遇到这个问题时,maven 中的 java.home 是从 eclipse 的启动位置进行评估的.因此,当它尝试从它所看到的 java.home 中提取 tools.jar 时,它可能不是您实际设置为 JAVA_HOME 作为环境/系统变量的内容.
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 工件问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Maven 3 工件问题
- Jersey REST 客户端:发布多部分数据 2022-01-01
- 从 finally 块返回时 Java 的奇怪行为 2022-01-01
- Eclipse 插件更新错误日志在哪里? 2022-01-01
- Java包名称中单词分隔符的约定是什么? 2022-01-01
- 如何使用WebFilter实现授权头检查 2022-01-01
- Spring Boot连接到使用仲裁器运行的MongoDB副本集 2022-01-01
- 将log4j 1.2配置转换为log4j 2配置 2022-01-01
- value & 是什么意思?0xff 在 Java 中做什么? 2022-01-01
- Safepoint+stats 日志,输出 JDK12 中没有 vmop 操作 2022-01-01
- C++ 和 Java 进程之间的共享内存 2022-01-01
