I am getting tired of manually installing javax jar files in Maven and would like to know what is the best solution to include a dependency on javax.cache, javax.transaction, or other JSRs that are not easy to find in Maven repositories.
我厌倦了在Maven中手动安装javax jar文件,并且想知道在javax.cache,javax.transaction或其他在Maven存储库中不容易找到的JSR中包含依赖项的最佳解决方案是什么。
5 个解决方案
#1
Have you seen http://maven.apache.org/guides/mini/guide-coping-with-sun-jars.html ?
你看过http://maven.apache.org/guides/mini/guide-coping-with-sun-jars.html吗?
This link suggests groupID and artifactID's to use, as well as a java.net repository.
此链接建议使用groupID和artifactID,以及java.net存储库。
It looks to me like almost all of these exist in the central Maven repository under this naming scheme.
在我看来,在这个命名方案下,几乎所有这些都存在于Maven*存储库中。
#2
I'm not aware of one, but adding the java.net repository may help you with some of these dependencies:
我不知道,但添加java.net存储库可能会帮助您解决这些依赖关系:
<repositories>
<repository>
<id>java.net repository</id>
<url>http://download.java.net/maven/2</url>
</repository>
</repositories>
#3
If building on more than one box and/or for team development, a local (intranet) maven repository manager can help with these "missing" jars. This centralizes the configuration and management of not only 3rd party jars that are not in a public repository, but also all external repositories in general. It could also help automate your builds, creating more 'reproducable' builds (e.g., if you have a pool of continuous integration servers).
如果构建在多个框和/或团队开发上,本地(Intranet)maven存储库管理器可以帮助这些“丢失”的jar。这不仅集中了不在公共存储库中的第三方jar的配置和管理,而且还集中了所有外部存储库的配置和管理。它还可以帮助自动化您的构建,创建更多“可重现”的构建(例如,如果您有一个持续集成服务器池)。
- install a mvn repo mgr (see list -- imo, nexus is really simple to start with);
- use a custom settings.xml that includes a "mirrors" section pointing to your intranet mvn repo mgr. Either update your ~/.m2/settings.xml, or run maven with "mvn -s etc/settings.xml"-- useful for hudson builds, where you don't want a custom per-user settings.xml;
- manually upload your 'problem' jars to your internal repo (again, super-simple w/ Nexus via a web-interface);
- set up the internal mvn repo mgr as a "mirror" of repo1.maven.org/maven2, codehaus, java.net, ... (etc).
安装一个mvn repo mgr(参见list - imo,nexus开头很简单);
使用自定义settings.xml,其中包含指向您的Intranet mvn repo mgr的“镜像”部分。更新〜/ .m2 / settings.xml,或者使用“mvn -s etc / settings.xml”运行maven - 对于hudson构建很有用,你不需要自定义的每用户settings.xml;
手动将您的“问题”罐子上传到您的内部仓库(再次,通过网络界面使用Nexus超级简单);
将内部mvn repo mgr设置为repo1.maven.org/maven2,codehaus,java.net,...(等)的“镜像”。
Now, you can centrally define all 3rd party repositories & 3rd party jars -- rather than requiring each person, each box and/or each project define them individually in their pom or settings.xml. Each project / person / box would ONLY define your central, internal maven repo as the single repo for all maven projects.
现在,您可以集中定义所有第三方存储库和第三方jar - 而不是要求每个人,每个框和/或每个项目在他们的pom或settings.xml中单独定义它们。每个项目/人/盒只能将您的*内部maven仓库定义为所有maven项目的单个仓库。
This also really speeds up your artifact re-download time for fresh builds, or for those times when you need to (or would like to) delete your local ~/.m2/repository cache.
这也真正加快了新构建的工件重新下载时间,或者当您需要(或希望)删除本地〜/ .m2 /存储库缓存时。
Repo managers: nexus, archiva, artifactory... e.g.,: maven.apache.org/repository-management.html - http://docs.codehaus.org/display/MAVENUSER/Maven+Repository+Manager+Feature+Matrix
回购经理:nexus,archiva,artifactory ......例如:maven.apache.org/repository-management.html - http://docs.codehaus.org/display/MAVENUSER/Maven+Repository+Manager+Feature+Matrix
#4
javax.cache
are in jcache:jcache:1.0-XXX
artifact (in Maven's central repo)
javax.cache在jcache中:jcache:1.0-XXX工件(在Maven的*仓库中)
<dependency>
<groupId>jcache</groupId>
<artifactId>jcache</artifactId>
<version>1.0-dev-2</version>
</dependency>
javax.transaction.*
classes are in javax.transaction:jta:1.1
artifact, JTA jar can’t be inserted in the Maven repository because the Sun’s Binary License (I know, this sucks). To use it you need to download manually the JAR (it's free) and put it into a local repo or use 1.0.1B version which is contained in java.net
.
javax.transaction。*类在javax.transaction:jta:1.1工件中,JTA jar不能插入Maven存储库,因为Sun的二进制许可证(我知道,这很糟糕)。要使用它,您需要手动下载JAR(它是免费的)并将其放入本地存储库或使用java.net中包含的1.0.1B版本。
NOTE: I've read in some place JTA will be integrated in future versions of the JDK
注意:我在某些地方读过JTA将集成到JDK的未来版本中
I know is really a pain to find these artifacts in Maven's repositories but you can make a search of a class in www.mvnrepository.com and it will show you the correct groupId and artifactId for mostly all the packages.
我知道在Maven的存储库中找到这些工件真的很痛苦,但你可以在www.mvnrepository.com中搜索一个类,它会显示大多数所有包的正确groupId和artifactId。
#5
In the particular case of JTA, I hit this post:
在JTA的特定情况下,我点击了这篇文章:
http://www.jugpadova.it/articles/2005/11/26/maven-2-spring-and-jta-depencies
.. which makes sense, if I didn't have to spend a lot of time in Oracle's horrible site to get the forementioned JAR file. (I was an Oracle's enthusiast myself but that site could use a lot of UX rework here and there).
..这是有道理的,如果我不必花费大量时间在甲骨文的可怕网站上获得前面提到的JAR文件。 (我自己是Oracle的*爱好者,但该网站可以在这里和那里使用大量的UX返工)。
I decided to replace the dependency with what Hibernate provides, via Geronimo, as per this post (worked perfectly):
我决定用这个帖子(完美地工作)通过Geronimo替换Hibernate提供的依赖项:
https://forum.hibernate.org/viewtopic.php?p=2420836
The deal with Java licensing and Maven is currently being worked on by the Hibernate team, or so it seems here:
目前,Hibernate团队正在处理与Java许可和Maven的交易,或者看起来似乎在这里:
https://hibernate.onjira.com/browse/HHH-4548
Thanks to everyone for sharing!
感谢大家分享!
#1
Have you seen http://maven.apache.org/guides/mini/guide-coping-with-sun-jars.html ?
你看过http://maven.apache.org/guides/mini/guide-coping-with-sun-jars.html吗?
This link suggests groupID and artifactID's to use, as well as a java.net repository.
此链接建议使用groupID和artifactID,以及java.net存储库。
It looks to me like almost all of these exist in the central Maven repository under this naming scheme.
在我看来,在这个命名方案下,几乎所有这些都存在于Maven*存储库中。
#2
I'm not aware of one, but adding the java.net repository may help you with some of these dependencies:
我不知道,但添加java.net存储库可能会帮助您解决这些依赖关系:
<repositories>
<repository>
<id>java.net repository</id>
<url>http://download.java.net/maven/2</url>
</repository>
</repositories>
#3
If building on more than one box and/or for team development, a local (intranet) maven repository manager can help with these "missing" jars. This centralizes the configuration and management of not only 3rd party jars that are not in a public repository, but also all external repositories in general. It could also help automate your builds, creating more 'reproducable' builds (e.g., if you have a pool of continuous integration servers).
如果构建在多个框和/或团队开发上,本地(Intranet)maven存储库管理器可以帮助这些“丢失”的jar。这不仅集中了不在公共存储库中的第三方jar的配置和管理,而且还集中了所有外部存储库的配置和管理。它还可以帮助自动化您的构建,创建更多“可重现”的构建(例如,如果您有一个持续集成服务器池)。
- install a mvn repo mgr (see list -- imo, nexus is really simple to start with);
- use a custom settings.xml that includes a "mirrors" section pointing to your intranet mvn repo mgr. Either update your ~/.m2/settings.xml, or run maven with "mvn -s etc/settings.xml"-- useful for hudson builds, where you don't want a custom per-user settings.xml;
- manually upload your 'problem' jars to your internal repo (again, super-simple w/ Nexus via a web-interface);
- set up the internal mvn repo mgr as a "mirror" of repo1.maven.org/maven2, codehaus, java.net, ... (etc).
安装一个mvn repo mgr(参见list - imo,nexus开头很简单);
使用自定义settings.xml,其中包含指向您的Intranet mvn repo mgr的“镜像”部分。更新〜/ .m2 / settings.xml,或者使用“mvn -s etc / settings.xml”运行maven - 对于hudson构建很有用,你不需要自定义的每用户settings.xml;
手动将您的“问题”罐子上传到您的内部仓库(再次,通过网络界面使用Nexus超级简单);
将内部mvn repo mgr设置为repo1.maven.org/maven2,codehaus,java.net,...(等)的“镜像”。
Now, you can centrally define all 3rd party repositories & 3rd party jars -- rather than requiring each person, each box and/or each project define them individually in their pom or settings.xml. Each project / person / box would ONLY define your central, internal maven repo as the single repo for all maven projects.
现在,您可以集中定义所有第三方存储库和第三方jar - 而不是要求每个人,每个框和/或每个项目在他们的pom或settings.xml中单独定义它们。每个项目/人/盒只能将您的*内部maven仓库定义为所有maven项目的单个仓库。
This also really speeds up your artifact re-download time for fresh builds, or for those times when you need to (or would like to) delete your local ~/.m2/repository cache.
这也真正加快了新构建的工件重新下载时间,或者当您需要(或希望)删除本地〜/ .m2 /存储库缓存时。
Repo managers: nexus, archiva, artifactory... e.g.,: maven.apache.org/repository-management.html - http://docs.codehaus.org/display/MAVENUSER/Maven+Repository+Manager+Feature+Matrix
回购经理:nexus,archiva,artifactory ......例如:maven.apache.org/repository-management.html - http://docs.codehaus.org/display/MAVENUSER/Maven+Repository+Manager+Feature+Matrix
#4
javax.cache
are in jcache:jcache:1.0-XXX
artifact (in Maven's central repo)
javax.cache在jcache中:jcache:1.0-XXX工件(在Maven的*仓库中)
<dependency>
<groupId>jcache</groupId>
<artifactId>jcache</artifactId>
<version>1.0-dev-2</version>
</dependency>
javax.transaction.*
classes are in javax.transaction:jta:1.1
artifact, JTA jar can’t be inserted in the Maven repository because the Sun’s Binary License (I know, this sucks). To use it you need to download manually the JAR (it's free) and put it into a local repo or use 1.0.1B version which is contained in java.net
.
javax.transaction。*类在javax.transaction:jta:1.1工件中,JTA jar不能插入Maven存储库,因为Sun的二进制许可证(我知道,这很糟糕)。要使用它,您需要手动下载JAR(它是免费的)并将其放入本地存储库或使用java.net中包含的1.0.1B版本。
NOTE: I've read in some place JTA will be integrated in future versions of the JDK
注意:我在某些地方读过JTA将集成到JDK的未来版本中
I know is really a pain to find these artifacts in Maven's repositories but you can make a search of a class in www.mvnrepository.com and it will show you the correct groupId and artifactId for mostly all the packages.
我知道在Maven的存储库中找到这些工件真的很痛苦,但你可以在www.mvnrepository.com中搜索一个类,它会显示大多数所有包的正确groupId和artifactId。
#5
In the particular case of JTA, I hit this post:
在JTA的特定情况下,我点击了这篇文章:
http://www.jugpadova.it/articles/2005/11/26/maven-2-spring-and-jta-depencies
.. which makes sense, if I didn't have to spend a lot of time in Oracle's horrible site to get the forementioned JAR file. (I was an Oracle's enthusiast myself but that site could use a lot of UX rework here and there).
..这是有道理的,如果我不必花费大量时间在甲骨文的可怕网站上获得前面提到的JAR文件。 (我自己是Oracle的*爱好者,但该网站可以在这里和那里使用大量的UX返工)。
I decided to replace the dependency with what Hibernate provides, via Geronimo, as per this post (worked perfectly):
我决定用这个帖子(完美地工作)通过Geronimo替换Hibernate提供的依赖项:
https://forum.hibernate.org/viewtopic.php?p=2420836
The deal with Java licensing and Maven is currently being worked on by the Hibernate team, or so it seems here:
目前,Hibernate团队正在处理与Java许可和Maven的交易,或者看起来似乎在这里:
https://hibernate.onjira.com/browse/HHH-4548
Thanks to everyone for sharing!
感谢大家分享!