File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
modules/swagger-codegen-maven-plugin/src/main/java/io/swagger/codegen/plugin Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change 50
50
/**
51
51
* Goal which generates client/server code from a swagger json/yaml definition.
52
52
*/
53
- @ Mojo (name = "generate" , defaultPhase = LifecyclePhase .GENERATE_SOURCES )
53
+ @ Mojo (name = "generate" , defaultPhase = LifecyclePhase .GENERATE_SOURCES , threadSafe = true )
54
54
public class CodeGenMojo extends AbstractMojo {
55
55
56
56
@ Parameter (name = "verbose" , required = false , defaultValue = "false" )
@@ -315,6 +315,13 @@ public class CodeGenMojo extends AbstractMojo {
315
315
316
316
@ Override
317
317
public void execute () throws MojoExecutionException {
318
+ // Using the naive approach for achieving thread safety
319
+ synchronized (CodeGenMojo .class ) {
320
+ execute_ ();
321
+ }
322
+ }
323
+
324
+ protected void execute_ () throws MojoExecutionException {
318
325
319
326
if (skip ) {
320
327
getLog ().info ("Code generation is skipped." );
You can’t perform that action at this time.
0 commit comments