Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MapStruct processor as maven provided dependency vs as a maven-compiler-plugin annotationProcessor #2338

Closed
mhewedy opened this issue Jan 21, 2021 · 2 comments
Labels

Comments

@mhewedy
Copy link

mhewedy commented Jan 21, 2021

I find the examples to install mapstruct is via the maven-compiler-plugin as an annotationProcessor.
Like the instructions here https://mapstruct.org/documentation/installation/

So I want to ask, how far it is prefered - if at all - over the other way of adding the processor as a provided dpenedency like:

<dependencies>
	<dependency>
		<groupId>org.mapstruct</groupId>
		<artifactId>mapstruct</artifactId>
		<version>${mapstruct.version}</version>
	</dependency>

	<dependency>  <!-- this one here -->
		<groupId>org.mapstruct</groupId>
		<artifactId>mapstruct-processor</artifactId>
		<version>${mapstruct.version}</version>
		<scope>provided</scope>
	</dependency>
</dependencies>
@filiphr
Copy link
Member

filiphr commented Feb 6, 2021

Hey @mhewedy,

This is a good question for StackOverflow or our Gitter Room. We try to keep the issues for feature requests and bug reports.

I think that the best answer for this is the documentation from the Maven Compiler Plugin about annotationProcessorPaths.

Classpath elements to supply as annotation processor path. If specified, the compiler will detect annotation processors only in those classpath elements. If omitted, the default classpath is used to detect annotation processors

This basically means that you won't use any internals of the mapstruct-processor by chance in your production code.

@mhewedy
Copy link
Author

mhewedy commented Feb 6, 2021

Thanks for clarifications and next time I will try to ask questions in the proper place 😊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants