Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #19805

Re: problem creating WAR file with ant

Newsgroups comp.lang.java.programmer
Date 2012-11-18 20:18 -0800
References <k8b3pr$7k7$1@news.m-online.net> <50a9144e$0$293$14726298@news.sunsite.dk> <k8c8ic$vab$1@news.m-online.net>
Message-ID <916d09c7-5ca5-4f8e-b986-08afd365b738@googlegroups.com> (permalink)
Subject Re: problem creating WAR file with ant
From Lew <lewbloch@gmail.com>

Show all headers | View raw


Laura Schmidt wrote:
>>> Within the produced war file, the class files of L were in the root
>>> directory. I believe that the class files should be placed into the
>>> WEB-INF/classes directory of the war file.

Neither is correct.

The JAR of L should be in the lib/ subdirectory within the WAR.

RTFM.

>>> However, this problem cannot be new and there must be a standard way to
>>> do it. I would be glad if someone can tell me how to do it right.

There is, and the documentation tells you what it is.

>> The war task has a nested lib element.

As indeed, a WAR has a nested lib/ subdirectory. As per the docs.

>> There is an example at the bottom at:
>> http://ant.apache.org/manual/Tasks/war.html
>>
>> Use that!

> If I use that I''ll have to create a jar [sic] file for the library every time 
> I make changes to it.

Yeah, so? Why wouldn't you? You say that like it's an argument against 
doing things the right way.

> Instead of the lib element I used a symbolic link 
> in the WEB-INF/lib directory of the project pointing to the library's 
> jar file. This is the way I always did it.

It's the wrong way.

> But now I find it useful to avoid this step by directly including the
> library's class files, which are located under $L/classes. What about this?

Terrible idea, and the wrong way to do it.

> If including the class files directly, where in the war [sic]
 file do they belong?

They don't.

Libraries belong in JAR files.

RTFM.

Really. You're doing it all ass-backwards.

http://www.oracle.com/technetwork/java/javaee/documentation/tutorials-137605.html

-- 
Lew

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

problem creating WAR file with ant Laura Schmidt <ls@mailinator.com> - 2012-11-18 17:53 +0100
  Re: problem creating WAR file with ant Arne Vajhøj <arne@vajhoej.dk> - 2012-11-18 12:01 -0500
    Re: problem creating WAR file with ant Laura Schmidt <ls@mailinator.com> - 2012-11-19 04:21 +0100
      Re: problem creating WAR file with ant Lew <lewbloch@gmail.com> - 2012-11-18 20:18 -0800
      Re: problem creating WAR file with ant Arne Vajhøj <arne@vajhoej.dk> - 2012-11-19 09:41 -0500

csiph-web