4

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

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

I know *.java means any java file, but what does that **/ before it do? Does it mean to include every subfolder under src/main/java?

CPerkins
  • 8,839
  • 3
  • 32
  • 47
r0dney
  • 725
  • 2
  • 5
  • 15

3 Answers3

8

a single star () matches zero or more characters within a path name. a double star (**) matches zero or more characters across directory levels. Another way to think about it is double star (**) matches slash (/) 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 both because ** matches any number of levels

mistahenry
  • 8,334
  • 3
  • 26
  • 38
7

Does it mean to include every subfolder under src/main/java?

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

Community
  • 1
  • 1
andersschuller
  • 12,821
  • 2
  • 39
  • 33
0

It means every sub folder under src/main/java and ending with .java

Leigh
  • 28,605
  • 10
  • 52
  • 98
Ruchira Gayan Ranaweera
  • 33,712
  • 16
  • 72
  • 110