spring3.x对应的maven中pom的依赖配置参考

Maven Repositories where Spring Artifacts are Published

In general, Spring publishes its artifacts to two different places:

  1. Maven Central, which is the default repository Maven queries, and does not require any special configuration to use
  2. The Enterprise Bundle Repository (EBR), which is run by SpringSource and also hosts all the libraries that integrate with Spring

So the first thing you need to decide when obtaining Spring with Maven is which place you'll get it from. In general, if you care about OSGi, use the EBR, since it houses OSGi compatibleartifacts for all of Spring's dependencies, such as Hibernate and Freemarker. If OSGi does not matter to you, either place works, though there are some pros and cons between them. In general, pick one place or the other for your project; do not mix them. This is particularly important since EBR artifacts use a different naming convention than Maven Central artifacts.

Below is a table that compares Maven Central to the EBR in several areas:

FeatureMaven CentralEnterprise Bundle Repository (EBR)
OSGi CompatibleNoYes
Number of ArtifactsTens of thousands; all kindsHundreds; those that Spring integrates/supports
Consistent Naming Conventions for all Artifacts?NoYes
Artifact Naming ConventionGroup id Varies; newer artifacts use domain name e.g. "org.sl4j"; older artifacts use artifact id e.g. "log4j" Artifact id Varies; typically the JAR file name minus extension e.g. "log4j" Version Varies; most use numbers and dots e.g. "3.0.0"Group id <Domain name> e.g. "org.springframework" Artifact id <Bundle-SymbolicName>, derived from main package e.g. "org.springframework.beans". If the JAR had to be patched to ensure OSGi compliance, "com.springsource." is prepended e.g. "com.springsource.org.apache.log4j" VersionOSGi version number format of <major>.<minor>.<micro>[.qualifier] e.g. "3.0.0.RC3"
PublishingAutomatic (rSync via remote repositories)Manual (JIRA processed by SpringSource)
Quality AssuranceNone I am aware of; Accuracy is responsibility of publishing organizationExtensive (for both MANIFEST.mf and .pom); QA is performed by Spring Team
Hosting@ Contegix funded by Sonatype with several mirrorsS3 funded by SpringSource
Search UtilitiesVariouswww.springsource.com/repository
Integrated with SpringSource Tools (STS, Roo, etc)Yes, with STS and RooYes, with STS

Now that you know the options, I'll discuss how to obtain Spring artifacts from both places.

Obtaining Spring Releases From Maven Central

You do not have to add a repository to your .pom to obtain final releases of Spring projects from Maven Central. Simply add the dependencies your project requires.

A .pom <dependency> snippet for each Spring Framework 3 artifact as it will be indexed in Maven Central is listed below.

<!-- Shared version number properties -->
<properties>
    <org.springframework.version>3.0.5.RELEASE</org.springframework.version>
</properties>

<!--
    Core utilities used by other modules.
    Define this if you use Spring Utility APIs (org.springframework.core.*/org.springframework.util.*)
-->
<dependency>
  <groupId>org.springframework</groupId>
  <artifactId>spring-core</artifactId>
  <version>${org.springframework.version}</version>
</dependency>

<!--
    Expression Language (depends on spring-core)
    Define this if you use Spring Expression APIs (org.springframework.expression.*)
-->
<dependency>
  <groupId>org.springframework</groupId>
  <artifactId>spring-expression</artifactId>
  <version>${org.springframework.version}</version>
</dependency>

<!-- 
    Bean Factory and JavaBeans utilities (depends on spring-core)
    Define this if you use Spring Bean APIs (org.springframework.beans.*) 
-->
<dependency>
  <groupId>org.springframework</groupId>
  <artifactId>spring-beans</artifactId>
  <version>${org.springframework.version}</version>
</dependency>

<!--
    Aspect Oriented Programming (AOP) Framework (depends on spring-core, spring-beans)
    Define this if you use Spring AOP APIs (org.springframework.aop.*)
-->
<dependency>
  <groupId>org.springframework</groupId>
  <artifactId>spring-aop</artifactId>
  <version>${org.springframework.version}</version>
</dependency>

<!--
    Application Context (depends on spring-core, spring-expression, spring-aop, spring-beans) 
    This is the central artifact for Spring's Dependency Injection Container and is generally always defined
-->
<dependency>
  <groupId>org.springframework</groupId>
  <artifactId>spring-context</artifactId>
  <version>${org.springframework.version}</version>
</dependency>

<!--
    Various Application Context utilities, including EhCache, JavaMail, Quartz, and Freemarker integration
    Define this if you need any of these integrations
-->
<dependency>
  <groupId>org.springframework</groupId>
  <artifactId>spring-context-support</artifactId>
  <version>${org.springframework.version}</version>
</dependency>

