Problem with Maven 3 Artifact

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

A few mistakes when there was already something to do in my project. I solved most of them, but there is another question that still gives me some problems.

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

I tried manually adding tools.jar to my repository, but this did not solve the problem.

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> 
+33
java eclipse maven-3 m2eclipse struts2
Apr 22 2018-11-11T00:
source share
9 answers

The error you see is probably because you do not have the correct JAVA_HOME path. Do you see something like C:\{directories to jre}\..\lib\tools.jar ?

You can trigger an eclipse using the built-in JDK by modifying eclipse.ini and adding something like

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

What I found out is that eclipse will use your jre system by default to run eclipse. You probably saw a message when starting eclipse, similar to "Eclipse works under JRE, and m2eclipse requires JDK, some plugins will not work"

If you go into (eclipse) Help -> Installation Details and look for -vm, you will probably see that this indicates where there is no path structure that it expects.

Note. For some reason, when I ran into this problem, java.home in maven was appreciated since eclipse started. So when he tries to pull tools.jar from what he sees as java.home, it may not be what you are actually setting as JAVA_HOME as an env / system variable.

+44
Apr 22 2018-11-11T00:
source share
 <dependency> <groupId>org.apache.struts</groupId> <artifactId>struts2-core</artifactId> <version>${struts2.version}</version> <exclusions> <exclusion> <artifactId>tools</artifactId> <groupId>com.sun</groupId> </exclusion> </exclusions> </dependency> 
+10
Sep 15 '11 at 12:22
source share

You cannot use tools.jar from the repository.

Unfortunately, something in your dependency tree thinks you can. Therefore, you must use β€œexcludes” to get rid of the existing dependency, and then replace it with the following.

If you specify a version in the match below that you might not need to β€œexclude” in the error message.

You need:

  <profiles> <profile> <id>default-tools.jar</id> <activation> <property> <name>java.vendor</name> <value>Sun Microsystems Inc.</value> </property> </activation> <dependencies> <dependency> <groupId>com.sun</groupId> <artifactId>tools</artifactId> <version>whatever</version> <scope>system</scope> <systemPath>${java.home}/../lib/tools.jar</systemPath> </dependency> </dependencies> </profile> 

+3
Apr 22 2018-11-21T00:
source share

Need to add another answer. After updating m2e to 1.4.20130601-0317, the error returned. Again, none of the proposed solutions worked, including the one I just proposed. In the end, I found that the culprit: including org.htmlparser:1.6 had an implicit dependency on tools.jar . I don't know why uninstalling the installed jre helped with the older m2e (1.0.something). Now the solution is to throw out tools.jar :

  <dependency> <groupId>org.htmlparser</groupId> <artifactId>htmlparser</artifactId> <version>1.6</version> <exclusions> <exclusion> <artifactId>tools</artifactId> <groupId>com.sun</groupId> </exclusion> </exclusions> </dependency> 
+2
Jul 26 '13 at 16:13
source share

I recently had the same problem, but none of the above solutions worked for me. I met http://blog.samratdhillon.com/archives/598 and decided that this is the Eclipse error mentioned there.

I had to remove all installed jre from Eclipse configuration (Window -> Preferences -> Java -> Installed JREs) and save only one jdk. After that, maven worked fine, without any changes to eclipse.ini or anything else. This is with Ecplise Indigo Service Release 1.

+1
Jul 24 '13 at 14:26
source share

Example eclipse.ini:

 -startup plugins/org.eclipse.equinox.launcher_1.2.0.v20110502.jar --launcher.library plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.100.v20110502 -product org.eclipse.epp.package.java.product --launcher.defaultAction openFile --launcher.XXMaxPermSize 256M -showsplash org.eclipse.platform --launcher.XXMaxPermSize 256m --launcher.defaultAction openFile -vm C:\Java\JDK\1.6\bin\javaw.exe -vmargs -Dosgi.requiredJavaVersion=1.5 -Xms40m -Xmx1024m 

-vm value: Linux Example:

 -vm /opt/sun-jdk-1.6.0.02/bin/java 

From enter link description here

0
Dec 17
source share

Confusingly, the $ {java.home} property will actually resolve its value from the JRE_HOME environment variable .

http://docs.codehaus.org/display/MAVENUSER/MavenPropertiesGuide (search java.home)

If you do not want to change JAVA_HOME in jre root, then create the JRE_HOME variable instead .

0
Jun 14 '13 at 15:28
source share

The main problem is that mavan cannot process tool.jar. so this problem occurs u just add the tool.jar file to your project. Tool.jar is present in your java software C: \ Program Files \ Java \ jdk1.6.0_14 \ lib
try this code, I hope you successfully http://maven.apache.org/xsd/maven-4.0.0.xsd "> 4.0.0 Strust2Testing Strust2Testing 0.0.1-SNAPSHOT war org.apache.struts

  <artifactId>Struts2-core </artifactId> <version>2.3.15.1</version> <exclusions> <exclusion> <artifactId>tools</artifactId> <groupId>com.sun</groupId> </exclusion> </exclusions> </dependency> </dependencies> <build> <sourceDirectory>src</sourceDirectory> <plugins> <plugin> <artifactId>maven-compiler-plugin</artifactId> <version>3.1</version> <configuration> <source>1.6</source> <target>1.6</target> </configuration> </plugin> <plugin> <artifactId>maven-war-plugin</artifactId> <version>2.3</version> <configuration> <warSourceDirectory>WebContent</warSourceDirectory> <failOnMissingWebXml>false</failOnMissingWebXml> </configuration> </plugin> </plugins> </build> 

0
Nov 28 '13 at 6:21
source share

sudo apt-get install openjdk-7-source

-one
Jul 12 '13 at 16:59
source share



All Articles