Skullabs / kikaha

A fast middleware designed for microservices
https://skullabs.github.io/kikaha/
Apache License 2.0
59 stars 13 forks source link

Maven Plugin is not fully compatible with most recent version of Maven #272

Closed miere closed 3 years ago

miere commented 4 years ago

Due to old API being used, build breaks due to lack of compatibility of a few features. Once build though it is still runnable on 3.x version of Maven.

Expected behaviour

Should be possible to build the Maven plugin using:

miere commented 4 years ago

@jardelnovaes I just did a big a change in the Maven Plugin. Can you please make a local test on your projects?

Meanwhile, I'll be doing tests with our partner Sizebay, that also uses Kikaha massively. I won't release a new version until I receive feedback from both of you, as it might break your development environment.

jardelnovaes commented 4 years ago

Hi @miere!

For sure, do you have any suggestion? (besides clean, install, package, deploy, run)

jardelnovaes commented 4 years ago

@miere

I didn't find the mvnw.cmd file. Can I put it on the project?

jardelnovaes commented 4 years ago

@miere

mvn clean install failed with maven 3.5.2 (mvn) and maven 3.6.0 (mvnw.cmd)

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-plugin-plugin:3.4:descriptor (default-descriptor) on project kikaha-maven-plugin: Execution default-descriptor of goal org.apache.maven.plugins:maven-plugin-plugin:3.4:descriptor failed.: IllegalArgumentException -> [Help 1]

Apache Maven 3.5.2 (138edd61fd100ec658bfa2d307c43b76940a5d7d; 2017-10-18T05:58:13-02:00) Java version: 1.8.0_231, vendor: Oracle Corporation Default locale: pt_BR, platform encoding: Cp1252 OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"

Apache Maven 3.6.0 (97c98ec64a1fdfee7767ce5ffb20918da4f719f3; 2018-10-24T15:41:47-03:00) Maven home: C:\Users\jardel.novaes.m2\wrapper\dists\apache-maven-3.6.0-bin\2dakv70gp803gtm5ve1ufmvttn\apache-maven-3.6.0 Java version: 1.8.0_231, vendor: Oracle Corporation, runtime: C:\Program Files\Java\jdk1.8.0_231\jre Default locale: pt_BR, platform encoding: Cp1252 OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"

I just "update" the maven-plugin-plugin version from 3.4 to 3.5 in kikaha-maven-plugin\pom.xml and it worked fine.

Should I send this change with the mvnw.cmd file?

I won't use the "fixes/closes" in the PR to avoid to close this issue or should I open another issue to send this fix? (fix = mvnw.cmd file + pom.xml update)

jardelnovaes commented 4 years ago

Hi @miere, I've just opened the #274 issue to separate the mvnw for Windows. I've noticed that you've already updated the pom version (from 3.4 to 3.6).

jardelnovaes commented 4 years ago

Hi @miere I did some tests, I'll do other ones. After pom version changed to 3.6, no problems until now.

jardelnovaes commented 4 years ago

Hi @miere

Unfortunately we are having problems with kikaha-maven-plugin 2.1.9-Final. I had tested it without any problem when it was on development.

Tests was made with maven versions 3.5.2 and 3.6.3 (Today - 03/18/2020)

Details:

Result without -U option. .eclipse.aether.resolution.ArtifactResolutionException: Failure to find ibratan.capacitor:capacitor-core::1.0.0-SNAPSHOT in s3://ibratan-maven/snapshot was cached in the local repository, resolution will not be reattempted until the update interval of ibratan-s3-snapshot has elapsed or updates are forced at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:422) at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:224) at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifact(DefaultArtifactResolver.java:201) at kikaha.mojo.KikahaJarPackagerMojo.getArtifactAbsolutePath(KikahaJarPackagerMojo.java:132) at kikaha.mojo.KikahaJarPackagerMojo.copyDependenciesToZip(KikahaJarPackagerMojo.java:102) at kikaha.mojo.KikahaJarPackagerMojo.populateZip(KikahaJarPackagerMojo.java:89) at kikaha.mojo.KikahaJarPackagerMojo.execute(KikahaJarPackagerMojo.java:66) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:154) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:146) 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:51) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:309) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:194) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:107) at org.apache.maven.cli.MavenCli.execute(MavenCli.java:955) at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:290) at org.apache.maven.cli.MavenCli.main(MavenCli.java:194) 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.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289) at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415) at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356) Caused by: org.eclipse.aether.transfer.ArtifactNotFoundException: Failure to find ibratan.capacitor:capacitor-core::1.0.0-SNAPSHOT in s3://ibratan-maven/snapshot was cached in the local repository, resolution will not be reattempted until the update interval of ibratan-s3-snapshot has elapsed or updates are forced at org.eclipse.aether.internal.impl.DefaultUpdateCheckManager.newException(DefaultUpdateCheckManager.java:233) at org.eclipse.aether.internal.impl.DefaultUpdateCheckManager.checkArtifact(DefaultUpdateCheckManager.java:208) at org.eclipse.aether.internal.impl.DefaultArtifactResolver.gatherDownloads(DefaultArtifactResolver.java:563) at org.eclipse.aether.internal.impl.DefaultArtifactResolver.performDownloads(DefaultArtifactResolver.java:481) at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:399) ... 28 more Failure to find ibratan.capacitor:capacitor-core::1.0.0-SNAPSHOT in s3://ibratan-maven/snapshot was cached in the local repository, resolution will not be reattempted until the update interval of ibratan-s3-snapshot has elapsed or updates are forced

Result with -U [INFO] Building application package: C:\desenvolvimento\ibratan-capacitor\capacitor-app\output\capacitor-app-1.0.0-SNAPSHOT-runnable.jar Downloading from ibratan-s3-snapshot: s3://ibratan-maven/snapshot/ibratan/capacitor/capacitor-core/1.0.0-SNAPSHOT/capacitor-core-1.0.0-SNAPSHOT org.eclipse.aether.resolution.ArtifactResolutionException: Could not find artifact ibratan.capacitor:capacitor-core::1.0.0-SNAPSHOT in ibratan-s3-snapshot (s3://ibratan-maven/snapshot) at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:422) at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:224) at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifact(DefaultArtifactResolver.java:201) at kikaha.mojo.KikahaJarPackagerMojo.getArtifactAbsolutePath(KikahaJarPackagerMojo.java:132) at kikaha.mojo.KikahaJarPackagerMojo.copyDependenciesToZip(KikahaJarPackagerMojo.java:102) at kikaha.mojo.KikahaJarPackagerMojo.populateZip(KikahaJarPackagerMojo.java:89) at kikaha.mojo.KikahaJarPackagerMojo.execute(KikahaJarPackagerMojo.java:66) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:154) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:146) 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:51) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:309) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:194) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:107) at org.apache.maven.cli.MavenCli.execute(MavenCli.java:955) at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:290) at org.apache.maven.cli.MavenCli.main(MavenCli.java:194) 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.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289) at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415) at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356) Caused by: org.eclipse.aether.transfer.ArtifactNotFoundException: Could not find artifact ibratan.capacitor:capacitor-core::1.0.0-SNAPSHOT in ibratan-s3-snapshot (s3://ibratan-maven/snapshot) at org.eclipse.aether.connector.basic.ArtifactTransportListener.transferFailed(ArtifactTransportListener.java:48) at org.eclipse.aether.connector.basic.BasicRepositoryConnector$TaskRunner.run(BasicRepositoryConnector.java:365) at org.eclipse.aether.util.concurrency.RunnableErrorForwarder$1.run(RunnableErrorForwarder.java:75) at org.eclipse.aether.connector.basic.BasicRepositoryConnector$DirectExecutor.execute(BasicRepositoryConnector.java:583) at org.eclipse.aether.connector.basic.BasicRepositoryConnector.get(BasicRepositoryConnector.java:259) at org.eclipse.aether.internal.impl.DefaultArtifactResolver.performDownloads(DefaultArtifactResolver.java:498) at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:399) ... 28 more Could not find artifact ibratan.capacitor:capacitor-core::1.0.0-SNAPSHOT in ibratan-s3-snapshot (s3://ibratan-maven/snapshot)

Result after delete local repository [INFO] Building application package: C:\desenvolvimento\ibratan-capacitor\capacitor-app\output\capacitor-app-1.0.0-SNAPSHOT-runnable.jar Downloading from ibratan-s3-snapshot: s3://ibratan-maven/snapshot/ibratan/capacitor/capacitor-core/1.0.0-SNAPSHOT/capacitor-core-1.0.0-20200317.144439-341 org.eclipse.aether.resolution.ArtifactResolutionException: Could not find artifact ibratan.capacitor:capacitor-core::1.0.0-20200317.144439-341 in ibratan-s3-snapshot (s3://ibratan-maven/snapshot) at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:422) at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:224) at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifact(DefaultArtifactResolver.java:201) at kikaha.mojo.KikahaJarPackagerMojo.getArtifactAbsolutePath(KikahaJarPackagerMojo.java:132) at kikaha.mojo.KikahaJarPackagerMojo.copyDependenciesToZip(KikahaJarPackagerMojo.java:102) at kikaha.mojo.KikahaJarPackagerMojo.populateZip(KikahaJarPackagerMojo.java:89) at kikaha.mojo.KikahaJarPackagerMojo.execute(KikahaJarPackagerMojo.java:66) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:154) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:146) 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:51) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:309) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:194) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:107) at org.apache.maven.cli.MavenCli.execute(MavenCli.java:955) at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:290) at org.apache.maven.cli.MavenCli.main(MavenCli.java:194) 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.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289) at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415) at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356) Caused by: org.eclipse.aether.transfer.ArtifactNotFoundException: Could not find artifact ibratan.capacitor:capacitor-core::1.0.0-20200317.144439-341 in ibratan-s3-snapshot (s3://ibratan-maven/snapshot) at org.eclipse.aether.connector.basic.ArtifactTransportListener.transferFailed(ArtifactTransportListener.java:48) at org.eclipse.aether.connector.basic.BasicRepositoryConnector$TaskRunner.run(BasicRepositoryConnector.java:365) at org.eclipse.aether.util.concurrency.RunnableErrorForwarder$1.run(RunnableErrorForwarder.java:75) at org.eclipse.aether.connector.basic.BasicRepositoryConnector$DirectExecutor.execute(BasicRepositoryConnector.java:583) at org.eclipse.aether.connector.basic.BasicRepositoryConnector.get(BasicRepositoryConnector.java:259) at org.eclipse.aether.internal.impl.DefaultArtifactResolver.performDownloads(DefaultArtifactResolver.java:498) at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:399) ... 28 more Could not find artifact ibratan.capacitor:capacitor-core::1.0.0-20200317.144439-341 in ibratan-s3-snapshot (s3://ibratan-maven/snapshot)

Local repository after cleaning it image

S3 Repository kikaha-maven-plugin-snapshot

miere commented 4 years ago

@jardelnovaes G’day mate.

I’ll take a close look at it. This plugin is quite sensitive and the changes I’ve introduced was quite big, I was expecting side effects.

The most recent version of Maven (3.5 or superior) is using Aether to retrieve dependencies. That was the reason I’ve asked for an end-to-end test.

I’m having a meeting tonight with you fellow Gabriel and I might not have enough time to simulate de problem and apply a patch. To save us time, do you mind to create an small project that simulates de problem?

Another unrelated question: Undertow team has been reported of another security issue. Thus I’ll have to upgrade it to version 3. Was the previous Undertow upgrade I recently did hassle free?

jardelnovaes commented 4 years ago

Hi @miere

We wasn't able to test the last Undertow version change (from 1.4.22 to 2.0.23)

About the small project, please see this https://github.com/jardelnovaes/kikaha-tests Read the ReadMe for more details.

miere commented 4 years ago

Thanks for that, mate. I shall be looking into it tonight.

On Thu, Mar 19, 2020 at 9:02 AM Jardel Novaes notifications@github.com wrote:

Hi @miere https://github.com/miere

We wasn't able to test the last Undertow version change (from 1.4.22 to 2.0.23)

About the small project, please see this https://github.com/jardelnovaes/kikaha-tests Read the ReadMe for more details.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Skullabs/kikaha/issues/272#issuecomment-600881156, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAD7NUCBE63JADXAFM3CKV3RIFAIXANCNFSM4KZLIUVA .

-- / Miere L. Teixeira /

miere commented 4 years ago

@jardelnovaes

I was trying to run you sample code and reproduce your issue, but apparently there are a few dependencies and repositories in which I don't have access to. Thus, the error messages below attached.

Can you modify it to make runnable from outside Ibratan?

[ERROR] Failed to execute goal on project test-core: Could not resolve dependencies for project ibratan.capacitor:test-core:jar:1.0.0-SNAPSHOT: Failed to collect dependencies at ibratan.tk:tk-metrics:jar:1.0.0-SNAPSHOT: Failed to read artifact descriptor for ibratan.tk:tk-metrics:jar:1.0.0-SNAPSHOT: Could not transfer artifact ibratan.tk:tk-metrics:pom:1.0.0-SNAPSHOT from/to ibratan-s3-snapshot (s3://ibratan-maven/snapshot): Unable to load AWS credentials from any provider in the chain -> [Help 1]
jardelnovaes commented 4 years ago

@miere

I'm sorry, I've just fix it and update the project.

miere commented 4 years ago

@jardelnovaes I just amended the previous changes regarding this issue. I've tested the changes using your project, both in Mac and Linux machines.

Can you please build kikaha locally, version 2.1.10-SNAPSHOT, and check if the changes I've made have fixed your issue properly? I shall be in touch with other Kikaha customers that I usually provide support for and gather feedback from them as well.

jardelnovaes commented 4 years ago

Hi @miere

I made tests with the maven plugin, our apps and APIs. Everything is working without problems.

jardelnovaes commented 4 years ago

I opened the PR #276 to fix the special regex chars when they're part of file path (Windows) (e.g. c:\kikaha-app\test-app)

Error: [ERROR] Failed to execute goal io.skullabs.kikaha:kikaha-maven-plugin:2.1.10-SNAPSHOT:deploy-on-aws-s3 (kikaha-deploy-aws-s3) on project test-app: Execution kikaha-deploy-aws-s3 of goal io.skullabs.kikaha:kikaha-maven-plugin:2.1.10-SNAPSHOT:deploy-on-aws-s3 failed: \k is not followed by '<' for named capturing group near index 41 [ERROR] C:\\kikaha-app\test-app/package-codedeploy/

miere commented 3 years ago

It should be fixed by #276 and #281