简体   繁体   中英

Add tools.jar to Maven 1.x and Eclipse

Does anyone know how to add the tools.jar in the Sun/Oracle JDK to the Maven 1.x dependencies, in such a way that it will be added to the Eclipse build path after running:

>maven eclipse

I can add the tools.jar dependency as a pregoal in my maven.xml, but that doesn't help me when I run the above command to set up my project dependencies in Eclipse. Requiring everyone who checks out the sourcecode to manually edit their project dependencies in Eclipse is an antipattern.

Please note that this has to be for Maven 1.x, as our project is too large and has too much configuration to upgrade to Maven 2 or 3 in the foreseeable future.

Thank you!

Possible dulicate of Java + Maven1.x : how to add sun's tools.jar? .

No matter the project size, I strongly recommend scheduling the time to migrate from Maven 1.x to Maven 3. (Do not even consider moving to Maven 2, as that would not make much sense). I do understand you. I have had to carry out large migrations (200-400 modules in both companies I did it for) from Ant to Maven 2.x and from Maven 1.x to Maven 2.x. My point here is that Maven 1.x has reached it's end of life some 2-3 years ago (possibly even more). There are few people who would be glad to help you with Jelly-based messes and you'll sink deeper.

You can try adding the tools.jar as a dependency of your project:

<dependency>
      <groupId>com.sun</groupId>
      <artifactId>tools</artifactId>
      <version>1.4.2</version>
      <scope>system</scope>
      <systemPath>${java.home}/../lib/tools.jar</systemPath>
      <properties>
           <eclipse.dependency>true</eclipse.dependency>
      </properties>
</dependency>

If the old documentation pages weren't deprecated, I would have had a look and would have probably been of more help. Tell you "stakeholders" to think about which year it is. Technologies expire and need updating. Obviously, for the creators of certain software to decide to expire it and ask you to upgrade to something newer, they ought to have a really good reason such as -- it's not as good as it should be and they have something better for you.

Have a look here and here . Hopefully, you'll be able to figure it out.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM