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 閱讀(3833) 評論(0)  編輯  收藏 所屬分類: Maven
          主站蜘蛛池模板: 南丹县| 黎城县| 烟台市| 广德县| 金坛市| 三原县| 蕉岭县| 榆社县| 蓝山县| 汉中市| 灵石县| 密山市| 涟水县| 保山市| 鹤山市| 耒阳市| 南岸区| 开化县| 章丘市| 交城县| 共和县| 宜宾市| 彭州市| 青阳县| 林芝县| 榕江县| 肇东市| 隆安县| 郯城县| 甘德县| 侯马市| 新化县| 南汇区| 临泽县| 顺义区| 平陆县| 哈尔滨市| 清丰县| 望都县| 新竹县| 庆云县|