See our Minimum Requirements for using NES for Spring products.
- Update your
pom.xml
with NES package versions and repository details - Set up Maven settings with your access token
- Install & Run!
You can access and clone the these sample applications using NES for Spring to try out installing and building. A more detailed README file is provided in the example application.
Additionally, you can view an example Github commit to see exactly what code aspects to change to drop-in NES packages.
Substitute Spring dependencies in your pom.xml
like the following example (use appropriate version).
<!-- ... -->
<dependencies>
<!-- other dependencies as needed -->
<dependency>
<groupId>com.herodevs.nes.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>5.3.39-spring-framework-5.3.40</version>
</dependency>
<dependency>
<groupId>com.herodevs.nes.springframework</groupId>
<artifactId>spring-oxm</artifactId>
<version>5.3.39-spring-framework-5.3.40</version>
</dependency>
<dependency>
<groupId>com.herodevs.nes.apache.struts</groupId>
<artifactId>struts2-spring-plugin</artifactId>
<version>2.5.33-struts2-2.5.34</version>
</dependency>
<dependency>
<groupId>com.herodevs.nes.mybatis</groupId>
<artifactId>mybatis-spring</artifactId>
<version>2.0.7-mybatis-spring-2.0.8</version>
</dependency>
<dependency>
<groupId>com.herodevs.nes.springdoc</groupId>
<artifactId>springdoc-openapi-ui</artifactId>
<version>1.7.0-springdoc-openapi-1.7.1</version>
</dependency>
<dependency>
<groupId>com.herodevs.nes.springdoc</groupId>
<artifactId>springdoc-openapi-common</artifactId>
<version>1.7.0-springdoc-openapi-1.7.1</version>
</dependency>
<dependency>
<groupId>com.herodevs.nes.springdoc</groupId>
<artifactId>springdoc-openapi-webmvc-core</artifactId>
<version>1.7.0-springdoc-openapi-1.7.1</version>
</dependency>
<dependency>
<groupId>com.herodevs.nes.dozer</groupId>
<artifactId>dozer-spring</artifactId>
<version>5.5.1-dozer-5.5.2</version>
</dependency>
<!-- other dependencies as needed -->
</dependencies>
<!-- ... -->
<repositories>
<repository>
<id>herodevs-nes-registry</id>
<url>https://registry.nes.herodevs.com/maven</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>herodevs-nes-registry</id>
<url>https://registry.nes.herodevs.com/maven</url>
</pluginRepository>
</pluginRepositories>
Note
If errors occur with the install or startup of the application that are due to missing methods from Spring Framework, this could be due to multiple copies of Spring Framework libraries on the classpath. To address, update the dependency configuration in the pom.xml
file to exclude "org.springframework" related jars. This can be done by using the Maven exclusions feature. See our troubleshooting guide for more information.
Alternatively, you can also use our Maven dependency plugin to do this for you using the following configuration in the build plugins of the pom.xml
file.
<build>
<plugins>
<!-- others removed for brevity -->
<plugin>
<groupId>com.herodevs.nes.maven</groupId>
<artifactId>nes-maven-dependency-plugin</artifactId>
<version>1.0.0</version>
<executions>
<execution>
<goals>
<goal>resolveDependencies</goal>
</goals>
</execution>
</executions>
<configuration>
<patterns>
<pattern>org\.springframework.*</pattern>
</patterns>
</configuration>
</plugin>
</plugins>
</build>
The above plugin uses a provided regex pattern to exclude the desired artifacts from the classpath during the build.
See our Registry Access guide for setting up a Maven settings.xml
with access the HeroDevs NES registry.
<settings>
<servers>
<server>
<id>herodevs-nes-registry</id>
<username>any_text_here_not_used</username>
<configuration>
<httpHeaders>
<property>
<name>Authorization</name>
<value>Bearer NES_TOKEN_HERE</value>
</property>
</httpHeaders>
</configuration>
</server>
</servers>
</settings>
The ID of "herodevs-nes-registry" should match that of the ID for source and plugin repositories in the applications' pom.xml
(or parent pom.xml
). See example snippet above.
Install and run your application
If your Maven settings.xml file is located in a path other than Maven's global path, use "-s path/to/settings.xml
"
./mvnw -s ./settings.xml clean install -U
- Update your
build.gradle
- Update your Gradle properties file with your access token
- Build & Run
You can access and clone the these sample applications using NES for Spring to try out installing and building. A more detailed README file is provided in the example application.
Additionally, you can view an example Github commit to see exactly what code aspects to change to drop-in NES packages.
Substitute Spring Boot references in your build.gradle
like the following
dependencies {
// other dependencies as needed...
implementation 'com.herodevs.nes.springframework:spring-orm:5.3.39-spring-framework-5.3.40'
implementation 'com.herodevs.nes.springframework:spring-oxm:5.3.39-spring-framework-5.3.40'
implementation 'com.herodevs.nes.springframework:spring-core:5.3.39-spring-framework-5.3.40'
implementation 'com.herodevs.nes.apache.struts:struts2-spring-plugin:2.5.33-struts2-2.5.34'
implementation 'com.herodevs.nes.mybatis:mybatis-spring:2.0.7-mybatis-spring-2.0.8'
implementation 'com.herodevs.nes.dozer:dozer-spring:5.5.1-dozer-5.5.2'
implementation 'com.herodevs.nes.springdoc-openapi:springdoc-openapi-ui:1.7.0-springdoc-openapi-1.7.1'
implementation 'com.herodevs.nes.springdoc-openapi:springdoc-openapi-common:1.7.0-springdoc-openapi-1.7.1'
implementation 'com.herodevs.nes.springdoc-openapi:springdoc-openapi-webmvc-core:1.7.0-springdoc-openapi-1.7.1'
}
For more information, see our Registry Access guide for configuring Gradle with the HeroDevs NES registry.
Add NES repository information to global Gradle properties file (e.g. ~/.gradle/gradle.properties
)
~/.gradle/gradle.properties
herodevs_nes_registry_url=https://registry.nes.herodevs.com/maven
herodevs_nes_registry_user=any_text_here_not_used
herodevs_nes_registry_token=NES_TOKEN_HERE
Add the NES Maven repository to Gradle build files.
//...
repositories {
maven {
url = uri(providers.gradleProperty("herodevs_nes_registry_url").get())
credentials {
username = providers.gradleProperty("herodevs_nes_registry_user").get()
password = providers.gradleProperty("herodevs_nes_registry_token").get()
}
authentication {
basic(BasicAuthentication)
}
}
mavenCentral()
}
//...
pluginManagement {
repositories {
//...
maven {
url = uri(providers.gradleProperty("herodevs_nes_registry_url").get())
credentials {
username = providers.gradleProperty("herodevs_nes_registry_user").get()
password = providers.gradleProperty("herodevs_nes_registry_token").get()
}
authentication {
basic(BasicAuthentication)
}
}
mavenCentral()
//...
}
}
Install and run your application
The direct download URLs for NES for Spring artifacts follow this format:
https://registry.nes.herodevs.com/maven/com/herodevs/nes/apache/struts/struts2-spring-plugin/2.7.18-spring-boot-2.7.19/struts2-spring-plugin-2.5.33-struts2-2.5.34.pom