No qualifying bean of type 'com.gm.gpc.mapper.CarlineMapper' available

13,723 views
Skip to first unread message

robert_...@yahoo.com

unread,
Jul 25, 2017, 2:21:44 PM7/25/17
to mapstruct-users
We are using Lombok 1.16.18 to generate getters and setters for our Java Beans, and MapStruct 1.2.0.  I'm getting a No qualifying bean of type 'com.gm.gpc.mapper.CarlineMapper' available exception (NoSuchBeanDefinitionException).  

MapStruct doesn't seem to be generating the mapping class.  Here is my Mapper Interface:

@Mapper
public interface CarlineMapper {

CarlineMapper INSTANCE = Mappers.getMapper( CarlineMapper.class );

CarlineDTO carlineToCarlineDTO(Carline carline);

Carline CarlineDTOToCarline(CarlineDTO carlineDTO);
}

And my service:

@Service
public class CarlineServiceImpl implements CarlineService {

@Autowired
private transient TrimPackageService trimPackageService;
@Autowired
MarketService marketService;
@Autowired
private transient CarlineService carlineService;
private static final Logger LOG = LoggerFactory.getLogger(CarlineServiceImpl.class);
private transient final CarlineRepository carlineRepository;
private transient final DozerBeanMapper dozerBeanMapper;
private transient final CarlineMapper carlineMapper;

@Autowired
public CarlineServiceImpl(final CarlineRepository carlineRepository, final DozerBeanMapper dozerBeanMapper, final CarlineMapper carlineMapper) {
Assert.notNull(carlineRepository, "CarlineRepository must not be null");
Assert.notNull(dozerBeanMapper, "dozerBeanMapper must not be null");
Assert.notNull(carlineMapper, "carlineMapper must not be null");

this.carlineRepository = carlineRepository;
this.dozerBeanMapper = dozerBeanMapper;
this.carlineMapper = carlineMapper;
}

private CarlineDTO toDto(final Carline carline) {
final CarlineDTO dto = this.carlineMapper.INSTANCE.carlineToCarlineDTO(carline);
dto.setOriginalShortCode(carline.getShortCode());
dto.setOriginalName(carline.getName());
return dto;
}

private void save(final CarlineDTO carlineDto) {
final Carline carline = this.carlineMapper.INSTANCE.CarlineDTOToCarline(carlineDto);
this.carlineRepository.save(carline);
}

private void delete(final CarlineDTO carlineDTO) {
final Carline carline = this.carlineMapper.INSTANCE.CarlineDTOToCarline(carlineDTO);
this.carlineRepository.delete(carline.getId());
}

Consider defining a bean of type 'com.gm.gpc.mapper.CarlineMapper' in your configuration.

24-Jul-2017 13:26:12.158 SEVERE [RMI TCP Connection(3)-127.0.0.1] org.apache.catalina.core.ContainerBase.addChildInternal ContainerBase.addChild: start: 
 org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:162)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:753)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:729)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717)
at org.apache.catalina.startup.HostConfig.manageApp(HostConfig.java:1696)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:300)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)
at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)
at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:484)
at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:433)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:300)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)
at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)
at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1468)
at javax.management.remote.rmi.RMIConnectionImpl.access$300(RMIConnectionImpl.java:76)
at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1309)
at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1401)
at javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:829)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:324)
at sun.rmi.transport.Transport$1.run(Transport.java:200)
at sun.rmi.transport.Transport$1.run(Transport.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:196)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:568)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:826)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:683)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:682)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'gpcAuthApplication': Unsatisfied dependency expressed through field 'validateTrimPackageService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'validateTrimPackageServiceImpl' defined in file [C:\Data\GPC\GPC_117490\GPC\gpc_auth\target\ROOT_pcf\WEB-INF\classes\com\gm\gpc\service\ValidateTrimPackageServiceImpl.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'trimPackageServiceImpl': Unsatisfied dependency expressed through field 'marketService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'marketServiceImpl': Unsatisfied dependency expressed through field 'carlineService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'carlineServiceImpl' defined in file [C:\Data\GPC\GPC_117490\GPC\gpc_auth\target\ROOT_pcf\WEB-INF\classes\com\gm\gpc\service\CarlineServiceImpl.class]: Unsatisfied dependency expressed through constructor parameter 2; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.gm.gpc.mapper.CarlineMapper' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:588)
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:366)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1264)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:553)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:761)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:866)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:542)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:737)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:370)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:314)
at org.springframework.boot.web.support.SpringBootServletInitializer.run(SpringBootServletInitializer.java:152)
at org.springframework.boot.web.support.SpringBootServletInitializer.createRootApplicationContext(SpringBootServletInitializer.java:132)
at org.springframework.boot.web.support.SpringBootServletInitializer.onStartup(SpringBootServletInitializer.java:87)
at org.springframework.web.SpringServletContainerInitializer.onStartup(SpringServletContainerInitializer.java:169)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5303)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
... 42 more

