Maven 3 Artifact problem

后端 未结 9 1427
旧巷少年郎
旧巷少年郎 2020-12-06 04:14

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 th

相关标签:
9条回答
  • 2020-12-06 04:33

    Need to add another answer. After upgrading m2e to 1.4.20130601-0317 the error came back. Again, none of the proposed solutions worked including the one I just proposed. Eventually, I found the culprit: including org.htmlparser:1.6 had an implicit dependency on tools.jar. No idea why deleting the installed jre's helped with the older m2e (1.0.something). Now the solution is to exclude 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>
    
    0 讨论(0)
  • 2020-12-06 04:37

    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.

    0 讨论(0)
  • 2020-12-06 04:37

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

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

    If you don't want to change JAVA_HOME to the jre root then create the JRE_HOME variable instead.

    0 讨论(0)
  • 2020-12-06 04:38
    <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>
    
    0 讨论(0)
  • 2020-12-06 04:45

    The example of 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 讨论(0)
  • 2020-12-06 04:50

    Having had the same problem recently none of the above solutions worked for me. I came across http://blog.samratdhillon.com/archives/598 and figured this to be the Eclipse bug mentioned there.

    I had to delete all installed jre's from Eclipse's configuration (Window -> Preferences -> Java -> Installed JREs) and only keep exactly one jdk. After that maven worked just fine without any modification to eclipse.ini or anything else. This is with Ecplise Indigo Service Release 1.

    0 讨论(0)
提交回复
热议问题