0

When I build my Spring Boot application using ./mvnw install, it creates a folder named "target" that contains the output of the build.

I would prefer for that folder to be hidden on Linux (for example using the name ".target").

Is there a way to specify an alternate name for the Maven "target" folder?

10
  • 1
    Why ? What is the advantage? Stay with the convention it's easier. Why should that folder being hidden? It's folder has been created and it should be visible..it should be on the ignore list for version control (for example .gitignore or with svn:ignore property ).. Commented Apr 11, 2020 at 12:20
  • @khmarbaise, The .git folder is hidden. .gitignore is hidden. .gitignore lists several settings files/folders which are hidden. What makes target so special that it gets to clutter my project tree when I want to see only the files that I've created. .gitignore doesn't help with this if I'm running ls or tree. Commented Apr 11, 2020 at 14:43
  • ...Changing bad conventions is progress. Commented Apr 11, 2020 at 14:46
  • 1
    The .git folder is something differerent. Commented Apr 11, 2020 at 15:33
  • 1
    Which Linux convention? The target directory is a directory which contains relevant information for the user which means the built artifacts etc. so it does not make sense to put them into a hidden directory which exactly is the difference between the .git directory which is only managed and never being touched by user directly whereas the target could and needed.... Commented Apr 12, 2020 at 11:57

1 Answer 1

1

The target folder is very important, ¿why you want to rename it? If isn't really necessary, in think that you shouldn't rename it.

I found 2 related posts (this and this). If it helpt to you, only add to your pom:

<build>
<directory>/yourDirectory/.target</directory>
</build>

You can put it into a profile too. Hope it has been helpful.

Sign up to request clarification or add additional context in comments.

2 Comments

"the intent is simply to not "clutter" the display of the contents of a directory listing with files the user did not directly create." -- Hidden file and hidden directory
@nobar Nevertheless, renaming standard Maven folders is usually considered bad practise.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.