Spring-boot local repository 2.7.5 not working - spring-boot

an attempt to work with local repository of spring-boot project
failing according to intellij, but project is compiling and dependencies exist.
is it possible the all is good , but intellij error flag is wrong ?
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.7.5</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.example</groupId>
<artifactId>project-manager</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>project-manager</name>
<description>project-manager</description>
<properties>
<java.version>11</java.version>
<apache.poi.version>5.2.2</apache.poi.version>
<fasterxml.jackson.version>2.14.1</fasterxml.jackson.version>
</properties>
<dependencies>
... dependencies
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<excludes>
<exclude>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
</project>
worked fine with central-repository on parent version 2.7.5
worked fine with local repository on parent 2.3.0-RELEASE
thanks.

in case someone get same issue , solution:
Intellij (v 2021.3.3)
press
"File | Invalidate Caches" fixed the issue.
jetbrain support

Related

Managing Maven plugin versions with Spring Boot BOM

I have a Maven POM for a Spring Boot project. The POM imports the Spring Boot BOM. Now I want to customize the configuration of a Maven plugin, say, mvn-compiler-plugin. I'd like to use the plugin version maven-compiler-plugin.version dictated by the spring-boot-dependencies BOM.
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>ch.ge.mygroup</groupId>
<artifactId>myartifact</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>war</packaging>
<properties>
<spring-boot.version>2.4.2</spring-boot.version>
</properties>
<dependencyManagement>
<dependencies>
<!-- Spring Boot BOM -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>${spring-boot.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven-compiler-plugin.version}</version>
<configuration>
<!-- some particular config here -->
</configuration>
</plugin>
</plugins>
</build>
</project>
But this does work: I come up with a Maven error:
[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[ERROR] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-compiler-plugin must be a valid version but is '${maven-compiler-plugin.version}'. # line 31, column 26
So I have to explicitly specify the version of the Maven plugin, which I want to avoid.
In summary:
Using
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven-compiler-plugin.version}</version>
<configuration>
<!-- some particular config here -->
</configuration>
</plugin>
yields a Maven error.
Using
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<!-- some particular config here -->
</configuration>
</plugin>
works, but prevents me from using the version (3.8.1) dictated by the Spring Boot BOM.
Using
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<!-- some particular config here -->
</configuration>
</plugin>
works, but uses an old version (3.1) of the plugin.
How can I avoid to explicitly specify the plugin version and instead implicitly use the plugin version provided in the Spring Boot BOM?
If you want to override Spring Boot dependencies by simply updating properties, you have to specify the parent POM instead of importing:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>ch.ge.mygroup</groupId>
<artifactId>myartifact</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>war</packaging>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>2.4.2</version>
<relativePath/>
</parent>
<properties>
<spring-boot.version>2.4.2</spring-boot.version>
<maven-compiler-plugin.version>3.7.0</maven-compiler-plugin.version>
</properties>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven-compiler-plugin.version}</version>
<configuration>
<!-- some particular config here -->
</configuration>
</plugin>
</plugins>
</build>
</project>

Create EAR Project With SpringBoot module

I need to create an EAR file to be deployed on JBoss EAP 7. I considered to build a project structure like the following:
- rootproject
-- ear (ear)
-- web (war)
Therefore for the rootproject I have created a new Simple Maven project (using Eclipse 06/2020), with the following .pom.xml:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>jboss_test</groupId>
<artifactId>jboss_test</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<name>jboss_ear_test</name>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.11.RELEASE</version>
</parent>
<profiles>
<profile>
<id>default</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<modules>
<module>ear</module>
<module>web</module>
</modules>
</profile>
</profiles>
</project>
Therefore, inside it, I have created a SpringBoot 2.2.11 project (WEB) with the following .pom.xml:
....
....
<parent>
<artifactId>jboss_test</artifactId>
<groupId>jboss_test</groupId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>web</artifactId>
<packaging>war</packaging>
<name>web-test</name>
<description>Spring Boot JBOSS</description>
.... // some dependencies
And a Maven module used the ear with the following .pom.xml:
....
....
<parent>
<artifactId>jboss_test</artifactId>
<groupId>jboss_test</groupId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>ear</artifactId>
<packaging>ear</packaging>
<name>ear-test</name>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ear-plugin</artifactId>
<version>2.6</version>
<configuration>
<finalName>JBOSS-TEST_EAR</finalName>
<version>6</version>
<defaultLibBundleDir>lib</defaultLibBundleDir>
<modules>
<webModule>
<groupId>jboss_test</groupId>
<artifactId>web</artifactId>
<bundleFileName>JBOSS-TEST.war</bundleFileName>
<contextRoot>/TEST</contextRoot>
</webModule>
</modules>
</configuration>
</plugin>
</plugins>
</build>
When I try to build the project from its root I obtain the following error:
Artifact[war:jboss_test:web] is not a dependency of the project
Can you help me to find out whats wrong??
Thank you
Thanks a lot to #khmarbaise for his response, I solved as follows:
Creating rootproject as Simple Maven project, .pom.xml:
<groupId>it.coding.jboss.deployment</groupId>
<artifactId>jbdeployment</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.11.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<modules>
<module>ear-test</module>
<module>web-test</module>
</modules>
Creating ear-test as Maven module, .pom.xml:
<parent>
<groupId>it.coding.jboss.deployment</groupId>
<artifactId>jbdeployment</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>ear-test</artifactId>
<packaging>ear</packaging>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ear-plugin</artifactId>
<version>2.6</version>
<configuration>
<finalName>TEST-EAR</finalName>
<version>6</version>
<defaultLibBundleDir>lib</defaultLibBundleDir>
<modules>
<webModule>
<groupId>it.coding.jboss.deployment</groupId>
<artifactId>web-test</artifactId>
<bundleFileName>WEB-TEST.war</bundleFileName>
<contextRoot>/WEB-TEST</contextRoot>
</webModule>
</modules>
<archive>
<addMavenDescriptor>false</addMavenDescriptor>
<manifestEntries>
<Implementation-Title>JBOSS-TEST</Implementation-Title>
<Implementation-Version>1.0</Implementation-Version>
<Implementation-Vendor>CODING</Implementation-Vendor>
<Built-By></Built-By>
</manifestEntries>
</archive>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>it.coding.jboss.deployment</groupId>
<artifactId>web-test</artifactId>
<version>0.0.1-SNAPSHOT</version>
<type>war</type>
</dependency>
</dependencies>
Creating web-test as SpringBoot 2.2.11 project, .pom.xml:
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>it.coding.jboss.deployment</groupId>
<artifactId>jbdeployment</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>web-test</artifactId>
<packaging>war</packaging>
<name>web-test</name>
<description>Spring Boot JBOSS</description>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
// dependencies
</dependencies>
...
...
</project>
Maven build goes fine and EAR is created.. Than I would like to ask one more thing: do you think I have to define all the dependecies inside my ear-test pom?? Also those of the web-test project related to Spring, Hibernate etc.. ?
Thanks a lot

spring-boot-maven-plugin not pulling in dependent classes into jar

Im having a problem with the spring-boot-maven-plugin whereby it is not including the dependent classes in the resulting jar file.
In the docs, it states that dependencies with scope provided will be included in the jar file, but I cant get it to include them.
I have a project with 2 sub-modules: model and restServer. In the model module, I want to use swagger to codegen based on an openApi input model. The resulting classes are put in a jar file: model/target/rest-model-0.0.1-SNAPSHOT.jar.
In the restServer module, I have the Spring RestController and Application java code, and want to "pull in" the model classes into the resulting jar file: restServer/target/rest-server-0.0.1-SNAPSHOT.jar with the spring-boot-maven-plugin builder, but its not including anything from the model sub-module.
The entire project structure and pom files are listed below.
How can I get the spring-boot-maven-plugin to pull in the class files from the model sub-module, effectively creating a "fat" self-contained jar?
Project Structure
project-root/
pom.xml # parent pom
model/
pom.xml
src/main/openApi/model.json
target/
generated-sources/* (package: com.me.rest.model.*)
rest-model-0.0.1-SNAPSHOT.jar
restServer/
pom.xml
src/main/java/com/me/rest/
controller/Controller.java
Application.java
Parent pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.2.RELEASE</version>
</parent>
<groupId>com.me</groupId>
<artifactId>rest-parent</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>rest</name>
<packaging>pom</packaging>
<description>Swagger codegen for Spring Rest Server sandbox project</description>
<scm>
<connection>scm:git:git#github.com:swagger-api/swagger-codegen.git</connection>
<developerConnection>scm:git:git#github.com:swagger-api/swagger-codegen.git</developerConnection>
<url>https://github.com/swagger-api/swagger-codegen</url>
</scm>
<prerequisites>
<maven>2.2.0</maven>
</prerequisites>
<modules>
<module>model</module>
<module>restServer</module>
</modules>
</project>
model/pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.kontron</groupId>
<artifactId>rest-parent</artifactId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<groupId>com.kontron</groupId>
<artifactId>rest-model</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<dependencies> ... </dependencies>
<build>
<plugins>
<!-- Swagger codegen plugin -->
<plugin>
<groupId>io.swagger</groupId>
<artifactId>swagger-codegen-maven-plugin</artifactId>
<version>2.3.1</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
<configuration> ... </configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
restServer/pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.kontron</groupId>
<artifactId>rest-parent</artifactId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>rest-server</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot</artifactId>
<version>2.1.1.RELEASE</version>
</dependency>
<dependency>
<groupId>com.kontron</groupId>
<artifactId>rest-model</artifactId>
<version>0.0.1-SNAPSHOT</version>
<scope>provided</scope> <!-- Notice scope is provided -->
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.1.1.RELEASE</version>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Update: adding resulting META-INF/MANIFEST.MF:
Manifest-Version: 1.0
Implementation-Title: rest-server
Implementation-Version: 0.0.1-SNAPSHOT
Built-By: bjohnson
Implementation-Vendor-Id: com.me
Spring-Boot-Version: 2.1.2.RELEASE
Main-Class: org.springframework.boot.loader.JarLauncher
Start-Class: com.me.rest.Application
Spring-Boot-Classes: BOOT-INF/classes/
Spring-Boot-Lib: BOOT-INF/lib/
Created-By: Apache Maven 3.5.4
Build-Jdk: 1.8.0_144
Implementation-URL: https://projects.spring.io/spring-boot/#/spring-bo
ot-starter-parent/rest-parent/rest-server
The dependencies are placed in BOOT-INF\lib\ of the repackaged JAR file.
This path will be added to the classpath of you Spring Boot Application.

Is it possible to create a spring-boot custom parent pom this is also a multi module project?

I would like to know how to set up a parent pom that handles my spring-boot dependencies as well as builds a few client jars.
Parent Project
|- client-jar-1
| |- src/main/java/MyPojo.java
| |- pom.xml (parent super pom? <package> type is jar)
|- pom.xml (parent is spring-boot-starter-parent <package> type is pom)
Child Project
|- pom.xml (parent pom is custom parent-project, includes client-jar-1 as a dependency)
My thought process is the the parent project can handle common dependencies across multiple independent spring applications and also build a few custom client jars or utility jars, that the child project could include at their own discretion.
Here is my first attempt at my pom files:
Parent Project POM
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.me.spring.boot.parent</groupId>
<artifactId>me-spring-boot-parent</artifactId>
<version>1.0.0.RELEASE</version>
<packaging>pom</packaging>
<modules>
<module>directory_client</module>
</modules>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.10.RELEASE</version>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
...
</dependencies>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<source>9</source>
<target>9</target>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
client-jar-1 POM
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>me-spring-boot-parent</artifactId>
<groupId>com.me.spring.boot.parent</groupId>
<version>1.0.0.RELEASE</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>com.me.directory.cleint</groupId>
<artifactId>directory-client</artifactId>
<version>1.0.0.RELEASE</version>
<packaging>jar</packaging>
</project>
Child Project POM
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.me</groupId>
<artifactId>child-project</artifactId>
<version>0.0.1-SNAPSHOT</version>
<parent>
<groupId>com.me.spring.boot.parent</groupId>
<artifactId>me-spring-boot-parent</artifactId>
<version>1.0.0.RELEASE</version>
</parent>
<properties>
<flyway.url>jdbc:postgresql://localhost:5432/db</flyway.url>
<flyway.driver>org.postgresql.Driver</flyway.driver>
<flyway.sqlMigrationSeparator>.sql</flyway.sqlMigrationSeparator>
<flyway.sqlMigrationSuffixes></flyway.sqlMigrationSuffixes>
</properties>
</project>
In my Child project when I try and access the client-jar-1 MyPojo I get a compilation error. Here is the expanded dependency from the child project
I can even get my IDE to import the MyPojo class, but there is a problem with the packages and it can't truly resolve the class.
Yes it is possible, in your parent pom add :
<modules>
<module>child1</module>
<module>child2</module>
</modules>
And in your child1 and child2 pom add :
<parent>
<groupId>yourorganization</groupId>
<artifactId>parent</artifactId>
</parent>
The parent pom will contain the spring-boot-starter-parent

Autowiring of Spring Data Repo fails with Maven Skinny war option

My question is similar to this one posted a while ago
The autowiring of Spring Data Repos fail when the external libraries are in EAR's lib folder.
The wiring works fine when all jars are included in WEB-INF/lib.
I tried setting the 'skinnyWar' to false but this is duplicating the jars in both EAR and WAR.
The application uses Spring Batch Admin 1.2.2 and Spring Data 1.1 with Spring 3.2.2 based.
Maven Version used is 3.3. The runtime is Websphere 7.x
I have another application that works perfectly fine with skinnywar set to true - this uses spring-ws, spring-data 4.0.x version.
The WAR POM
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>batchadmin-web</artifactId>
<parent>
<groupId>com.xyz.interfaces</groupId>
<artifactId>batch-parent</artifactId>
<version>1.0.BUILD-SNAPSHOT</version>
<relativePath>../batch-parent/pom.xml</relativePath>
</parent>
<packaging>war</packaging>
<name>Batch Admin Interface Web</name>
<dependencies>
<!-- Application specific jars/modules Not included for brevity-->
</dependencies>
<build>
<finalName>springbatch-admin</finalName>
<outputDirectory>${project.basedir}\src\main\webapp\WEB-INF\classes</outputDirectory>
<testOutputDirectory>${project.basedir}\src\main\webapp\WEB-INF\classes</testOutputDirectory>
<plugins>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.4</version>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>lib/</classpathPrefix>
</manifest>
</archive>
<packagingExcludes>WEB-INF/lib/spring-beans*.jar</packagingExcludes>
</configuration>
</plugin>
</plugins>
</build>
</project>
The EAR POM content:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>batchadmin-ear</artifactId>
<parent>
<groupId>com.xyz.interfaces</groupId>
<artifactId>batch-parent</artifactId>
<version>1.0.BUILD-SNAPSHOT</version>
<relativePath>../batch-parent/pom.xml</relativePath>
</parent>
<packaging>ear</packaging>
<name>Batch Admin Interface</name>
<dependencies>
<dependency>
<groupId>com.xyz.interfaces</groupId>
<artifactId>batchadmin-web</artifactId>
<type>war</type>
<version>${project.version}</version>
</dependency>
</dependencies>
<build>
<finalName>SpringBatchEAR</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ear-plugin</artifactId>
<version>2.9.1</version>
<configuration>
<skinnyWars>true</skinnyWars>
<defaultLibBundleDir>lib/</defaultLibBundleDir>
<modules>
<webModule>
<groupId>com.xyz.interfaces</groupId>
<artifactId>batchadmin-web</artifactId>
<contextRoot>/springbatch-admin</contextRoot>
<bundleFileName>springbatch-admin.war</bundleFileName>
</webModule>
</modules>
</configuration>
</plugin>
</plugins>
</build>
Update: Since the EAR has only one Web module, used 'Single class loader for application' for 'WAR class loader policy' in the Websphere. This way, I am able to make this work.
I would like to know how to make this work without changing the classloader option as this might not be preferred when multiple web modules are present.

Resources