IBM / cics-bundle-maven

The plugin to build and deploy CICS bundles in a Maven build.
https://ibm.github.io/cics-bundle-maven/plugin-info.html
Eclipse Public License 2.0
18 stars 25 forks source link

Eclipse Maven Install fails to replace built .war file, even with -SNAPSHOT version #191

Closed JAMOGRAD closed 2 years ago

JAMOGRAD commented 2 years ago

I have a Maven Java project in Eclipse, and I select the project, then "Run As->Maven install"

This runs, and "packages the webapp", "assembles the webapp","processes the war project","builds the war",

When it comes to "spring-boot-maven-plugin:2.5.4:repackage (repackage) [INFO] Replacing main artifact with repackaged archive" it fails.

[ERROR] Failed to execute goal com.ibm.cics:cics-bundle-maven-plugin:1.0.2:bundle-war (default) on project Error writing bundle resource

If I re-run with -X I find out it is because it already exists.

This is apparently normal Maven behaviour, as it should not replace the same version. I can re-version (but that makes no sense for a development project) OR I can add -SNAPSHOT to the end of the version.

I add -SNAPSHOT to the end of the version and it works... because it creates a new file.

I do it again... and it fails because it already exists.

If I do "maven clean install" it works. Shouldn't -SNAPSHOT replace this file?

ind1go commented 2 years ago

Please could you post the entire log, redacting areas you wouldn't want us to see?

If you can post your project, or point us at a sample project with a similar structure, that would also be appreciated.

JAMOGRAD commented 2 years ago

Sure. Re-running now.

[INFO] Scanning for projects...
[INFO] 
[INFO] ---------< com.ibm.cics.cip.bank.springboot:customerservices >----------
[INFO] Building customerservices 1.1.0-SNAPSHOT
[INFO] --------------------------------[ war ]---------------------------------
[INFO] 
[INFO] --- maven-resources-plugin:3.2.0:resources (default-resources) @ customerservices ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Using 'UTF-8' encoding to copy filtered properties files.
[INFO] Copying 1 resource
[INFO] Copying 12 resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ customerservices ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-resources-plugin:3.2.0:testResources (default-testResources) @ customerservices ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Using 'UTF-8' encoding to copy filtered properties files.
[INFO] skip non existing resourceDirectory *redactedLocalDirectory*\src\test\resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.8.1:testCompile (default-testCompile) @ customerservices ---
[INFO] No sources to compile
[INFO] 
[INFO] --- maven-surefire-plugin:2.22.2:test (default-test) @ customerservices ---
[INFO] No tests to run.
[INFO] 
[INFO] --- maven-war-plugin:3.3.1:war (default-war) @ customerservices ---
[INFO] Packaging webapp
[INFO] Assembling webapp [customerservices] in [*redactedLocalDirectory*\target\customerservices-1.1.0-SNAPSHOT]
[INFO] Processing war project
[INFO] Building war: *redactedLocalDirectory*\target\customerservices-1.1.0-SNAPSHOT.war
[INFO] 
[INFO] --- spring-boot-maven-plugin:2.5.4:repackage (repackage) @ customerservices ---
[INFO] Replacing main artifact with repackaged archive
[INFO] 
[INFO] --- cics-bundle-maven-plugin:1.0.2:bundle-war (default) @ customerservices ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 27.804 s
[INFO] Finished at: 2022-03-28T11:22:51+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.ibm.cics:cics-bundle-maven-plugin:1.0.2:bundle-war (default) on project customerservices: Error writing bundle resource "customerservices-1.1.0-SNAPSHOT.warbundle": *redactedLocalDirectory*\target\customerservices-1.1.0-SNAPSHOT-cics-bundle\customerservices-1.1.0-SNAPSHOT.warbundle -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
ind1go commented 2 years ago

I can reproduce this, including without Spring, so that's not the confounding factor. Same issue exists at 1.0.3.

Not sure what, if anything, has changed. We'll get a fix out.

JAMOGRAD commented 2 years ago

Thanks Ben! I'm a novice at these things, and it sounded like it should have worked, hence I thought I'd better ask!

ind1go commented 2 years ago

This should be resolved in plugin version 1.0.4-SNAPSHOT. If you're able to test that out, it would be appreciated. We will roll it up into a proper release soon.

JAMOGRAD commented 2 years ago

I changed the pom to refer to the new plugin and it says "Could not find artifact com.ibm.cics:cics-bundle-maven-plugin:jar:1.0.4-SNAPSHOT". Do I need to do anything other than just updating the pom.xml to say

com.ibm.cics
            <artifactId>cics-bundle-maven-plugin</artifactId>
            <version>1.0.4-SNAPSHOT</version>

Also, should issues be closed without the raiser agreeing, or even being given a chance to comment? I had no idea this had happened, or that there was a fix waiting. It seems a bit disjointed.

ind1go commented 2 years ago

Follow the instructions for using snapshot versions here.

davenice commented 2 years ago

Also, should issues be closed without the raiser agreeing, or even being given a chance to comment? I had no idea this had happened, or that there was a fix waiting. It seems a bit disjointed.

I don't remember closing it manually - I am pretty sure it was part of the Github process automation. Hopefully you at least got the email from Ben saying that a fix was available in the SNAPSHOT! Maybe you got one saying the work item was closed, too...

I'll try and remember to comment when we merge items, if not.

JAMOGRAD commented 2 years ago

I've just tried the -SNAPSHOT 1.0.4 version with my local -SNAPSHOT version and it overwrites correctly. Good job!

ind1go commented 2 years ago

I've just tried the -SNAPSHOT 1.0.4 version with my local -SNAPSHOT version and it overwrites correctly. Good job!

Excellent, glad to hear it.

We don't have a fine granularity of issue states. And in an open source project, you can't rely on reporters verifying. We reproduced the issue, added tests to fail on the issue, and fixed the issue.

This should be resolved in plugin version 1.0.4-SNAPSHOT. If you're able to test that out, it would be appreciated. We will roll it up into a proper release soon.

This (and the notification of closure) was your notification that something had changed - if you didn't get notified, please check your notification settings, such as email!