Any help would be appreciated.  Thank you

Andreas Gudian

unread,
Jul 25, 2017, 2:48:01 PM7/25/17
to mapstruct-users, robert_...@yahoo.com
Hi Robert,

You'll need to set componentModel="spring" in the @Mapper annotation and add the beans to your application context, eg using a component scan or whatever you prefer in your app. 
And also remove the static INSTANCE fields in the mapper interfaces - they are only suggested to be used in combination with the default component model.

Here's the part in the documentation, with an example for CDI (it looks similar in Spring):

Andreas

--
You received this message because you are subscribed to the Google Groups "mapstruct-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mapstruct-use...@googlegroups.com.
To post to this group, send email to mapstru...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

robert_...@yahoo.com

unread,
Jul 25, 2017, 5:45:11 PM7/25/17
to mapstruct-users, robert_...@yahoo.com
Hi Andreas,

Thanks for the help.  I did all of the things you suggested, however I still get this error:

25-Jul-2017 16:43:14.855 SEVERE [RMI TCP Connection(3)-127.0.0.1] org.apache.catalina.core.ContainerBase.addChildInternal ContainerBase.addChild: start: 
Parameter 2 of constructor in com.gm.gpc.service.CarlineServiceImpl required a bean of type 'com.gm.gpc.mapper.CarlineMapper' that could not be found.
 org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[]]

at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:162)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:753)

at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:729)
Action:
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717)

at org.apache.catalina.startup.HostConfig.manageApp(HostConfig.java:1696)
Consider defining a bean of type 'com.gm.gpc.mapper.CarlineMapper' in your configuration.

