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

swagger2markup conflicts with kotlin-gradle-plugin #9

Open
McDime opened this issue Feb 7, 2018 · 2 comments
Open

swagger2markup conflicts with kotlin-gradle-plugin #9

McDime opened this issue Feb 7, 2018 · 2 comments

Comments

@McDime
Copy link

McDime commented Feb 7, 2018

swagger2markup-gradle-plugin conflicts with kotlin-gradle-plugin.

Unfortunately, I have no idea where the problem is and how to solve it. Any help is appreciated.

How to reproduce:

  1. Take spring-swagger2markup-demo project (https://github.com/Swagger2Markup/spring-swagger2markup-demo)
  2. Add a new classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.10" before the line 9 in the build.gradle (section buildscript / dependencies )
... 
}
    dependencies {
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.10"
        classpath 'org.asciidoctor:asciidoctor-gradle-plugin:1.5.3'
        classpath 'org.asciidoctor:asciidoctorj-pdf:1.5.0-alpha.10.1'
...
  1. run gradle asciidoctor

The first run will give you:
FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':convertSwagger2markup'.

javaslang.collection.HashMap.ofEntries([Ljavaslang/Tuple2;)Ljavaslang/collection/HashMap;

The following runs will give you:
FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':convertSwagger2markup'.

Could not initialize class ch.netzwerg.paleo.ColumnType

With --stacktrace:

* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':convertSwagger2markup'.
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:100)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:70)
	at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:62)
	at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54)
	at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
	at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:97)
	at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:87)
	at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:52)
	at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
	at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54)
	at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
	at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34)
	at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.run(DefaultTaskGraphExecuter.java:248)
	at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
	at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
	at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)
	at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
	at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:241)
	at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:230)
	at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.processTask(DefaultTaskPlanExecutor.java:123)
	at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.access$200(DefaultTaskPlanExecutor.java:79)
	at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:104)
	at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:98)
	at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.execute(DefaultTaskExecutionPlan.java:625)
	at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.executeWithTask(DefaultTaskExecutionPlan.java:580)
	at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.run(DefaultTaskPlanExecutor.java:98)
	at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
	at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
	at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
Caused by: java.lang.NoClassDefFoundError: Could not initialize class ch.netzwerg.paleo.ColumnType
	at ch.netzwerg.paleo.ColumnIds$StringColumnId.<init>(ColumnIds.java:69)
	at ch.netzwerg.paleo.ColumnIds$StringColumnId.of(ColumnIds.java:73)
	at io.github.swagger2markup.internal.component.ParameterTableComponent.apply(ParameterTableComponent.java:76)
	at io.github.swagger2markup.internal.component.PathOperationComponent.buildParametersSection(PathOperationComponent.java:198)
	at io.github.swagger2markup.internal.component.PathOperationComponent.apply(PathOperationComponent.java:100)
	at io.github.swagger2markup.internal.document.PathsDocument.applyPathOperationComponent(PathsDocument.java:223)
	at io.github.swagger2markup.internal.document.PathsDocument.buildOperation(PathsDocument.java:207)
	at io.github.swagger2markup.internal.document.PathsDocument.lambda$null$1(PathsDocument.java:133)
	at io.github.swagger2markup.internal.document.PathsDocument.lambda$buildsPathsSection$2(PathsDocument.java:133)
	at io.github.swagger2markup.internal.document.PathsDocument.buildsPathsSection(PathsDocument.java:127)
	at io.github.swagger2markup.internal.document.PathsDocument.apply(PathsDocument.java:103)
	at io.github.swagger2markup.Swagger2MarkupConverter.applyPathsDocument(Swagger2MarkupConverter.java:197)
	at io.github.swagger2markup.Swagger2MarkupConverter.toFolder(Swagger2MarkupConverter.java:182)
	at io.github.swagger2markup.Swagger2MarkupConverter$toFolder$0.call(Unknown Source)
	at io.github.swagger2markup.tasks.Swagger2MarkupTask.convertSwagger2markup(Swagger2MarkupTask.groovy:68)
	at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
	at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.doExecute(DefaultTaskClassInfoStore.java:142)
	at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.execute(DefaultTaskClassInfoStore.java:135)
	at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.execute(DefaultTaskClassInfoStore.java:122)
	at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:762)
	at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:729)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.java:121)
	at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
	at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
	at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)
	at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:110)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:92)
	... 28 more
@McDime
Copy link
Author

McDime commented Feb 12, 2018

As a workaround (if someone else is having the same issue), you can use io.springfox:springfox-staticdocs:2.6.1 to generate *.adoc files from the test class using Swagger2MarkupResultHandler.outputDirectory(outputDir).build().
In this way, you can avoid usage of the swagger2markup gradle plugin that conflicts with the Kotlin gradle pluging.

The asciidoctor gradle plugin works fine together with the Kotlin.

@ghost
Copy link

ghost commented Apr 3, 2018

I managed to fix this by upgrading swagger2markup to the latest version:

dependencies {
        classpath "io.github.swagger2markup:swagger2markup:1.3.2"
        classpath "io.github.swagger2markup:swagger2markup-gradle-plugin:1.3.1"
  }

(Version 1.3.2 of the Gradle plugin is not released yet)

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

No branches or pull requests

1 participant