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

Update Swagger to version 1.5.21 #458

Open
wants to merge 1 commit into
base: master
from

Conversation

Projects
None yet
2 participants
@alejandrocq

alejandrocq commented Oct 10, 2018

PR for issue #452

I have updated swagger-core version to 1.5.21, and also I had to update swagger-maven-plugin to latest version (3.1.7) and swagger-ui to latest version of the 2.x.x branch (2.1.4) to make it work.

I have also done the necessary changes in imports and swagger-maven-plugin configuration to generate swagger files correctly. You can see the result running mvn clean compile && mvn process-classes.

Swagger-UI url param in resources/swagger/index.html must be changed to a local/remote file server path (I haven't been able to make it work with local files). For example, IntelliJ creates a file server automatically to show HTML files, so I could test that swagger.json was correctly generated:

image

Anyway, output files should be checked (annotations haven't changed between 1.3.x and 1.5.x swagger versions, but I'm not 100% sure if the API it's being generated correctly).

@mcicolella

This comment has been minimized.

Show comment
Hide comment
@mcicolella

mcicolella Oct 11, 2018

Contributor

@alejandrocq I tried to compile the project but I have this error

[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failed to configure plugin parameters for: com.github.kongchen:swagger-maven-plugin:3.1.7

(found static expression: 'com.freedomotic.plugins.devices.restapiv3.resources' which may act as a default value).

Cause: Cannot assign configuration entry 'locations' to 'interface java.util.List' from 'com.freedomotic.plugins.devices.restapiv3.resources', which is of type class java.lang.String

Contributor

mcicolella commented Oct 11, 2018

@alejandrocq I tried to compile the project but I have this error

[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failed to configure plugin parameters for: com.github.kongchen:swagger-maven-plugin:3.1.7

(found static expression: 'com.freedomotic.plugins.devices.restapiv3.resources' which may act as a default value).

Cause: Cannot assign configuration entry 'locations' to 'interface java.util.List' from 'com.freedomotic.plugins.devices.restapiv3.resources', which is of type class java.lang.String

@alejandrocq

This comment has been minimized.

Show comment
Hide comment
@alejandrocq

alejandrocq Oct 11, 2018

@mcicolella Hi! I forgot to add "location" tag inside "locations" in plugin configuration, but it's weird that I wasn't getting that error. It should work now.

Also, I forgot to run mvn clean install and I have noticed that some test are failing. I'm not sure why yet.

alejandrocq commented Oct 11, 2018

@mcicolella Hi! I forgot to add "location" tag inside "locations" in plugin configuration, but it's weird that I wasn't getting that error. It should work now.

Also, I forgot to run mvn clean install and I have noticed that some test are failing. I'm not sure why yet.

@mcicolella

This comment has been minimized.

Show comment
Hide comment
@mcicolella

mcicolella Oct 11, 2018

Contributor

@alejandrocq now there is another error
[ERROR] FATAL ERROR
[INFO] ------------------------------------------------------------------------
[INFO] com/freedomotic/marketplace/IPluginCategory
com.freedomotic.marketplace.IPluginCategory
[INFO] ------------------------------------------------------------------------
[INFO] Trace
java.lang.NoClassDefFoundError: com/freedomotic/marketplace/IPluginCategory
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
at java.lang.Class.privateGetPublicMethods(Class.java:2902)
at java.lang.Class.getMethods(Class.java:1615)
at com.github.kongchen.swagger.docgen.reader.JaxrsReader.getFilteredMethods(JaxrsReader.java:178)
at com.github.kongchen.swagger.docgen.reader.JaxrsReader.read(JaxrsReader.java:111)
at com.github.kongchen.swagger.docgen.reader.JaxrsReader.handleSubResource(JaxrsReader.java:219)
at com.github.kongchen.swagger.docgen.reader.JaxrsReader.read(JaxrsReader.java:163)
at com.github.kongchen.swagger.docgen.reader.JaxrsReader.read(JaxrsReader.java:85)
at com.github.kongchen.swagger.docgen.reader.JaxrsReader.read(JaxrsReader.java:75)
at com.github.kongchen.swagger.docgen.AbstractDocumentSource.loadDocuments(AbstractDocumentSource.java:104)
at com.github.kongchen.swagger.docgen.mavenplugin.ApiDocumentMojo.execute(ApiDocumentMojo.java:96)
at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:556)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:535)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
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.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: java.lang.ClassNotFoundException: com.freedomotic.marketplace.IPluginCategory
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at org.codehaus.classworlds.RealmClassLoader.loadClassDirect(RealmClassLoader.java:195)
at org.codehaus.classworlds.DefaultClassRealm.loadClass(DefaultClassRealm.java:255)
at org.codehaus.classworlds.DefaultClassRealm.loadClass(DefaultClassRealm.java:274)
at org.codehaus.classworlds.RealmClassLoader.loadClass(RealmClassLoader.java:214)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 31 more

Contributor

mcicolella commented Oct 11, 2018

@alejandrocq now there is another error
[ERROR] FATAL ERROR
[INFO] ------------------------------------------------------------------------
[INFO] com/freedomotic/marketplace/IPluginCategory
com.freedomotic.marketplace.IPluginCategory
[INFO] ------------------------------------------------------------------------
[INFO] Trace
java.lang.NoClassDefFoundError: com/freedomotic/marketplace/IPluginCategory
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
at java.lang.Class.privateGetPublicMethods(Class.java:2902)
at java.lang.Class.getMethods(Class.java:1615)
at com.github.kongchen.swagger.docgen.reader.JaxrsReader.getFilteredMethods(JaxrsReader.java:178)
at com.github.kongchen.swagger.docgen.reader.JaxrsReader.read(JaxrsReader.java:111)
at com.github.kongchen.swagger.docgen.reader.JaxrsReader.handleSubResource(JaxrsReader.java:219)
at com.github.kongchen.swagger.docgen.reader.JaxrsReader.read(JaxrsReader.java:163)
at com.github.kongchen.swagger.docgen.reader.JaxrsReader.read(JaxrsReader.java:85)
at com.github.kongchen.swagger.docgen.reader.JaxrsReader.read(JaxrsReader.java:75)
at com.github.kongchen.swagger.docgen.AbstractDocumentSource.loadDocuments(AbstractDocumentSource.java:104)
at com.github.kongchen.swagger.docgen.mavenplugin.ApiDocumentMojo.execute(ApiDocumentMojo.java:96)
at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:556)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:535)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
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.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: java.lang.ClassNotFoundException: com.freedomotic.marketplace.IPluginCategory
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at org.codehaus.classworlds.RealmClassLoader.loadClassDirect(RealmClassLoader.java:195)
at org.codehaus.classworlds.DefaultClassRealm.loadClass(DefaultClassRealm.java:255)
at org.codehaus.classworlds.DefaultClassRealm.loadClass(DefaultClassRealm.java:274)
at org.codehaus.classworlds.RealmClassLoader.loadClass(RealmClassLoader.java:214)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 31 more

@alejandrocq

This comment has been minimized.

Show comment
Hide comment
@alejandrocq

alejandrocq Oct 11, 2018

@mcicolella That's weird. Which command are you running and what Maven version do you have installed?

alejandrocq commented Oct 11, 2018

@mcicolella That's weird. Which command are you running and what Maven version do you have installed?

@mcicolella

This comment has been minimized.

Show comment
Hide comment
@mcicolella

mcicolella Oct 11, 2018

Contributor

@alejandrocq mvn clean install on Maven 3.3.9

Contributor

mcicolella commented Oct 11, 2018

@alejandrocq mvn clean install on Maven 3.3.9

@alejandrocq

This comment has been minimized.

Show comment
Hide comment
@alejandrocq

alejandrocq Oct 14, 2018

@mcicolella Sorry I've been busy. The problem was a conflict with jackson dependencies, so I have fixed them and now compilation completes without errors. Anyway, I'm going to check my changes tomorrow to be sure.

alejandrocq commented Oct 14, 2018

@mcicolella Sorry I've been busy. The problem was a conflict with jackson dependencies, so I have fixed them and now compilation completes without errors. Anyway, I'm going to check my changes tomorrow to be sure.

Update Swagger to version 1.5.21, swagger-maven-plugin to 3.1.7 and s…
…wagger-ui to 2.1.5

I have added templates too to keep the old configuration using new
swagger-maven-plugin properties. Also, I have reorganized jackson
dependencies to avoid compilation errors, using version 2.8.9.
@alejandrocq

This comment has been minimized.

Show comment
Hide comment
@alejandrocq

alejandrocq Oct 15, 2018

@mcicolella I have updated my commit and rebased latest commits from master branch into my fork branch. Check it when you can and let me know! :)

alejandrocq commented Oct 15, 2018

@mcicolella I have updated my commit and rebased latest commits from master branch into my fork branch. Check it when you can and let me know! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment