Implementation class not found exception

3,480 views
Skip to first unread message

lai yoke hman

unread,
Mar 11, 2015, 12:27:01 PM3/11/15
to mapstru...@googlegroups.com
Hi,

I'm getting implementation class not found exception when i'm trying to get the mapper using the interface INSTANCE way following the example in the documentation.
May i know where's all the generated implementation goes?

Gunnar Morling

unread,
Mar 11, 2015, 4:38:22 PM3/11/15
to mapstru...@googlegroups.com
Hi,

It depends on the way how you integrate MapStruct into your project. Which kind of build tool are you using? Maven? Gradle?

If you e.g. use MapStruct with Maven as described in http://mapstruct.org/documentation/, the generated sources will be under "target/generated-sources". If you e.g. use MapStruct in a plain Eclipse project (i.e. not with Maven via M2E), the generated sources will be in ".apt_generated".

--Gunnar

lai yoke hman

unread,
Mar 11, 2015, 11:57:43 PM3/11/15
to mapstru...@googlegroups.com
Hi,

This is new to me, and I just realized I need to enable annotation processor in Eclipse. Now i got the .apt_generated folder in my project but I still don't see the generated implementation, can you help?

Gunnar Morling

unread,
Mar 12, 2015, 4:02:08 AM3/12/15
to mapstru...@googlegroups.com
Hi,

Have you added the the MapStruct JAR and the FreeMarker JAR from the distribution (http://sourceforge.net/projects/mapstruct/files/) to your factory path (In Eclipse settings that's under Java Compiler -> Annotation Processing -> Factory Path)? Also your Eclipse project must use language level 1.6 or later. If it still doesn't work, you may check in the Error Log (Window -> Show View -> Error Log) whether anything shows up.

Note that this will automatically be configured for you if you have configured MapStruct via Maven and import your project into Eclipse (the M2E plug-in then will set up factory path etc. for you).

I will add a how-to for the Eclipse set-up if I find a minute.

Hth,

--Gunnar

Andreas Gudian

unread,
Mar 12, 2015, 4:33:12 AM3/12/15
to Gunnar Morling, mapstru...@googlegroups.com
FYI, the freemarker jar is not required anymore (as we use the shaded version within our jar). :-)
--
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.

Gunnar Morling

unread,
Mar 12, 2015, 4:55:35 AM3/12/15
to mapstru...@googlegroups.com, gunnar....@googlemail.com
Aah, right. I had forgotten about that one :) Thanks!

Btw. it's one of the planned feature for the MapStruct Eclipse plug-in to help with the set-up of the processor: https://github.com/mapstruct/mapstruct-eclipse/issues/6
To unsubscribe from this group and stop receiving emails from it, send an email to mapstruct-users+unsubscribe@googlegroups.com.
To post to this group, send email to mapstruct-users@googlegroups.com.

lai yoke hman

unread,
Mar 12, 2015, 1:30:30 PM3/12/15
to mapstru...@googlegroups.com
Thanks for the quick reply, I will try again.

And yeah, a how-to for the Eclipse setup will be great.
Reply all
Reply to author
Forward
0 new messages