What should I put in the target directory?

I am making a Maven plugin. I use another library that downloads files and puts them in a directory, if they do not exist, if they are too old, then my code uses the files.

I do not want this file to be mistakenly done by developers using my plugin.

Is it good practice to put these “temporary” files in the target directory?

Some other plugins create their own "target-custom" to do this (for example, grunt-maven-plugin create the target-grunt directory).

+5
source share
1 answer

Yes! I would even go further than saying that this is good practice. I would say that you should generate these files inside the target folder.

target is the Maven build directory, which means that all generated content should be placed under this folder. As you said in your question, this folder is usually ignored by your VCS ( svn ignore or .gitignore ), since it is a temporary directory that can be deleted at any time.

So simple: place your temporary content under target/{name-of-your-plugin} ; this makes it clear that this subfolder is your temporary folder and does not create unnecessary temporary folders.

For a side note, I don’t know why grunt-maven-plugin has a special temporary target-grunt directory, but I want to notice that from the GitHub Home page , the plugin is terminated, and this can be configured using the gruntBuildDirectory attribute.

+4
source

Source: https://habr.com/ru/post/1245896/


All Articles