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,968
  • 3
  • 34
  • 47
r0dney
  • 735
  • 2
  • 5
  • 16

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,554
  • 3
  • 27
  • 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
  • 13,509
  • 2
  • 42
  • 33
0

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

Leigh
  • 28,765
  • 10
  • 55
  • 103
Ruchira Gayan Ranaweera
  • 34,993
  • 17
  • 75
  • 115