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

SNAPSHOT releases should be optional #26

Closed
MahatmaFatalError opened this issue Mar 20, 2020 · 7 comments
Closed

SNAPSHOT releases should be optional #26

MahatmaFatalError opened this issue Mar 20, 2020 · 7 comments
Labels

Comments

@MahatmaFatalError
Copy link

We don't have any snapshot releases on our nexus.

That leads to this exception (with the maven plugin):

[INFO] --- swagger-brake-maven-plugin:2.0.0-SNAPSHOT:check (default) @ dummy ---
[INFO] Downloading latest artifact from repository 'http://localhost/nexus/content/groups/releases' with groupId 'my.group' artifactId 'my.artifact'
[info] Latest version of the artifact could not be retrieved from http://localhost/nexus/content/groups/releases with my.group:my.artifact
[info] Assuming this is the first version of the artifact, skipping check for breaking changes

io.redskap.swagger.brake.runner.exception.LatestArtifactDownloadException: Error while downloading the latest version of the artifact
	at io.redskap.swagger.brake.runner.download.ArtifactDownloaderHandler.handle(ArtifactDownloaderHandler.java:43)
	at io.redskap.swagger.brake.runner.Runner.run(Runner.java:27)
	at io.redskap.swagger.brake.runner.Starter.start(Starter.java:15)
	at io.redskap.swagger.brake.maven.StarterWrapper.start(StarterWrapper.java:11)
	at io.redskap.swagger.brake.maven.Executor.execute(Executor.java:22)
	at io.redskap.swagger.brake.maven.SwaggerBrakeMojo.execute(SwaggerBrakeMojo.java:55)
	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:210)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:156)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:148)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
	at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:56)
	at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:305)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:192)
	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:105)
	at org.apache.maven.cli.MavenCli.execute(MavenCli.java:957)
	at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:289)
	at org.apache.maven.cli.MavenCli.main(MavenCli.java:193)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:282)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:225)
	at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:406)
	at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:347)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.apache.maven.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.java:39)
	at org.apache.maven.wrapper.WrapperExecutor.execute(WrapperExecutor.java:122)
	at org.apache.maven.wrapper.MavenWrapperMain.main(MavenWrapperMain.java:61)
Caused by: java.lang.RuntimeException: Cannot get metadata
	at io.redskap.swagger.brake.maven.maven2.MavenMetadataDownloader.download(MavenMetadataDownloader.java:29)
	at io.redskap.swagger.brake.maven.maven2.LatestSnapshotNameResolver.resolve(LatestSnapshotNameResolver.java:21)
	at io.redskap.swagger.brake.maven.maven2.Maven2LatestArtifactDownloader.download(Maven2LatestArtifactDownloader.java:20)
	at io.redskap.swagger.brake.runner.download.ArtifactDownloaderHandler.handle(ArtifactDownloaderHandler.java:36)
	... 34 more
Caused by: javax.xml.bind.UnmarshalException: unerwartetes Element (URI:"", lokal:"html"). Erwartete Elemente sind <{}metadata>,<{}snapshot>,<{}versioning>
	at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.handleEvent(UnmarshallingContext.java:714)
	at com.sun.xml.bind.v2.runtime.unmarshaller.Loader.reportError(Loader.java:232)
	at com.sun.xml.bind.v2.runtime.unmarshaller.Loader.reportError(Loader.java:227)
	at com.sun.xml.bind.v2.runtime.unmarshaller.Loader.reportUnexpectedChildElement(Loader.java:94)
	at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext$DefaultRootLoader.childElement(UnmarshallingContext.java:1119)
	at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext._startElement(UnmarshallingContext.java:544)
	at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.startElement(UnmarshallingContext.java:526)
	at com.sun.xml.bind.v2.runtime.unmarshaller.SAXConnector.startElement(SAXConnector.java:138)
	at java.xml/com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:510)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:374)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl$NSContentDriver.scanRootElementHook(XMLNSDocumentScannerImpl.java:613)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:3063)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:836)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:605)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:112)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:534)
	at java.xml/com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:888)
	at java.xml/com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:824)
	at java.xml/com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
	at java.xml/com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1216)
	at java.xml/com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:635)
	at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:228)
	at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:199)
	at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:170)
	at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:209)
	at io.redskap.swagger.brake.maven.maven2.MavenMetadataDownloader.getMetadata(MavenMetadataDownloader.java:35)
	at io.redskap.swagger.brake.maven.maven2.MavenMetadataDownloader.download(MavenMetadataDownloader.java:27)
	... 37 more

