Sealyu

--- 博客已迁移至: http://www.sealyu.com/blog

  BlogJava :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理 ::
  618 随笔 :: 87 文章 :: 225 评论 :: 0 Trackbacks

http://livingash.wordpress.com/2007/08/16/struts-2-and-sun-micros-toolsjar-in-eclipse-wtp/

The configuration free classic way to start Eclipse with desired VM.

$>eclipse -vm "C:\Program Files\Java\jdk1.6.0_01\bin"

这个问题一般是由于使用了struts2引起的:
用了m2eclipse 插件后,使用struts2时,需要依赖 com.sun 的 default-tools.jar,见pom.xml





<?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>cn.tianxing.gehouse.admin</groupId>

  <artifactId>admin.gehouse.cn</artifactId>

  <name>admin.gehouse.cn</name>

  <version>0.0.1</version>

  <description>admin.gehouse.cn</description>

  <url>http://admin.gehouse.cn</url>

  <issueManagement>

    <system>jira</system>

    <url>http://jira.gehouse.cn:8080/BrowseProject.jspa?id=10000</url>

  </issueManagement>

  <ciManagement>

    <system>continuum</system>

    <url>http://ci.gehouse.cn:8090/continuum</url>

    <notifiers>

      <notifier>

        <type>msn</type>

        <sendOnSuccess>false</sendOnSuccess>

        <sendOnWarning>false</sendOnWarning>

        <configuration>

          <address>kylindai@hotmail.com</address>

        </configuration>

      </notifier>

      <notifier>

        <type>msn</type>

        <sendOnSuccess>false</sendOnSuccess>

        <sendOnWarning>false</sendOnWarning>

        <configuration>

          <address>larrin2002@msn.com</address>

        </configuration>

      </notifier>

      <notifier>

        <type>msn</type>

        <sendOnSuccess>false</sendOnSuccess>

        <sendOnWarning>false</sendOnWarning>

        <configuration>

          <address>manjingtou-ren@hotmail.com</address>

        </configuration>

      </notifier>

    </notifiers>

  </ciManagement>

  <inceptionYear>2007-05</inceptionYear>

  <developers>

    <developer>

      <name>kylin.dai</name>

      <email>kylin.dai@gehouse.cn</email>

    </developer>

    <developer>

      <name>larrin.luo</name>

      <email>larrin.luo@gehouse.cn</email>

    </developer>

    <developer>

      <name>jason.ren</name>

      <email>jason.ren@gehouse.cn</email>

    </developer>

  </developers>

  <scm>

    <connection>scm:svn:svn://svn.gehouse.cn/sandbox/kylin/admin.gehouse.cn/trunk</connection>

  </scm>

  <organization>

    <name>gehouse.cn</name>

    <url>http://www.gehouse.cn</url>

  </organization>

  <build>

    <plugins>

      <plugin>

        <artifactId>maven-compiler-plugin</artifactId>

        <version>2.0.2</version>

        <configuration>

          <source>1.6</source>

          <target>1.6</target>

        </configuration>

      </plugin>

    </plugins>

  </build>

  <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>1.5.0</version>

          <scope>system</scope>

          <systemPath>${java.home}/../lib/tools.jar</systemPath>

        </dependency>

      </dependencies>

    </profile>

  </profiles>

  <dependencies>

    <dependency>

      <groupId>log4j</groupId>

      <artifactId>log4j</artifactId>

      <version>1.2.14</version>

    </dependency>

    <dependency>

      <groupId>javax.servlet</groupId>

      <artifactId>servlet-api</artifactId>

      <version>2.5</version>

    </dependency>

    <dependency>

      <groupId>dom4j</groupId>

      <artifactId>dom4j</artifactId>

      <version>1.6.1</version>

    </dependency>

    <dependency>

      <groupId>com.ibatis</groupId>

      <artifactId>ibatis</artifactId>

      <version>2.3.0.667</version>

    </dependency>

    <dependency>

      <groupId>junit</groupId>

      <artifactId>junit</artifactId>

      <version>4.1</version>

    </dependency>

    <dependency>

      <groupId>mysql</groupId>

      <artifactId>mysql-connector-java</artifactId>

      <version>5.0.5</version>

    </dependency>

    <dependency>

      <groupId>org.extremecomponents</groupId>

      <artifactId>extremecomponents</artifactId>

      <version>1.0.1</version>

    </dependency>

    <dependency>

      <groupId>commons-dbcp</groupId>

      <artifactId>commons-dbcp</artifactId>

      <version>1.2.1</version>

    </dependency>

    <dependency>

      <groupId>org.springframework</groupId>

      <artifactId>spring</artifactId>

      <version>2.0.5</version>

    </dependency>

    <dependency>

      <groupId>org.springframework</groupId>

      <artifactId>spring-mock</artifactId>

      <version>2.0.5</version>

    </dependency>

    <dependency>

      <groupId>org.springframework</groupId>

      <artifactId>spring-aspects</artifactId>

      <version>2.0.5</version>

    </dependency>

    <dependency>

      <groupId>org.apache.struts</groupId>

      <artifactId>struts2-core</artifactId>

      <version>2.0.6</version>

    </dependency>

  </dependencies>

  <reporting>

    <plugins>

      <plugin>

        <artifactId>maven-changelog-plugin</artifactId>

      </plugin>

      <plugin>

        <artifactId>maven-checkstyle-plugin</artifactId>

      </plugin>

      <plugin>

        <artifactId>maven-pmd-plugin</artifactId>

      </plugin>

      <plugin>

        <artifactId>maven-changes-plugin</artifactId>

        <reportSets>

          <reportSet>

            <reports>

              <report>jira-report</report>

            </reports>

          </reportSet>

        </reportSets>

      </plugin>

    </plugins>

  </reporting>

</project>





这个pom.xml 在eclipse里加载的时候总是报告:



Missing:

1) com.sun:tools:jar:1.4.2

Try downloading the file manually from the project website.

Then, install it using the command:



mvn install:install-file -DgroupId=com.sun -DartifactId=tools "

-Dversion=1.4.2 -Dpackaging=jar -Dfile=/path/to/file

Path to dependency:



原来,是${java.home}在作怪,eclipse 没有使用 JAVA_HOME

默认,eclipse 使用 C:"windows"system32"javaw.exe 作为 JVM,当然找不到tools.jar



解决方法如下:

修改 eclipse.exe 目录下的 eclipse.ini 指定vm,加入红色黑体字部分,注意 -vm后面不能有空格。



-vm

D:"Program Files"Java"jdk1.6.0_01"bin"javaw.exe

-vmargs

-Xms128m

-Xmx512m



再次启动 eclipse,问题解决。



上面的pom.xml文件,也是一个 Mavne2 & Continuum 的例子,由我写的 Maven2 &
Continuum 持续整合 (3),发布时,网络故障丢失了,也不打算重新再写一篇了,上述的pom.xml,可以在continuum的 add




maven2 projects 里,添加使用,设好 scheduler,可以设1小时 build 一次,半小时 test 一次,等不同的任务


posted on 2010-01-10 11:02 seal 阅读(3825) 评论(0)  编辑  收藏 所属分类: Maven

只有注册用户登录后才能发表评论。


网站导航: