代码之家  ›  专栏  ›  技术社区  ›  Guillaume

Java+Mave1.x:如何添加Sun的工具?

  •  1
  • Guillaume  · 技术社区  · 15 年前

    我必须将tools.jar添加到我的 Mave1 构建配置,但我找不到任何帮助。

    以下是我使用geo的helpfull建议找到的解决方案:

    我修改了maven.xml构建,以便在类路径中添加tools.jar。 Java之前的一个目标:编译:

    <preGoal name="java:compile">
        <ant:path id="tools">
            <ant:pathelement path="${tools.jar}"/>
        </ant:path>
        <maven:addPath id="maven.dependency.classpath" refid="tools"/>
    </preGoal>
    

    以下是我的调查结果,可以帮助一些人实现同样的想法。 马文2.x

    如何在我的 依赖关系?

    以下代码包括tools.jar 对于Windows、Linux和Solaris上的JDK (它已包含在运行时中) 对于Mac OS X和一些免费的JDK)。

      ...
      <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.4.2</version>
              <scope>system</scope>
              <systemPath>${java.home}/../lib/tools.jar</systemPath>
            </dependency>
          </dependencies>
        </profile>
      </profiles>
      ...
    
    2 回复  |  直到 15 年前
        1
  •  3
  •   Geo    15 年前
    <classpath>
          <pathelement location="path_to_toold_folder/tools.jar"/>
    </classpath>
    

    应该有技巧。这只在蚂蚁任务中有效。

        2
  •  1
  •   Guillaume    15 年前

    感谢geo,我修改了maven.xml构建,以便在类路径中添加tools.jar。

    Java之前的一个目标:编译:

    <preGoal name="java:compile">
        <ant:path id="tools">
            <ant:pathelement path="${tools.jar}"/>
        </ant:path>
        <maven:addPath id="maven.dependency.classpath" refid="tools"/>
    </preGoal>
    
    推荐文章