Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what does **/*.java mean 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 *.java means any java file, but what does that **/ before it do? Does it mean to include every subfolder under src/main/java?

like image 661
r0dney Avatar asked Dec 06 '22 06:12

r0dney


2 Answers

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

like image 133
mistahenry Avatar answered Dec 22 '22 01:12

mistahenry


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.

like image 23
andersschuller Avatar answered Dec 22 '22 00:12

andersschuller