Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
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]
Attachments
-
$i18n.getText("admin.common.words.hide")
- AntWarProblem.zip
- 07/Jan/10 8:37 AM
- 183 kB
- Marc Palmer
-
- AntWarProblem/.classpath 0.7 kB
- AntWarProblem/.DS_Store 6 kB
- __MACOSX/AntWarProblem/._.DS_Store 0.1 kB
- AntWarProblem/.project 0.5 kB
- AntWarProblem/.../org.codehaus.groovy.eclipse.preferences.prefs 0.1 kB
- AntWarProblem/application.properties 0.2 kB
- AntWarProblem/.../BootStrap.groovy 0.1 kB
- AntWarProblem/.../BuildConfig.groovy 1 kB
- AntWarProblem/grails-app/.../Config.groovy 3 kB
- AntWarProblem/.../DataSource.groovy 0.6 kB
- AntWarProblem/.../resources.groovy 0.0 kB
- AntWarProblem/.../UrlMappings.groovy 0.2 kB
- AntWarProblem/.../TestController.groovy 0.1 kB
- __MACOSX/.../._TestController.groovy 0.2 kB
- AntWarProblem/.../messages.properties 3 kB
- AntWarProblem/.../messages_da.properties 3 kB
- AntWarProblem/.../messages_de.properties 4 kB
- AntWarProblem/.../messages_es.properties 3 kB
- AntWarProblem/.../messages_fr.properties 2 kB
- AntWarProblem/.../messages_it.properties 2 kB
- AntWarProblem/.../messages_ja.properties 2 kB
- AntWarProblem/.../messages_nl.properties 3 kB
- AntWarProblem/.../messages_pt_BR.properties 3 kB
- AntWarProblem/.../messages_pt_PT.properties 3 kB
- AntWarProblem/.../messages_ru.properties 4 kB
- AntWarProblem/.../messages_th.properties 5 kB
- AntWarProblem/.../messages_zh_CN.properties 2 kB
- AntWarProblem/grails-app/views/error.gsp 2 kB
- AntWarProblem/grails-app/views/index.gsp 3 kB
- AntWarProblem/grails-app/.../main.gsp 0.7 kB
-
$i18n.getText("admin.common.words.hide")
- AntWarProblem11.zip
- 07/Jan/10 8:37 AM
- 146 kB
- Marc Palmer
-
- AntWarProblem11/.classpath 6 kB
- AntWarProblem11/.DS_Store 6 kB
- __MACOSX/AntWarProblem11/._.DS_Store 0.1 kB
- AntWarProblem11/.project 0.5 kB
- AntWarProblem11/.../org.codehaus.groovy.eclipse.preferences.prefs 0.1 kB
- AntWarProblem11/AntWarProblem11-test.launch 0.8 kB
- AntWarProblem11/AntWarProblem11.launch 2 kB
- AntWarProblem11/AntWarProblem11.tmproj 2 kB
- AntWarProblem11/application.properties 0.1 kB
- AntWarProblem11/build.xml 5 kB
- AntWarProblem11/.../BootStrap.groovy 0.1 kB
- AntWarProblem11/grails-app/.../Config.groovy 3 kB
- AntWarProblem11/.../DataSource.groovy 0.6 kB
- AntWarProblem11/.../resources.groovy 0.0 kB
- AntWarProblem11/.../UrlMappings.groovy 0.2 kB
- AntWarProblem11/.../TestController.groovy 0.1 kB
- __MACOSX/.../._TestController.groovy 0.2 kB
- AntWarProblem11/.../messages.properties 3 kB
- AntWarProblem11/.../messages_de.properties 3 kB
- AntWarProblem11/.../messages_es.properties 3 kB
- AntWarProblem11/.../messages_fr.properties 2 kB
- AntWarProblem11/.../messages_it.properties 2 kB
- AntWarProblem11/.../messages_ja.properties 2 kB
- AntWarProblem11/.../messages_nl.properties 3 kB
- AntWarProblem11/.../messages_pt_BR.properties 3 kB
- AntWarProblem11/.../messages_ru.properties 4 kB
- AntWarProblem11/.../messages_th.properties 5 kB
- AntWarProblem11/.../messages_zh_CN.properties 2 kB
- AntWarProblem11/grails-app/.../error.gsp 2 kB
- AntWarProblem11/grails-app/.../index.gsp 0.9 kB
Issue Links
| This issue is related to: | ||||
| GRAILS-5679 | The run-war script is not setting up classpath properly. Even with Ant added to runtime dependencies, errors occur using AntBuilder |
|
|
|
Activity
- All
- Comments
- Work Log
- History
- Activity
- Git Commits
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
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.
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.
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
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.
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 ...
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 ...
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.
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.
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' }
}