@Mapper(componentModel = "spring")
public interface CarlineMapper {


CarlineDTO carlineToCarlineDTO(Carline carline);

Carline CarlineDTOToCarline(CarlineDTO carlineDTO);
}
@Service
public class CarlineServiceImpl implements CarlineService {

@Autowired
private CarlineMapper carlineMapper;

@Autowired
public CarlineServiceImpl(final CarlineRepository carlineRepository, final DozerBeanMapper dozerBeanMapper
, final CarlineMapper carlineMapper
) {
Assert.notNull(carlineRepository, "CarlineRepository must not be null");
Assert.notNull(dozerBeanMapper, "dozerBeanMapper must not be null");
Assert.notNull(carlineMapper, "carlineMapper must not be null");

this.carlineRepository = carlineRepository;
this.dozerBeanMapper = dozerBeanMapper;
this.carlineMapper = carlineMapper;
}

Thanks

Andreas Gudian

unread,
Jul 26, 2017, 2:37:25 AM7/26/17
to mapstruct-users, robert_...@yahoo.com
Check that the mapper Impl class is actually generated by the build and that you have a component scan or something in place to pick it up (the usual Spring stuff, as you would do if you wrote the mapper Inpl class by hand).

robert_...@yahoo.com

unread,
Jul 26, 2017, 9:09:29 AM7/26/17
to mapstruct-users, robert_...@yahoo.com
Hi Andreas,

If you mean in the generated-sources directory, no it is not generated.

Thanks

Andreas Gudian

unread,
Jul 26, 2017, 12:40:27 PM7/26/17
to mapstruct-users, robert_...@yahoo.com
Then it seems to be a problem with the build setup. Can you share the relevant parts of the build files, ie pom.xml or build.gradle?
Or maybe even a condensed self-contained project that we can pull and try out ourselves. 

robert_...@yahoo.com

unread,
Jul 26, 2017, 1:16:31 PM7/26/17
to mapstruct-users, robert_...@yahoo.com
I've been trying changes to the pom, but here is the file:

<?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.gm.gsmc</groupId>
<artifactId>gpc_117490</artifactId>
<version>1.3.0.0-SNAPSHOT</version>
</parent>

<artifactId>gpc_auth_117490</artifactId>
<version>1.3.0.0-SNAPSHOT</version>
<packaging>war</packaging>
<name>gpc_auth_117490</name>

<issueManagement>
<system>TFS</system>
<url>https://tfs.gm.com/tfs/GBRD/GPC_117490/</url>
</issueManagement>

<scm>
<connection>scm:git:git://bitbucket.gm.com/gpc/gpc.git</connection>
<developerConnection>scm:git:git://bitbucket.gm.com/gpc/gpc.git</developerConnection>
<url>https://bitbucket.gm.com/projects/GPC/repos/gpc/browse</url>
</scm>

<properties>
<start-class>com.gm.gpc.GpcAuthApplication</start-class>
<java.version>1.8</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<profile.name>prod</profile.name>
<org.mapstruct.version>1.2.0.CR1</org.mapstruct.version>
</properties>

<profiles>
<!-- skip tomcat deploy for production -->
<profile>
<id>PRODUCTION</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<executions>
<execution>
<id>1</id>
<phase>none</phase>
</execution>
<execution>
<id>2</id>
<phase>none</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<!-- skip tomcat deploy for local -->
<profile>
<id>LOCAL</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<executions>
<execution>
<id>1</id>
<phase>none</phase>
</execution>
<execution>
<id>2</id>
<phase>none</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<!-- skip tomcat deploy for PCF -->
<profile>
<id>PCF</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<executions>
<execution>
<id>1</id>
<phase>none</phase>
</execution>
<execution>
<id>2</id>
<phase>none</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>DEV</id>
<properties>
<tomcat.deploy.url1>http://epgidvlbrd1935.epga.nam.gm.com:15100/manager/text</tomcat.deploy.url1>
<profile.name>dev</profile.name>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<executions>
<execution>
<id>1</id>
<phase>package</phase>
<goals>
<goal>deploy</goal>
</goals>
<configuration>
<url>${tomcat.deploy.url1}</url>
<path>/ROOT</path>
<username>manager</username>
<password>Pa55w.rd</password>
<update>true</update>
</configuration>
</execution>
<!-- Skipping one of the deployment executions because there is only one dev server -->
<execution>
<id>2</id>
<phase>none</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>SIT</id>
<properties>
<tomcat.deploy.url1>http://epgidvlbrd2016.epga.nam.gm.com:15100/manager/text</tomcat.deploy.url1>
<tomcat.deploy.url2>http://epgidvlbrd2017.epga.nam.gm.com:15100/manager/text</tomcat.deploy.url2>
</properties>
</profile>
<profile>
<id>UAT</id>
<properties>
<tomcat.deploy.url1>http://epgidvlbrd2020.epga.nam.gm.com:15100/manager/text</tomcat.deploy.url1>
<tomcat.deploy.url2>http://epgidvlbrd2021.epga.nam.gm.com:15100/manager/text</tomcat.deploy.url2>
</properties>
</profile>
<profile>
<id>PERF</id>
<properties>
<tomcat.deploy.url1>http://epgidvlbrd2025.epga.nam.gm.com:15100/manager/text</tomcat.deploy.url1>
<tomcat.deploy.url2>http://epgidvlbrd2026.epga.nam.gm.com:15100/manager/text</tomcat.deploy.url2>
</properties>
</profile>
</profiles>

<dependencies>
<dependency>
<groupId>com.gm.gsmc</groupId>
<artifactId>gpc_utility_117490</artifactId>
<version>${project.version}</version>
</dependency>

<!-- All Spring dependencies-->
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.3.2</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
<exclusions>
<exclusion>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
</exclusion>
<exclusion>
<artifactId>hibernate-entitymanager</artifactId>
<groupId>org.hibernate</groupId>
</exclusion>
<exclusion>
<artifactId>org.springframework</artifactId>
<groupId>spring-aspects</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!-- Including this allows the war to be executable and deployable -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-cache</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-batch</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.security.extensions</groupId>
<artifactId>spring-security-saml2-core</artifactId>
<version>1.0.2.RELEASE</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
</exclusions>
</dependency>

<!-- Utilities -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.16.18</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>18.0</version>
</dependency>
<dependency>
<groupId>net.sf.dozer</groupId>
<artifactId>dozer</artifactId>
<version>5.5.1</version>
</dependency>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>2.9.4</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.2</version>
</dependency>
<dependency>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-core</artifactId>
<version>3.5.1</version>
</dependency>

<!-- Swagger Libs -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.6.1</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.6.1</version>
<type>jar</type>
<exclusions>
<exclusion>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct</artifactId>
</exclusion>
</exclusions>
</dependency>

<!-- REST -->
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.7</version>
</dependency>

<!-- JPA -->
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>eclipselink</artifactId>
<version>2.5.2</version>
</dependency>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>javax.persistence</artifactId>
<version>2.1.1</version>
</dependency>
<dependency>
<groupId>com.oracle.weblogic</groupId>
<artifactId>ojdbc7</artifactId>
<version>12.1.3-0-0</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>3.0.10</version>
</dependency>
<!-- Add-on module to support JSR-310 (Java 8 Date & Time API) data types. -->
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
<version>2.8.6</version>
</dependency>

<!-- Testing dependencies -->
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
</dependency>

<dependency>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct</artifactId> <!-- use mapstruct-jdk8 for Java 8 or higher -->
<version>${org.mapstruct.version}</version>
</dependency>

</dependencies>

<build>
<defaultGoal>clean install</defaultGoal>
<!-- This allows GPC to run as / instead of /GPC on the server -->
<finalName>ROOT_pcf</finalName>
<resources>
<resource>
<directory>src/main/resources/</directory>
<filtering>true</filtering>
<excludes>
<exclude>**/static/**</exclude>
<exclude>**/saml/**</exclude>
</excludes>
</resource>
<resource>
<directory>src/main/resources/</directory>
<filtering>false</filtering>
<includes>
<include>**/static/**</include>
<include>**/saml/**</include>
</includes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.9.1</version>
<executions>
<execution>
<id>attach-artifacts</id>
<phase>package</phase>
<goals>
<goal>attach-artifact</goal>
</goals>
<configuration>
<artifacts>
<artifact>
<file>manifest.yml</file>
<type>yml</type>
<classifier>manifest</classifier>
</artifact>
</artifacts>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.7</version>
</plugin>

<!--Front-End Build-->
<!--cleaning Front-End Dist file-->
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>2.5</version>
<configuration>
<followSymLinks>false</followSymLinks>
<filesets>
<fileset>
<directory>src/main/resources/static/dist</directory>
</fileset>
</filesets>
</configuration>
</plugin>

<!--NPM install and gulp build-->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.4.0</version>
<executions>
<execution>
<id>exec-npm-install</id>
<phase>generate-sources</phase>
<configuration>
<executable>npm</executable>
<workingDirectory>src/main/resources/static</workingDirectory>
<arguments>
<argument>install</argument>
</arguments>
</configuration>
<goals>
<goal>exec</goal>
</goals>
</execution>
<execution>
<id>exec-gulp-build</id>
<phase>generate-resources</phase>
<configuration>
<executable>gulp</executable>
<workingDirectory>src/main/resources/static</workingDirectory>
<arguments>
<argument>build</argument>
</arguments>
</configuration>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
</plugin>

<!-- Tomcat Deployment -->
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<executions>
<execution>
<id>1</id>
<phase>package</phase>
<goals>
<goal>deploy</goal>
</goals>
<configuration>
<password>Pa55w.rd</password>
<path>/ROOT</path>
<update>true</update>
<url>${tomcat.deploy.url1}</url>
<username>manager</username>
<warFile>${project.build.directory}/ROOT-tomcat.war</warFile>
</configuration>
</execution>
<execution>
<id>2</id>
<phase>package</phase>
<goals>
<goal>deploy</goal>
</goals>
<configuration>
<password>Pa55w.rd</password>
<path>/ROOT</path>
<update>true</update>
<url>${tomcat.deploy.url2}</url>
<username>manager</username>
<warFile>${project.build.directory}/ROOT-tomcat.war</warFile>
</configuration>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.6</version>
<executions>
<!-- Tomcat War w/o Oracle Library -->
<execution>
<id>tomcat</id>
<goals>
<goal>war</goal>
</goals>
<configuration>
<warName>ROOT</warName>
<classifier>tomcat</classifier>
<packagingExcludes>
WEB-INF/lib/ojdbc7*.jar,
WEB-INF/lib/mysql*.jar
</packagingExcludes>
</configuration>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<!-- Adds build information used by Spring Actuator for version service -->
<execution>
<id>build info</id>
<goals>
<goal>build-info</goal>
</goals>
<configuration>
<additionalProperties>
<Implementation-Title>com.gm.gpc</Implementation-Title>
<Implementation-Version>${project.version}</Implementation-Version>
<Implementation-Build-Number>${jenkins.build.number}</Implementation-Build-Number>
<Implementation-SCM-Revision>${jenkins.build.scm.revision}</Implementation-SCM-Revision>
</additionalProperties>
</configuration>
</execution>
<execution>
<goals>
<goal>repackage</goal>
</goals>
<configuration>
<attach>true</attach>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<!--
<annotationProcessorPaths>
<path>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.16.18</version>
</path>
<path>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct-processor</artifactId>
<version>${org.mapstruct.version}</version>
</path>
</annotationProcessorPaths>
-->
</configuration>
</plugin>
</plugins>
</build>
</project>

robert_...@yahoo.com

unread,
Jul 26, 2017, 1:18:52 PM7/26/17
to mapstruct-users, robert_...@yahoo.com
It looks like that exceeded the text limit.  I attached the file.
                                <id<span style="background-colo
pom.xml

Andreas Gudian

unread,
Jul 26, 2017, 2:34:01 PM7/26/17
to mapstruct-users, robert_...@yahoo.com
The annotationProcessorPaths are commented out in the file you’ve sent... what does a mvn clean compile do if it’s not commented out? Anything showing up in the target folder then?


--

robert_...@yahoo.com

unread,
Jul 26, 2017, 2:53:52 PM7/26/17
to mapstruct-users, robert_...@yahoo.com
No

Andreas Gudian

unread,
Jul 26, 2017, 3:10:38 PM7/26/17
to mapstruct-users, robert_...@yahoo.com
Well, it doesn’t look like you can share the project as it is, so I would suggest to create a trimed down copy of the project with only two dummy beans, a mapper and a simple test, with an equally cleaned up pom.
The problem lies somewhere in the build - that I’m pretty sure of. Try removing lombok first to see if that’s interfering... once the pom is cleaned up, you can also use mvn help:effective-pom to see what configuration of the compiler-plugin is effectively used together with the Spring parent pom.
Sorry that I can’t give you any more definitive help, but I can’t see anything obvious that’s wrong and so I can only take guesses from my side of the screen ;-)

robert_...@yahoo.com

unread,
Jul 26, 2017, 4:00:59 PM7/26/17
to mapstruct-users, robert_...@yahoo.com
OK, I'll try that.  Thanks for all of your help.

Filip Hrisafov

unread,
Jul 27, 2017, 2:39:55 AM7/27/17
to mapstruct-users, robert_...@yahoo.com
Hi all,

By looking at the pom there is no dependency on mapstruc-processor. Therefore, the MapStruct processor is not running.

If you add this:

<dependency>
   <groupId>org.mapstruct</groupId>
   <artifactId>mapstruct-processor</artifactId>
   <version>${org.mapstruct.version}</version>
   
<scope>provided</scope>
</dependency>

Then your mappers should be created.

Theoretically it should work if you uncomment annotationProcessorPaths, I don't know why it doesn't. Are you actually using Lomboks annotations in your code?

Cheers,
Filip

robert_...@yahoo.com

unread,
Aug 2, 2017, 3:08:42 PM8/2/17
to mapstruct-users, robert_...@yahoo.com
Filip,

That fixed it.  Thanks much for your help!
Reply all
Reply to author
Forward
0 new messages