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

Maven plugin overwriteExistingFiles should default to true when outputDirectory is default #161

Open
Marcono1234 opened this issue Feb 16, 2022 · 0 comments

Comments

@Marcono1234
Copy link
Contributor

Marcono1234 commented Feb 16, 2022

Hello,
currently for your Maven plugin the overwriteExistingFiles default value is always false, even when the default outputDirectory is used. This is rather inconvenient because due to this you cannot build a project two times without performing mvn clean in between (or as part of the second build); otherwise your plugin fails with:

Execution add-module-info of goal org.moditect:moditect-maven-plugin:1.0.0.RC2:add-module-info failed:
File .../some-project.jar already exists; either set 'overwriteExistingFiles' to true or specify another output directory

To reproduce:

  1. Clone https://github.com/google/gson at tag gson-parent-2.9.0
  2. cd gson
  3. mvn package
  4. mvn package
    ❌ It fails

If outputDirectory points to the default directory, that is inside target/, then I think it would be reasonable to overwrite the JAR (and maybe other files) by default, similar to how the Maven JAR Plugin overwrites the existing JAR it generated. What do you think? It could be the case though that I forgot to consider a corner case where that is not desired.

It looks like this affects https://github.com/moditect/moditect-gradle-plugin in a similar way.

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

No branches or pull requests

1 participant