What should I put in the target directory?

10,381

Yes! I would even go furthen than to say it's a good practice. I would say you have to generate those files inside the target folder.

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

So to put it simply: place your temporary content under target/{name-of-your-plugin}; this makes it clear that this subfolder is your temporary folder and it doesn't create unnecessary temp folders.

For the side-note, I don't know why the grunt-maven-plugin has a special target-grunt temporary directory but I'll note that from the GitHub home page, the plugin is discontinued and this was configurable through the gruntBuildDirectory attribute.

Share:
10,381
sab
Author by

sab

Java dev

Updated on July 19, 2022

Comments

  • sab
    sab almost 2 years

    I'm making a Maven plugin. I use another library that downloads files and put them in a directory if they don't exist, of if they are too old, then my code use the files.

    I don't want this file by commit by mistake by the devs using my plugin.

    Is that a good practice to put this "temporary" files in the target directory?

    Some other plugin create their own "target-custom" to do it (for example grunt-maven-plugin create a target-grunt directory).