Which means ** / *. java in java classpath

So, I saw this line in the .classpath file (eclipse file) today

<classpathentry kind="src" path="src/main/java" including="**/*.java"/>

I know that *.java means any java file, but what does **/ before it does it? Does this mean that every subfolder is included in src/main/java ?

+4
source share
3 answers

a single star () matches zero or more characters in the path name. a double star (**) matches zero or more characters in the directory levels. Another way to think about it is with a double star (**) slash (/) matches, but single star () does not.

So let's say I have these classes:

 1. src/test.java 2. test/src/test.java 

Well */*.java matches 1 only where as **/*.java matches as because ** matches any number of levels

+8
source

Does this mean that each subfolder is nested in src / main / java?

Yes. I think this is a fairly common model in glob-style expressions. See for example this SO question about its use in the bash shell.

+7
source

This means that each subfolder is under src/main/java and ends in .java

0
source

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


All Articles