dev@glassfish.java.net

Re: how to exclude java source files from compilation

From: Kin-man Chung <Kin-Man.Chung_at_Sun.COM>
Date: Thu, 14 Aug 2008 15:09:11 -0700

OK, I know what's wrong!

The compilation is handled by hk2-maven-plugin not maven-compiler-plugin
so you'll need to place excludes tags in that instead:

misto% svn diff pom.xml

Index: pom.xml
===================================================================
--- pom.xml (revision 21795)
+++ pom.xml (working copy)
@@ -120,17 +120,15 @@
                          <!-- Use the manifest.mf produced by
maven-bundle-plugin:manifest -->
 
<manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
                      </archive>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <configuration>
                  <source>1.5</source>
                  <target>1.5</target>
+ <excludes>
+
<exclude>com/sun/appserv/management/monitor/*.java</exclude>
+
<exclude>com/sun/appserv/management/monitor/statistics/*.java</exclude>
+ </excludes>
                  <compilerArgument>-Xlint:all</compilerArgument>
- </configuration>
- </plugin>
+ </configuration>
+ </plugin>
            </plugins>

          <resources>
@@ -152,12 +150,13 @@
              <version>${hk2.version}</version>
          </dependency>

+<!--
          <dependency>
              <groupId>org.glassfish</groupId>
              <artifactId>javax.management.j2ee</artifactId>
              <version>${project.version}</version>
          </dependency>
-
+-->
          <dependency>
              <groupId>org.glassfish.common</groupId>
              <artifactId>amx-api</artifactId>

Lloyd Chambers wrote:
> No, that doesn't work.
>
> Comment out the dependency on 'javax.management.j2ee' in
> common/amx-api/pom.xml and you will see compile failures on all the Java
> classes in the excluded folders.
>
> EG:
> /v3/code/common/amx-api/src/main/java/com/sun/appserv/management/j2ee/statistics/BoundedRangeStatisticImpl.java:47:
> package javax.management.j2ee.statistics does not exist
> import javax.management.j2ee.statistics.BoundedRangeStatistic;
>
>
> Lloyd
>
> On Aug 14, 2008, at 12:29 PM, Kin-man Chung wrote:
>
>> The following works for me.
>>
>> <build>
>> <plugins>
>> <plugin>
>> <groupId>org.apache.maven.plugins</groupId>
>> <artifactId>maven-compiler-plugin</artifactId>
>> <configuration>
>> <excludes>
>> <exclude>com/sun/appserv/management/monitor/*.java</exclude>
>> <exclude>com/sun/appserv/management/monitor/statistics/*.java</exclude>
>> </excludes>
>> <compilerArgument>-Xlint:all</compilerArgument>
>> </configuration>
>> </plugin>
>> ...
>> </plugins>
>> </build>
>>
>> Lloyd Chambers wrote:
>>> This (below) doesn't work either.
>>> Maybe our build doesn't respect use maven-compiler-plugin directly?
>>> <build>
>>> <plugins>
>>> <plugin>
>>> <groupId>org.apache.maven.plugins</groupId>
>>> <artifactId>maven-compiler-plugin</artifactId>
>>> <configuration>
>>> <excludes>
>>>
>>> <exclude>src/main/java/com/sun/appserv/management/monitor/*.java</exclude>
>>>
>>>
>>> <exclude>src/main/java/com/sun/appserv/management/monitor/statistics/*.java</exclude>
>>> </excludes>
>>> <compilerArgument>-Xlint:all</compilerArgument>
>>> </configuration>
>>> </plugin>
>>> ...
>>> </plugins>
>>> </build>
>>> On Aug 14, 2008, at 11:46 AM, Lloyd Chambers wrote:
>>>> Shalini,
>>>>
>>>> Thanks, that doesn't work either (I tried with more than one
>>>> <excludes> line too. Next I'll try Nandini's suggestion.
>>>>
>>>> Lloyd
>>>>
>>>> On Aug 12, 2008, at 11:13 PM, Shalini Muthukrishnan wrote:
>>>>
>>>>> Could you try
>>>>> <excludes>src/main/java/com/sun/appserv/management/monitor/*.java,src/main/java/com/sun/appserv/management/monitor/statistics/*.java</excludes>
>>>>>
>>>>>
>>>>> HTH
>>>>> Shalini.
>>>>>
>>>>> Lloyd Chambers wrote:
>>>>>> I tried this and also changing "exclude" to "excludes". No luck.
>>>>>>
>>>>>> <plugin>
>>>>>> <groupId>org.apache.maven.plugins</groupId>
>>>>>> <artifactId>maven-compiler-plugin</artifactId>
>>>>>> <configuration>
>>>>>> <exclude>src/main/java/com/sun/appserv/management/monitor/*.java</exclude>
>>>>>>
>>>>>>
>>>>>> <exclude>src/main/java/com/sun/appserv/management/monitor/statistics/*.java</exclude>
>>>>>>
>>>>>> <compilerArgument>-Xlint:all</compilerArgument>
>>>>>> </configuration>
>>>>>> </plugin>
>>>>>>
>>>>>>
>>>>>> ..............................................
>>>>>> Lloyd Chambers
>>>>>> lloyd.chambers_at_sun.com
>>>>>> GlassFish team, admin
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> On Aug 12, 2008, at 5:45 PM, Kin-man Chung wrote:
>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Lloyd Chambers wrote:
>>>>>>>> I want to exclude source files from compilation.
>>>>>>>> I've googled, read the maven docs include stuff at sonatype, and
>>>>>>>> darn it, I can't get the right syntax.
>>>>>>>> <build>
>>>>>>>> <plugins>
>>>>>>>> <plugin>
>>>>>>>> <groupId>org.apache.maven.plugins</groupId>
>>>>>>>> <artifactId>maven-compiler-plugin</artifactId>
>>>>>>>> <configuration>
>>>>>>>> <excludes>
>>>>>>>> <exclude>src/main/java/com/sun/appserv/management/monitor/*.java</exclude>
>>>>>>>>
>>>>>>>> <exclude>src/main/java/com/sun/appserv/management/monitor/statistics/*.java</exclude>
>>>>>>>>
>>>>>>>
>>>>>>> try
>>>>>>>
>>>>>>> <exclude>com/sun/appserv/management/monitor/*.java</exclude>
>>>>>>> <exclude>com/sun/appserv/management/monitor/statistics/*.java</exclude>
>>>>>>>
>>>>>>>
>>>>>>> -Kin-man
>>>>>>>
>>>>>>>> </excludes>
>>>>>>>> <compilerArgument>-Xlint:all</compilerArgument>
>>>>>>>> </configuration>
>>>>>>>> </plugin>
>>>>>>>> ...
>>>>>>>> </plugins>
>>>>>>>> </build>
>>>>>>>> ..............................................
>>>>>>>> Lloyd Chambers
>>>>>>>> lloyd.chambers_at_sun.com <mailto:lloyd.chambers_at_sun.com>
>>>>>>>> GlassFish team, admin
>>>>>>>
>>>>>>> ---------------------------------------------------------------------
>>>>>>>
>>>>>>> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
>>>>>>> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>>>>>>>
>>>>>>
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
>>>>>> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
>>>>> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>>>>>
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
>>>> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
>>> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
>> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>