My project has the following package structure:

```
src/
  com.my.app.school.course
    -Course.java
    ...

  com.my.app.school.course.free
    -CourseFree.java  

```

I use Maven to build the project, in my pom.xml, I defined [maven-compiler-plugin](http://maven.apache.org/plugins/maven-compiler-plugin/) to test excluding a package with all its java classes.

I first tried following way to **exclude** package `com.my.app.school.course.free`:

```
<build>
   <plugins>
       <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>2.3.2</version>
            <configuration>
                <excludes>
                    <exclude>**/com/my/app/school/course/free/*</exclude>
                </excludes>
             </configuration>
        </plugin>
    </plugins>
</build>

```

**It works!** I mean after run `mvn clean install`, the final build under target/classes/ doesn't have the package `com/my/app/school/course/free` . 

Then, I tried to exclude package `com.my.app.school.course` . I simply **replace** the above `<exclude>` tag with value `<exclude>**/com/my/app/school/course/*</exclude>`. I thought it should work too , but it doesnt! Under target/classes/ I see all packages, no package is excluded. Why?

What I want to achieve is to exclude package `com.my.app.school.course` but keep pacakge `com.my.app.school.course.free` , how to achieve this?

**======== update ========**

I feel it might be because the package I tried to exclude contain java classes that have been used in other packages. I will verify my guess.