Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

"Exclude" does not seem to be working when building WAR

 
Stephen McConnell
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am building a war and have a library under the "WEB-INF/lib" directory. While compiling, I have the "javax.servlet.jar" in that lib, but when I build the war file, I want to exclude it from the "lib" folder.

Under the "war" task here's what I do...



It builds the war, but does not exclude "javax.servlet.jar" like the "docs" said.

Que Passo, here?

Stephen McConnell
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is ${temp.dir.lib} a subdirectory under ${temp.dir}? If so, I think that the servlet jar is being included based on the basedir specified in the <war> task. I would recommend placing ${temp.dir.lib} in a different physical location. (Actually, I really recommend using the Maven project structure, but that is a different topic...)

One more thought - run with the -v option, that might give more clues as to how the jars are being included/excluded.
 
Stephen McConnell
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
(Actually, I really recommend using the Maven project structure, but that is a different topic...).


I wish they would.... but they don't use maven here.

Steve
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Stephen McConnell wrote:I wish they would.... but they don't use maven here.

That's not a requirement for using the Maven directory structure.

That aside, I wouldn't have that library in WEB-INF/lib at all, but instead keep it as an external dependency.
 
Stephen McConnell
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
[quote=David Newton
That aside, I wouldn't have that library in WEB-INF/lib at all, but instead keep it as an external dependency.

I probably will do just that.

It is still troubling that I have found several posts under other forums that discuss "exclude" not doing what it said it is supposed to do and none explain why it does not work like several examples in the documentation.

Stephen McConnell
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Isn't the element "excludes", not "exclude"?
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Good question, David. In the docs the table showing the options uses excludes while all the examples use exclude.
http://ant.apache.org/manual/CoreTypes/fileset.html
('lib' is a type of 'fileset')
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hmm, that's weird.
 
Stephen McConnell
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Lib" doesn't support the excludes option (Straight from the Ant build).
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic