Grails

Ant jars are missing from packaged WARs

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Won't Fix
  • Affects Version/s: 1.2 final
  • Fix Version/s: 1.2.1
  • Component/s: None
  • Labels:
    None
  • Testcase included:
    yes

Description

You cannot use AntBuilder inside a Grails 1.2 application and deploy it as a war without finding a way to force the packaging of Ant.

In prior releases this worked fine. This can be reproduced simply by running run-war.

Attached is a test app for grails 1.2 (AntWarProblem). Run and browse to http://localhost:8080/AntWarProblem - BOOM
There's also a Grails 1.1.1 version (AntWarProblem11). Run and browse to http://localhost:8080/AntWarProblem11 - fine

I think this needs to be fixed as it seems the workaround might involve using dependencies in the app to specify an Ant version - but that is crappy as it will break between grails builds if they change the ant version won't it?

Proof that the WAR does not contain the jars:

Grails 1.1.1:

marcmacbook:AntWarProblem11 marc$ jar tvf AntWarProblem11-0.1.war | grep ant.*jar
1289806 Thu Jan 07 09:34:10 GMT 2010 WEB-INF/lib/ant-1.7.0.jar
11734 Thu Jan 07 09:34:10 GMT 2010 WEB-INF/lib/ant-launcher-1.7.0.jar
443432 Thu Jan 07 09:34:10 GMT 2010 WEB-INF/lib/antlr-2.7.6.jar

Grails 1.2:
marcmacbook:AntWarProblem marc$ jar tvf target/AntWarProblem-0.1.war | grep ant.*jar
443432 Thu Jan 07 09:35:30 GMT 2010 WEB-INF/lib/antlr-2.7.6.jar

[having trouble attaching issues, JIRA is zombieing. will try to attach them separately]

Issue Links

Activity

Hide
Marc Palmer added a comment -

There is a workaround, in the plugin you have to add the dep in BuildConfig:

grails.project.dependency.resolution = {
inherits "global" // inherit Grails default dependencies

dependencies { runtime 'org.apache.ant:ant:1.7.1' }
}

Show
Marc Palmer added a comment - There is a workaround, in the plugin you have to add the dep in BuildConfig: grails.project.dependency.resolution = { inherits "global" // inherit Grails default dependencies dependencies { runtime 'org.apache.ant:ant:1.7.1' } }
Hide
Marc Palmer added a comment -

Also needs ant-launcher dep to run Weceem at least.

Show
Marc Palmer added a comment - Also needs ant-launcher dep to run Weceem at least.
Hide
Graeme Rocher added a comment -

not sure this can be regarded as a bug, most applications don't need Ant it is a side effect of Grails not having dependency resolution that it worked in 1.1

Additionally plugins can define dependencies so Weceem can define ant as a dependency for 1.2

Show
Graeme Rocher added a comment - not sure this can be regarded as a bug, most applications don't need Ant it is a side effect of Grails not having dependency resolution that it worked in 1.1 Additionally plugins can define dependencies so Weceem can define ant as a dependency for 1.2
Hide
Graeme Rocher added a comment -

i'm closing this one because its questionable whether ant should have been in the default dependency list in the first place. Plugins like weceem can add it as a dependency if needed.

Show
Graeme Rocher added a comment - i'm closing this one because its questionable whether ant should have been in the default dependency list in the first place. Plugins like weceem can add it as a dependency if needed.
Hide
Marc Palmer added a comment -

Are you sure about this?

AntBuilder is part of core groovy isn't it? If it is (I may be wrong), then all stuff that is in core groovy should be available out of the box?

If AntBuilder is an optional part of Groovy then so be it.

Show
Marc Palmer added a comment - Are you sure about this? AntBuilder is part of core groovy isn't it? If it is (I may be wrong), then all stuff that is in core groovy should be available out of the box? If AntBuilder is an optional part of Groovy then so be it.
Hide
Graeme Rocher added a comment -

Ant is an optional dependency of Groovy. I would say its pretty atypical for web applications to be shipping Ant (a built tool) inside their WAR files

Show
Graeme Rocher added a comment - Ant is an optional dependency of Groovy. I would say its pretty atypical for web applications to be shipping Ant (a built tool) inside their WAR files
Hide
Jean-Noël Rivasseau added a comment -

Was hit by the same problem today. While I do agree that ant.jar should not be shipped by default, a release note item would have be nice to warn about this.

Ant is not only a build tool; I for example use the mail builder to send simple mails, so I needed it at runtime.

Show
Jean-Noël Rivasseau added a comment - Was hit by the same problem today. While I do agree that ant.jar should not be shipped by default, a release note item would have be nice to warn about this. Ant is not only a build tool; I for example use the mail builder to send simple mails, so I needed it at runtime.
Hide
Tomas Dolezal added a comment -

Yes, I was the same victim. This is a tricky situation ... sending mails this way always worked, it also continues working on localhost and when you deploy the application (upgraded to grails 1.2) to production, you start getting complains from the users the next day ...

Show
Tomas Dolezal added a comment - Yes, I was the same victim. This is a tricky situation ... sending mails this way always worked, it also continues working on localhost and when you deploy the application (upgraded to grails 1.2) to production, you start getting complains from the users the next day ...
Hide
Helmut Denk added a comment -

why is ant-dependency added automagically when i
start via 'grails run-app' ?

IMO grails behavior regarding this dependency is
inconsistent.

this leads grails-users to wrong assumptions ...

Show
Helmut Denk added a comment - why is ant-dependency added automagically when i start via 'grails run-app' ? IMO grails behavior regarding this dependency is inconsistent. this leads grails-users to wrong assumptions ...
Hide
Jean-Noël Rivasseau added a comment -

ant-dependency is added because grails run-app (and the whole script / build system) relies on Gant and therefore on Ant. This makes sense.

I think it is wise to exclude Ant by default in the generated WAR - my only complaint as I stated is that such changes can break production systems and should be documented in release notes.

Show
Jean-Noël Rivasseau added a comment - ant-dependency is added because grails run-app (and the whole script / build system) relies on Gant and therefore on Ant. This makes sense. I think it is wise to exclude Ant by default in the generated WAR - my only complaint as I stated is that such changes can break production systems and should be documented in release notes.
Hide
Helmut Denk added a comment -

hi jean-noel,

thanks for that info.

>>ant-dependency is added because grails run-app (and the whole script / build system) relies on >>Gant and therefore on Ant.

this is the description of a sideeffect. the frameworks (build-system-)
classpath leaks into grails-apps classpath.

grails-apps should have a classloading that is consistent,
regardless which way the app was started. this may be difficult
to achieve ... but should be the goal.

Show
Helmut Denk added a comment - hi jean-noel, thanks for that info. >>ant-dependency is added because grails run-app (and the whole script / build system) relies on >>Gant and therefore on Ant. this is the description of a sideeffect. the frameworks (build-system-) classpath leaks into grails-apps classpath. grails-apps should have a classloading that is consistent, regardless which way the app was started. this may be difficult to achieve ... but should be the goal.

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: