maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alex Coles" <alex.co...@gmail.com>
Subject Re: Excluding certain file types using the maven-war-plugin
Date Mon, 13 Oct 2008 21:39:54 GMT
On Mon, Oct 13, 2008 at 7:57 AM, Wayne Fay <waynefay@gmail.com> wrote:
> You can see the line causing the NPE here:
> http://maven.apache.org/plugins/maven-war-plugin/xref/org/apache/maven/plugin/war/packaging/WarProjectPackagingTask.html
>
> I'd grab the source, add some debugging/tracing log entries, trace
> down (and fix) the issue, and contribute it back via JIRA. Or open an
> issue in JIRA, attach a sample project which demonstrates the bug, and
> wait for someone else to fix it for you.
>
> Wayne
>
> On Sun, Oct 12, 2008 at 9:18 PM, Alex Coles <alex.coles@gmail.com> wrote:
>> On Mon, Oct 13, 2008 at 6:05 AM, Wayne Fay <waynefay@gmail.com> wrote:
>>> You are specifying version 2.0.2.
>>>
>>> The website docs appear to be for 2.1-alpha-2 (note the Last Published
>>> etc near the top left corner). I would try that version instead, with
>>> this configuration, perhaps the NPE will go away.
>>>
>>> Wayne
>>>
>>> On Sun, Oct 12, 2008 at 7:07 PM, Alex Coles <alex.coles@gmail.com> wrote:
>>>> I am encountering problems trying to exclude certain file types from
>>>> my WAR files. My WAR files are bloated, and becoming difficult to very
>>>> cumbersome to deploy to production servers.
>>>>
>>>> Here's the two main types of files that should not be included in my WARs:
>>>>  * Versioning Control Files (.git, .gitignore, .svn; I am using git's
>>>> submodules feature with one particular directory, but certainly do not
>>>> want to deploy a whole .git repository with my WAR)
>>>>  * Photoshop PSD files, of which most are contained within a
>>>> assets/src-images folder.
>>>>
>>>> This issue is somewhat similar to the issue raised here, over 2 years ago:
>>>> http://www.mail-archive.com/users@maven.apache.org/msg41790.html
>>>> http://markmail.org/message/qeoprewtxngxlaom
>>>>
>>>> I have tried two configurations:
>>>>
>>>> [1]
>>>>
>>>>            <plugin>
>>>>                <artifactId>maven-war-plugin</artifactId>
>>>>                <version>2.0.2</version>
>>>>                <configuration>
>>>>
>>>> <dependentWarExcludes>**/jdbc.properties,**/hibernate.cfg.xml,**/sql-map-config.xml,**/web.xml,WEB-INF/classes/META-INF/**</dependentWarExcludes>
>>>>
>>>>                            <excludes>
>>>>                                <exclude>**/.git</exclude>
>>>>                                <exclude>**/.gitignore</exclude>
>>>>                                <exclude>**/*.psd</exclude>
>>>>                                <exclude>assets/src-images/**</exclude>
>>>>                            </excludes>
>>>>                </configuration>
>>>>            </plugin>
>>>>
>>>>
>>>> [2]
>>>>
>>>>            <plugin>
>>>>                <artifactId>maven-war-plugin</artifactId>
>>>>                <version>2.0.2</version>
>>>>                <configuration>
>>>>
>>>> <dependentWarExcludes>**/jdbc.properties,**/hibernate.cfg.xml,**/sql-map-config.xml,**/web.xml,WEB-INF/classes/META-INF/**</dependentWarExcludes>
>>>>
>>>>                    <webResources>
>>>>
>>>>                        <resource>
>>>>                            <!--<directory>resource2</directory>-->
>>>>                            <excludes>
>>>>                                <exclude>**/.git</exclude>
>>>>                                <exclude>**/.gitignore</exclude>
>>>>                                <exclude>**/*.psd</exclude>
>>>>                                <exclude>assets/src-images/**</exclude>
>>>>                            </excludes>
>>>>                       </resource>
>>>>                    </webResources>
>>>>                </configuration>
>>>>            </plugin>
>>>>
>>>> [1] doesn't seem to be working. the excludes are simply ignored.
>>>> [2] throws a NullPointerException if the directory element is omitted.
>>>> This appears to contradict the fourth example in the documentation
>>>> (under Includes/Excludes here:
>>>> http://maven.apache.org/plugins/maven-war-plugin/examples/adding-filtering-webresources.html)
>>>> which shows the directory element may be omitted.
>>>>
>>>> Thanks for any advice you can give.
>>>>
>>>> Alex Coles
>>>>
>>
>> Thanks, Wayne. I tried upgrading to 2.1-alpha-2, per your suggestion.
>> Unfortunately, no change.
>>
>> Going with configuration
>> [1] still isn't working.
>> [2] still throws a NullPointerException. The stack trace for which
>> I've posted here: http://pastie.org/private/l8nmhtepm74dm7idpuszlg
>>
>> In addition, with 2.1-alpha-2, I am getting the following warning:
>> [WARNING] DEPRECATED [dependentWarExcludes]: use the excludes in the
>> overlay object instead
>>
>> Alex

Thanks for your suggestion. I can create a JIRA ticket (or even
attempt to create a patch for the NPE -- the code looks reasonably
straightforward).

However, there still is the discrepancy with the documentation.

Which syntax should I be using to exclude various file patterns from
the resultant WAR?


[1]

           <plugin>
               <artifactId>maven-war-plugin</artifactId>
               <version>2.0.2</version>
               <configuration>

<dependentWarExcludes>**/jdbc.properties,**/hibernate.cfg.xml,**/sql-map-config.xml,**/web.xml,WEB-INF/classes/META-INF/**</dependentWarExcludes>

                           <excludes>
                               <exclude>**/.git</exclude>
                               <exclude>**/.gitignore</exclude>
                               <exclude>**/*.psd</exclude>
                               <exclude>assets/src-images/**</exclude>
                           </excludes>
               </configuration>
           </plugin>


[2]

           <plugin>
               <artifactId>maven-war-plugin</artifactId>
               <version>2.0.2</version>
               <configuration>

<dependentWarExcludes>**/jdbc.properties,**/hibernate.cfg.xml,**/sql-map-config.xml,**/web.xml,WEB-INF/classes/META-INF/**</dependentWarExcludes>

                   <webResources>

                       <resource>
                           <!--<directory>resource2</directory>-->
                           <excludes>
                               <exclude>**/.git</exclude>
                               <exclude>**/.gitignore</exclude>
                               <exclude>**/*.psd</exclude>
                               <exclude>assets/src-images/**</exclude>
                           </excludes>
                      </resource>
                   </webResources>
               </configuration>
           </plugin>

Cheers

Alex

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Mime
View raw message