It tries to get maven-metadata.xml within a version subfolder, however, there is none. There is only one in the top directory.

So the LatestSnapshotNameResolver should not stop the entire process.

@galovics
Copy link
Member

@MahatmaFatalError agreed, let me take a look on this.

@MahatmaFatalError
Copy link
Author

Thanks for fixing. Is there a plan for the 2.0.0 release? Maybe SNAPSHOT?

@galovics
Copy link
Member

galovics commented Jul 7, 2020

@MahatmaFatalError plan is there but I dont have an exact date yet, most probably it will happen in the upcoming 2 weeks or so. In the meantime you can give it a try with the snapshot version. In case you are looking for a CLI, you can do a build yourself from master.
In case its the lib you are looking for, then its 1.2.0-SNAPSHOT.

@MahatmaFatalError
Copy link
Author

I build master locally via gradlew clean build shadowJar and run the jar file. However, it crashes with

Exception occured
io.redskap.swagger.brake.runner.exception.LatestArtifactDownloadException: Error while downloading the latest version of the artifact
	at io.redskap.swagger.brake.runner.download.ArtifactDownloaderHandler.handle(ArtifactDownloaderHandler.java:44)
	at io.redskap.swagger.brake.runner.Runner.run(Runner.java:37)
	at io.redskap.swagger.brake.runner.Starter.start(Starter.java:15)
	at io.redskap.swagger.brake.cli.Cli.start(Cli.java:34)
	at io.redskap.swagger.brake.cli.SwaggerBrakeMain.main(SwaggerBrakeMain.java:16)
Caused by: java.lang.RuntimeException: java.util.zip.ZipException: error in opening zip file
	at io.redskap.swagger.brake.maven.jar.ApiFileJarResolver.resolve(ApiFileJarResolver.java:43)
	at io.redskap.swagger.brake.runner.download.ArtifactDownloaderHandler.handle(ArtifactDownloaderHandler.java:39)
	... 4 common frames omitted
Caused by: java.util.zip.ZipException: error in opening zip file
	at java.util.zip.ZipFile.open(Native Method)
	at java.util.zip.ZipFile.<init>(ZipFile.java:225)
	at java.util.zip.ZipFile.<init>(ZipFile.java:155)
	at java.util.jar.JarFile.<init>(JarFile.java:166)
	at java.util.jar.JarFile.<init>(JarFile.java:130)
	at io.redskap.swagger.brake.maven.jar.JarScanner.find(JarScanner.java:25)
	at io.redskap.swagger.brake.maven.jar.ApiFileJarResolver.findSwaggerFile(ApiFileJarResolver.java:48)
	at io.redskap.swagger.brake.maven.jar.ApiFileJarResolver.resolve(ApiFileJarResolver.java:35)
	... 5 common frames omitted

BTW, why is --maven-snapshot-repo-url still mandatory? Wouldn't it be sufficient to specify either --maven-repo-url or --maven-snapshot-repo-url that gets compared to local?

@galovics
Copy link
Member

galovics commented Jul 9, 2020

@MahatmaFatalError Making either of those 2 options optional was on the table already, didn't have the time to do so until now. I just pushed a new commit. Please try that and let me know if it works.
If not, let's open a new issue with your actual problem. Thanks!

@MahatmaFatalError
Copy link
Author

MahatmaFatalError commented Jul 14, 2020

I tried with the lastest commit and omitting the snapshot repo uri and got:

Seems like latest artifact resolution is intended to be used but missing some of the parameters
Exception occured
java.lang.IllegalArgumentException: oldApiPath must be provided
	at io.redskap.swagger.brake.runner.Runner.run(Runner.java:40)
	at io.redskap.swagger.brake.runner.Starter.start(Starter.java:15)
	at io.redskap.swagger.brake.cli.Cli.start(Cli.java:34)
	at io.redskap.swagger.brake.cli.SwaggerBrakeMain.main(SwaggerBrakeMain.java:16)

However, I think this issue is not related to the new code changes but rather on our infrastructure where the jar containing the swagger is packed in a mtar file.

@galovics
Copy link
Member

@MahatmaFatalError the implementation had a bug. Please check out the latest commit and let me know how it goes. :-)

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