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

Use project.build.finalName to derive artifact name #227

Merged
merged 1 commit into from
Jan 30, 2024

Conversation

stewartfrancis
Copy link
Contributor

Fixes #224

Note that the bundle is now created without a version, as verified by test-bundle-war-final-name. Internally within the bundle zip, the resulting war file will still have a version.

Note that if you're using the deploy goal with the bundle deploy API, the resulting bundle directory will still have the version number in, as it's derived from the version in the manifest within the bundle file, not the bundle file name.

This is still useful for scenarios where you're deploying the resulting bundle file yourself though

MavenProjectHelper projectHelper) throws MojoExecutionException {
try {
bundlePublisher.publishDynamicResources();

ZipArchiver zipArchiver = new ZipArchiver();
zipArchiver.addDirectory(workDir);
File cicsBundle = new File(outputDir, project.getArtifactId() + "-" + project.getVersion() + (classifier != null ? "-" + classifier : "") + "." + CICS_BUNDLE_EXTENSION);

File cicsBundle = new File(outputDir, finalName + (classifier != null ? "-" + classifier : "") + "." + CICS_BUNDLE_EXTENSION);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't quite see how finalName defaults to

project.getArtifactId() + "-" + project.getVersion()

What have I missed?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps I've misunderstood - I was expecting you could use that param to override the name, or just leave it out if you want the old behaviour. But it looks like it's a required param now.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's built-in. Search for finalName in here: https://maven.apache.org/pom.html

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addresses this issue raised here: #224

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It defaults to include the version, but some people may override it to try and remove adding the version to the final artifact's name. This is just adding support for that.

Signed-off-by: Stewart Francis <stewartfrancis@uk.ibm.com>

Update pom.xml

Update TestEndpoint.java

Update PostBuildTestBundleWarFinalName.java
@davenice
Copy link
Contributor

OK - @ind1go showed me that final name is a pre-existing maven feature which we're just overriding in this case, so the behaviour is remaining equivalent!

@ind1go ind1go merged commit ded8103 into IBM:main Jan 30, 2024
7 checks passed
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

Successfully merging this pull request may close these issues.

WAR Bundle can't not have a version
3 participants