<!--
    Transaction Management Abstraction (depends on spring-core, spring-beans, spring-aop, spring-context)
    Define this if you use Spring Transactions or DAO Exception Hierarchy
    (org.springframework.transaction.*/org.springframework.dao.*)
-->
<dependency>
  <groupId>org.springframework</groupId>
  <artifactId>spring-tx</artifactId>
  <version>${org.springframework.version}</version>
</dependency>

<!--
    JDBC Data Access Library (depends on spring-core, spring-beans, spring-context, spring-tx)
    Define this if you use Spring's JdbcTemplate API (org.springframework.jdbc.*)
-->
<dependency>
  <groupId>org.springframework</groupId>
  <artifactId>spring-jdbc</artifactId>
  <version>${org.springframework.version}</version>
</dependency>

<!--
    Object-to-Relation-Mapping (ORM) integration with Hibernate, JPA, and iBatis.
    (depends on spring-core, spring-beans, spring-context, spring-tx)
    Define this if you need ORM (org.springframework.orm.*)
-->
<dependency>
  <groupId>org.springframework</groupId>
  <artifactId>spring-orm</artifactId>
  <version>${org.springframework.version}</version>
</dependency>

<!--
    Object-to-XML Mapping (OXM) abstraction and integration with JAXB, JiBX, Castor, XStream, and XML Beans.
    (depends on spring-core, spring-beans, spring-context)
    Define this if you need OXM (org.springframework.oxm.*)
-->
<dependency>
  <groupId>org.springframework</groupId>
  <artifactId>spring-oxm</artifactId>
  <version>${org.springframework.version}</version>
</dependency>

<!--
    Web application development utilities applicable to both Servlet and Portlet Environments
    (depends on spring-core, spring-beans, spring-context)
    Define this if you use Spring MVC, or wish to use Struts, JSF, or another web framework with Spring (org.springframework.web.*)
-->
<dependency>
  <groupId>org.springframework</groupId>
  <artifactId>spring-web</artifactId>
  <version>${org.springframework.version}</version>
</dependency>

<!--
    Spring MVC for Servlet Environments (depends on spring-core, spring-beans, spring-context, spring-web)
    Define this if you use Spring MVC with a Servlet Container such as Apache Tomcat (org.springframework.web.servlet.*)
-->
<dependency>
  <groupId>org.springframework</groupId>
  <artifactId>spring-webmvc</artifactId>
  <version>${org.springframework.version}</version>
</dependency>

<!--
    Spring MVC for Portlet Environments (depends on spring-core, spring-beans, spring-context, spring-web)
    Define this if you use Spring MVC with a Portlet Container (org.springframework.web.portlet.*)
-->
<dependency>
  <groupId>org.springframework</groupId>
  <artifactId>spring-webmvc-portlet</artifactId>
  <version>${org.springframework.version}</version>
</dependency>

<!--
    Support for testing Spring applications with tools such as JUnit and TestNG
    This artifact is generally always defined with a 'test' scope for the integration testing framework and unit testing stubs
-->
<dependency>
  <groupId>org.springframework</groupId>
  <artifactId>spring-test</artifactId>
  <version>${org.springframework.version}</version>
  <scope>test</scope>
</dependency>

Obtaining Spring Releases From The Enterprise Bundle Repository (EBR)

To obtain final releases of Spring projects from the EBR, add the following repositories to your .pom:

<repository>
    <id>com.springsource.repository.bundles.release</id>
    <name>EBR Spring Release Repository</name>
    <url>http:// repository.springsource.com/maven/bundles/release</url>
</repository>
<repository>
    <id>com.springsource.repository.bundles.external</id>
    <name>EBR External Release Repository</name>
    <url>http:// repository.springsource.com/maven/bundles/external</url>
</repository>

Then simply add the dependencies your project requires, keeping in mind the EBR artifact naming conventions.

A .pom <dependency> snippet for each Spring Framework 3 artifact as it will be indexed in the EBR is listed below:

<!-- Shared version number properties -->
<properties>
    <org.springframework.version>3.0.0.RELEASE</org.springframework.version>
</properties>

<!--
    Core utilities used by other modules.
    Define this if you use Spring Utility APIs (org.springframework.core.*/org.springframework.util.*)
-->
<dependency>
  <groupId>org.springframework</groupId>
  <artifactId>org.springframework.core</artifactId>
  <version>${org.springframework.version}</version>
</dependency>

<!--
    Expression Language (depends on core)
    Define this if you use Spring Expression APIs (org.springframework.expression.*)
-->
<dependency>
  <groupId>org.springframework</groupId>
  <artifactId>org.springframework.expression</artifactId>
  <version>${org.springframework.version}</version>
</dependency>

<!-- 
    Bean Factory and JavaBeans utilities (depends on core)
    Define this if you use Spring Bean APIs (org.springframework.beans.*) 
-->
<dependency>
  <groupId>org.springframework</groupId>
  <artifactId>org.springframework.beans</artifactId>
  <version>${org.springframework.version}</version>
</dependency>

<!--
    Aspect Oriented Programming (AOP) Framework (depends on core, beans)
    Define this if you use Spring AOP APIs (org.springframework.aop.*)
-->
<dependency>
  <groupId>org.springframework</groupId>
  <artifactId>org.springframework.aop</artifactId>
  <version>${org.springframework.version}</version>
</dependency>

<!--
    Application Context (depends on core, expression, aop, beans) 
    This is the central artifact for Spring's Dependency Injection Container and is generally always defined
-->
<dependency>
  <groupId>org.springframework</groupId>
  <artifactId>org.springframework.context</artifactId>
  <version>${org.springframework.version}</version>
</dependency>

<!--
    Various Application Context utilities, including EhCache, JavaMail, Quartz, and Freemarker integration
    Define this if you need any of these integrations
-->
<dependency>
  <groupId>org.springframework</groupId>
  <artifactId>org.springframework.context.support</artifactId>
  <version>${org.springframework.version}</version>
</dependency>

<!--
    Transaction Management Abstraction (depends on core, beans, aop, context)
    Define this if you use Spring Transactions or DAO Exception Hierarchy
    (org.springframework.transaction.*/org.springframework.dao.*)
-->
<dependency>
  <groupId>org.springframework</groupId>
  <artifactId>org.springframework.transaction</artifactId>
  <version>${org.springframework.version}</version>
</dependency>

<!--
    JDBC Data Access Library (depends on core, beans, context, transaction)
    Define this if you use Spring's JdbcTemplate API (org.springframework.jdbc.*)
-->
<dependency>
  <groupId>org.springframework</groupId>
  <artifactId>org.springframework.jdbc</artifactId>
  <version>${org.springframework.version}</version>
</dependency>

<!--
    Object-to-Relation-Mapping (ORM) integration with Hibernate, JPA, and iBatis.
    (depends on core, beans, context, transaction)
    Define this if you need ORM (org.springframework.orm.*)
-->
<dependency>
  <groupId>org.springframework</groupId>
  <artifactId>org.springframework.orm</artifactId>
  <version>${org.springframework.version}</version>
</dependency>

<!--
    Object-to-XML Mapping (OXM) abstraction and integration with JAXB, JiBX, Castor, XStream, and XML Beans.
    (depends on core, beans, context)
    Define this if you need OXM (org.springframework.oxm.*)
-->
<dependency>
  <groupId>org.springframework</groupId>
  <artifactId>org.springframework.oxm</artifactId>
  <version>${org.springframework.version}</version>
</dependency>

<!--
    Web app development utilities common across Servlet/Portlet environments (depends on core, beans, context)
    Define this if you use Spring MVC, or wish to use Struts, JSF, or another web framework with Spring (org.springframework.web.*)
-->
<dependency>
  <groupId>org.springframework</groupId>
  <artifactId>org.springframework.web</artifactId>
  <version>${org.springframework.version}</version>
</dependency>

<!--
    Spring MVC for Servlet Environments (depends on core, beans, context, web)
    Define this if you use Spring MVC with a Servlet Container such as Apache Tomcat (org.springframework.web.servlet.*)
-->
<dependency>
  <groupId>org.springframework</groupId>
  <artifactId>org.springframework.web.servlet</artifactId>
  <version>${org.springframework.version}</version>
</dependency>

<!--
    Spring MVC for Portlet Environments (depends on core, beans, context, web)
    Define this if you use Spring MVC with a Portlet Container (org.springframework.web.portlet.*)
-->
<dependency>
  <groupId>org.springframework</groupId>
  <artifactId>org.springframework.web.portlet</artifactId>
  <version>${org.springframework.version}</version>
</dependency>

<!--
    Support for testing Spring applications with tools such as JUnit and TestNG
    This artifact is generally always defined with a 'test' scope for the integration testing framework and unit testing stubs
-->
<dependency>
  <groupId>org.springframework</groupId>
  <artifactId>org.springframework.test</artifactId>
  <version>${org.springframework.version}</version>
  <scope>test</scope>
</dependency>

Obtaining Spring Milestone Releases

Milestones and Release Candidates may not be published directly to Maven Central, and in general are published separately from final releases. SpringSource hosts two repositories for obtaining Spring milestones. The first one should be used in conjunction with Maven Central, and the second one in conjunction with the EBR.

Obtaining Milestones from the Maven Central Compatible Repository

To obtain Spring milestones from the Maven Central compatible repository, add the following repository to your .pom:

<repository>
    <id>org.springframework.maven.milestone</id>
    <name>Maven Central Compatible Spring Milestone Repository</name>
    <url>http:// maven.springframework.org/milestone</url>
</repository>

The milestone version number format is <major>.<minor>.<micro>.M#; for example, 3.0.0.M4. The release candidate version number format is <major>.<minor>.<micro>.RC#; for example, 3.0.0.RC3.

For example, adding the following dependency would retrieve version 3.0.0.RC3 of the spring-context artifact:

<dependency>
  <groupId>org.springframework</groupId>
  <artifactId>spring-context</artifactId>
  <version>3.0.0.RC3</version>
</dependency>

Obtaining Milestones from the Enterprise Bundle Repository (EBR)

To obtain Spring milestones from the EBR, add the following repository to your .pom:

<repository>
    <id>com.springsource.repository.bundles.milestone</id>
    <name>EBR Spring Milestone Repository</name>
    <url>http:// repository.springsource.com/maven/bundles/milestone</url>
</repository>

Be sure to keep in mind the distinct EBR artifact naming convention. For example, adding the following dependency would retrieve version 3.0.0.RC3 of the org.springframework.context artifact:

<dependency>
  <groupId>org.springframework</groupId>
  <artifactId>org.springframework.context</artifactId>
  <version>3.0.0.RC3</version>
</dependency>

Obtaining Nightly Spring Snapshots

Snapshots of Spring projects are published each night, allowing users to verify that reported issues have been resolved before the next release. Like Milestones, there is a separate Maven Central compatible snapshot repository and an EBR snapshot repository.

Obtaining Snapshots from the Maven Central Compatible Repository

To obtain Spring nightly snapshots from the Maven Central compatible repository, add the following repository to your .pom:

<repository>
    <id>org.springframework.maven.snapshot</id>
    <name>Maven Central Compatible Spring Snapshot Repository</name>
    <url>http:// maven.springframework.org/snapshot</url>
</repository>

The snapshot version format is <major>.<minor>.<micro>.BUILD-SNAPSHOT; for example, 3.0.1.BUILD-SNAPSHOT.

For example, adding the following dependency would retrieve the latest snapshot of the spring-context artifact:

<dependency>
  <groupId>org.springframework</groupId>
  <artifactId>spring-context</artifactId>
  <version>3.0.1.BUILD-SNAPSHOT</version>
</dependency>

Notice the <major>.<minor>.<micro>.BUILD-SNAPSHOT format differs slightly from the traditional Maven 2 snapshot format of <major>.<minor>.<micro>-SNAPSHOT. This is because x.y.z-SNAPSHOT is not a valid OSGi version number. All Spring projects now follow the OSGi version numbering scheme (Maven 3 will as well).

Obtaining Snapshots from the Enterprise Bundle Repository (EBR)

To obtain Spring nightly snapshots from the EBR, add the following repository to your .pom:

<repository>
    <id>com.springsource.repository.bundles.snapshot</id>
    <name>EBR Spring Snapshot Repository</name>
    <url>http:// repository.springsource.com/maven/bundles/snapshot</url>
</repository>

As an final example, adding the following dependency would retrieve the latest snapshot of the org.springframework.context artifact:

<dependency>
  <groupId>org.springframework</groupId>
  <artifactId>org.springframework.context</artifactId>
  <version>3.0.1.BUILD-SNAPSHOT</version>
</dependency>
  • 2
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Plugin 'org.springframework.boot:spring-boot-maven-plugin' 是 Spring Boot 提供的一个 Maven 插件,用于在构建过程自动处理 Spring Boot 应用程序的特定需求。如果你在使用 Maven 构建项目时遇到了 "Plugin 'org.springframework.boot:spring-boot-maven-plugin' not found" 的错误,可能是以下几个原因导致的: 1. 依赖未正确配置:请确保在项目的 pom.xml 文件正确配置Spring Boot Maven 插件的依赖。示例配置如下: ```xml <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <version>2.5.4</version> </plugin> </plugins> </build> ``` 请注意,`<version>` 标签的版本号应该与你使用的 Spring Boot 版本相匹配。 2. Maven 仓库配置问题:请确保你的 Maven 配置文件(settings.xml)配置了正确的 Maven 仓库地址,并且可以正常访问。你可以尝试执行 `mvn clean install` 命令来验证 Maven 仓库的配置是否正确。 3. 网络连接问题:如果你的网络连接存在问题,可能导致 Maven 无法下载插件所需的依赖。请确保你的网络连接正常,并且可以访问 Maven 仓库。 如果以上步骤都没有解决问题,你可以尝试删除本地 Maven 仓库的相关插件缓存,然后重新构建项目。你可以在本地 Maven 仓库的目录找到对应的插件缓存,并删除它。默认情况下,Maven 仓库位于用户目录下的 `.m2` 文件夹

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值