Dúvida sobre "Grails: lutando contra o cache do navegador.."
16/02/2011 00:00
0
Link do post: <!-- m --><a class="postlink" href="http://www.itexto.net/devkico/?p=763">http://www.itexto.net/devkico/?p=763</a><!-- m -->

Pessoal, atendendo ao pedido do Henrique, resolvi criar um tópico no fórum para que todos possam participar e consultar caso tenham o mesmo problema.

Estou tendo problemas com o versionamento do grails. Consegui por para só mudar a versão quando gerar war para produção. Mas ele gera com versão antiga. Se no meu application.properties estiver versão 1.1 e eu gerar war, a versão vai mudar para 1.2 mas o war será gerado com versão 1.1. Não sei pq isto acontece.


//_Events.groovy
eventWarStart = { warName ->
if (grails.util.Environment.current == grails.util.Environment.PRODUCTION) {
println &quot;----------------------------------&quot;
println &quot;Incrementando o numero da versao&quot;
def versao = metadata.'app.version'

def data = new Date()

if (!versao)
versao = 0
else {
//versao = Float.valueOf(versao) + 0.1
versao = data.format('yyyyMMdd') + &quot; T&quot; + data.format('HHmm')
//versao = 1 + Integer.valueOf(versao)
}

metadata.'app.version' = versao.toString()

try {
metadata.persist()
println &quot;Versao alterada com sucesso&quot;
} catch (Exception ex) {
ex.printStackTrace()
}

println &quot;Nova versao&#58; ${versao}&quot;
println &quot;----------------------------------&quot;
}
}




C&#58;\Daniel\dev\grails\projetos\financas>grails war
Welcome to Grails 1.3.6 - http&#58;//grails.org/
Licensed under Apache Standard License 2.0
Grails home is set to&#58; C&#58;\Daniel\dev\grails\grails-1.3.6

Base Directory&#58; C&#58;\Daniel\dev\grails\projetos\financas
Resolving dependencies...
Dependencies resolved in 1188ms.
Running script C&#58;\Daniel\dev\grails\grails-1.3.6\scripts\War.groovy
Environment set to production
----------------------------------
Incrementando o numero da versao
Versao alterada com sucesso
Nova versao&#58; 20110216 T1122
----------------------------------
[groovyc] Compiling 1 source file to C&#58;\Daniel\dev\grails\projetos\financas\target\classes
[copy] Copying 1 file to C&#58;\Daniel\dev\grails\projetos\financas\target\classes
[gspc] Compiling 14 GSP files for package [financas] to C&#58;\Daniel\dev\grails\projetos\financas\target\classes
[mkdir] Created dir&#58; C&#58;\Documents and Settings\daniel.costa\.grails\1.3.6\projects\financas\stage
Building WAR file ...
[copy] Copying 40 files to C&#58;\Documents and Settings\daniel.costa\.grails\1.3.6\projects\financas\stage
[copy] Copied 10 empty directories to 1 empty directory under C&#58;\Documents and Settings\daniel.costa\.grails\1.3.6\projects\financas\stage
[mkdir] Created dir&#58; C&#58;\Documents and Settings\daniel.costa\.grails\1.3.6\projects\financas\stage\plugins\jasper-1.1.3
[copy] Copying 51 files to C&#58;\Documents and Settings\daniel.costa\.grails\1.3.6\projects\financas\stage\plugins\jasper-1.1.3
[copy] Copying 27 files to C&#58;\Documents and Settings\daniel.costa\.grails\1.3.6\projects\financas\stage\WEB-INF\grails-app
[copy] Copying 31 files to C&#58;\Documents and Settings\daniel.costa\.grails\1.3.6\projects\financas\stage\WEB-INF\classes
[copy] Copying 197 files to C&#58;\Documents and Settings\daniel.costa\.grails\1.3.6\projects\financas\stage\WEB-INF\classes
[mkdir] Created dir&#58; C&#58;\Documents and Settings\daniel.costa\.grails\1.3.6\projects\financas\stage\WEB-INF\spring
[mkdir] Created dir&#58; C&#58;\Documents and Settings\daniel.costa\.grails\1.3.6\projects\financas\stage\WEB-INF\templates\scaffolding
RESOLVED DEPENDENCIES C&#58;\Documents and Settings\daniel.costa\.ivy2\cache\org.codehaus.groovy\groovy-all\jars\groovy-all-1.7.5.jar
C&#58;\Documents and Settings\daniel.costa\.ivy2\cache\commons-beanutils\commons-beanutils\jars\commons-beanutils-1.8.0.jar
C&#58;\Documents and Settings\daniel.costa\.ivy2\cache\commons-el\commons-el\jars\commons-el-1.0.jar
C&#58;\Documents and Settings\daniel.costa\.ivy2\cache\commons-validator\commons-validator\jars\commons-validator-1.3.1.jar
C&#58;\Documents and Settings\daniel.costa\.ivy2\cache\aopalliance\aopalliance\jars\aopalliance-1.0.jar
C&#58;\Documents and Settings\daniel.costa\.ivy2\cache\com.googlecode.concurrentlinkedhashmap\concurrentlinkedhashmap-lru\jars\concurrentlinkedhashmap-lru-1.0_jdk5.jar
C&#58;\Documents and Settings\daniel.costa\.ivy2\cache\commons-codec\commons-codec\jars\commons-codec-1.4.jar
C&#58;\Documents and Settings\daniel.costa\.ivy2\cache\commons-collections\commons-collections\jars\commons-collections-3.2.1.jar
C&#58;\Documents and Settings\daniel.costa\.ivy2\cache\commons-io\commons-io\jars\commons-io-1.4.jar
C&#58;\Documents and Settings\daniel.costa\.ivy2\cache\commons-lang\commons-lang\jars\commons-lang-2.4.jar
C&#58;\Documents and Settings\daniel.costa\.ivy2\cache\javax.transaction\jta\jars\jta-1.1.jar
C&#58;\Documents and Settings\daniel.costa\.ivy2\cache\org.hibernate\ejb3-persistence\jars\ejb3-persistence-1.0.2.GA.jar
C&#58;\Documents and Settings\daniel.costa\.ivy2\cache\opensymphony\sitemesh\jars\sitemesh-2.4.jar
C&#58;\Documents and Settings\daniel.costa\.ivy2\cache\org.grails\grails-bootstrap\jars\grails-bootstrap-1.3.6.jar
C&#58;\Documents and Settings\daniel.costa\.ivy2\cache\org.grails\grails-core\jars\grails-core-1.3.6.jar
C&#58;\Documents and Settings\daniel.costa\.ivy2\cache\org.grails\grails-crud\jars\grails-crud-1.3.6.jar
C&#58;\Documents and Settings\daniel.costa\.ivy2\cache\org.grails\grails-gorm\jars\grails-gorm-1.3.6.jar
C&#58;\Documents and Settings\daniel.costa\.ivy2\cache\org.grails\grails-resources\jars\grails-resources-1.3.6.jar
C&#58;\Documents and Settings\daniel.costa\.ivy2\cache\org.grails\grails-spring\jars\grails-spring-1.3.6.jar
C&#58;\Documents and Settings\daniel.costa\.ivy2\cache\org.grails\grails-web\jars\grails-web-1.3.6.jar
C&#58;\Documents and Settings\daniel.costa\.ivy2\cache\org.springframework\org.springframework.core\jars\org.springframework.core-3.0.5.RELEASE.jar
C&#58;\Documents and Settings\daniel.costa\.ivy2\cache\org.springframework\org.springframework.aop\jars\org.springframework.aop-3.0.5.RELEASE.jar
C&#58;\Documents and Settings\daniel.costa\.ivy2\cache\org.springframework\org.springframework.aspects\jars\org.springframework.aspects-3.0.5.RELEASE.jar
C&#58;\Documents and Settings\daniel.costa\.ivy2\cache\org.springframework\org.springframework.asm\jars\org.springframework.asm-3.0.5.RELEASE.jar
C&#58;\Documents and Settings\daniel.costa\.ivy2\cache\org.springframework\org.springframework.beans\jars\org.springframework.beans-3.0.5.RELEASE.jar
C&#58;\Documents and Settings\daniel.costa\.ivy2\cache\org.springframework\org.springframework.context\jars\org.springframework.context-3.0.5.RELEASE.jar
C&#58;\Documents and Settings\daniel.costa\.ivy2\cache\org.springframework\org.springframework.context.support\jars\org.springframework.context.support-3.0.5.RELEASE.jar
C&#58;\Documents and Settings\daniel.costa\.ivy2\cache\org.springframework\org.springframework.expression\jars\org.springframework.expression-3.0.5.RELEASE.jar
C&#58;\Documents and Settings\daniel.costa\.ivy2\cache\org.springframework\org.springframework.instrument\jars\org.springframework.instrument-3.0.5.RELEASE.jar
C&#58;\Documents and Settings\daniel.costa\.ivy2\cache\org.springframework\org.springframework.jdbc\jars\org.springframework.jdbc-3.0.5.RELEASE.jar
C&#58;\Documents and Settings\daniel.costa\.ivy2\cache\org.springframework\org.springframework.jms\jars\org.springframework.jms-3.0.5.RELEASE.jar
C&#58;\Documents and Settings\daniel.costa\.ivy2\cache\org.springframework\org.springframework.orm\jars\org.springframework.orm-3.0.5.RELEASE.jar
C&#58;\Documents and Settings\daniel.costa\.ivy2\cache\org.springframework\org.springframework.oxm\jars\org.springframework.oxm-3.0.5.RELEASE.jar
C&#58;\Documents and Settings\daniel.costa\.ivy2\cache\org.springframework\org.springframework.transaction\jars\org.springframework.transaction-3.0.5.RELEASE.jar
C&#58;\Documents and Settings\daniel.costa\.ivy2\cache\org.springframework\org.springframework.web\jars\org.springframework.web-3.0.5.RELEASE.jar
C&#58;\Documents and Settings\daniel.costa\.ivy2\cache\org.springframework\org.springframework.web.servlet\jars\org.springframework.web.servlet-3.0.5.RELEASE.jar
C&#58;\Documents and Settings\daniel.costa\.ivy2\cache\org.slf4j\slf4j-api\jars\slf4j-api-1.5.8.jar
C&#58;\Documents and Settings\daniel.costa\.ivy2\cache\net.sf.jasperreports\jasperreports\jars\jasperreports-3.7.4.jar
C&#58;\Documents and Settings\daniel.costa\.ivy2\cache\commons-digester\commons-digester\jars\commons-digester-1.7.jar
C&#58;\Documents and Settings\daniel.costa\.ivy2\cache\com.lowagie\itext\jars\itext-2.1.7.jar
C&#58;\Documents and Settings\daniel.costa\.ivy2\cache\jfree\jcommon\jars\jcommon-1.0.15.jar
C&#58;\Documents and Settings\daniel.costa\.ivy2\cache\jfree\jfreechart\jars\jfreechart-1.0.12.jar
C&#58;\Documents and Settings\daniel.costa\.ivy2\cache\org.apache.poi\poi\jars\poi-3.5-FINAL.jar
C&#58;\Documents and Settings\daniel.costa\.ivy2\cache\commons-logging\commons-logging\jars\commons-logging-1.1.jar
C&#58;\Documents and Settings\daniel.costa\.ivy2\cache\logkit\logkit\jars\logkit-1.0.1.jar
C&#58;\Documents and Settings\daniel.costa\.ivy2\cache\avalon-framework\avalon-framework\jars\avalon-framework-4.1.3.jar
C&#58;\Documents and Settings\daniel.costa\.ivy2\cache\javax.servlet\servlet-api\jars\servlet-api-2.3.jar
C&#58;\Documents and Settings\daniel.costa\.ivy2\cache\org.hibernate\hibernate-core\jars\hibernate-core-3.3.1.GA.jar
C&#58;\Documents and Settings\daniel.costa\.ivy2\cache\org.hibernate\hibernate-commons-annotations\jars\hibernate-commons-annotations-3.1.0.GA.jar
C&#58;\Documents and Settings\daniel.costa\.ivy2\cache\org.hibernate\hibernate-annotations\jars\hibernate-annotations-3.4.0.GA.jar
C&#58;\Documents and Settings\daniel.costa\.ivy2\cache\org.aspectj\aspectjweaver\jars\aspectjweaver-1.6.8.jar
C&#58;\Documents and Settings\daniel.costa\.ivy2\cache\org.aspectj\aspectjrt\jars\aspectjrt-1.6.8.jar
C&#58;\Documents and Settings\daniel.costa\.ivy2\cache\cglib\cglib-nodep\jars\cglib-nodep-2.1_3.jar
C&#58;\Documents and Settings\daniel.costa\.ivy2\cache\commons-fileupload\commons-fileupload\jars\commons-fileupload-1.2.1.jar
C&#58;\Documents and Settings\daniel.costa\.ivy2\cache\oro\oro\jars\oro-2.0.8.jar
C&#58;\Documents and Settings\daniel.costa\.ivy2\cache\javax.servlet\jstl\jars\jstl-1.1.2.jar
C&#58;\Documents and Settings\daniel.costa\.ivy2\cache\commons-dbcp\commons-dbcp\jars\commons-dbcp-1.3.jar
C&#58;\Documents and Settings\daniel.costa\.ivy2\cache\commons-pool\commons-pool\jars\commons-pool-1.5.5.jar
C&#58;\Documents and Settings\daniel.costa\.ivy2\cache\hsqldb\hsqldb\jars\hsqldb-1.8.0.10.jar
C&#58;\Documents and Settings\daniel.costa\.ivy2\cache\net.sf.ehcache\ehcache-core\jars\ehcache-core-1.7.1.jar
C&#58;\Documents and Settings\daniel.costa\.ivy2\cache\log4j\log4j\jars\log4j-1.2.16.jar
C&#58;\Documents and Settings\daniel.costa\.ivy2\cache\org.slf4j\jcl-over-slf4j\jars\jcl-over-slf4j-1.5.8.jar
C&#58;\Documents and Settings\daniel.costa\.ivy2\cache\org.slf4j\jul-to-slf4j\jars\jul-to-slf4j-1.5.8.jar
C&#58;\Documents and Settings\daniel.costa\.ivy2\cache\org.slf4j\slf4j-log4j12\jars\slf4j-log4j12-1.5.8.jar
C&#58;\Documents and Settings\daniel.costa\.ivy2\cache\apache-taglibs\standard\jars\standard-1.1.2.jar
C&#58;\Documents and Settings\daniel.costa\.ivy2\cache\xpp3\xpp3_min\jars\xpp3_min-1.1.3.4.O.jar
C&#58;\Documents and Settings\daniel.costa\.ivy2\cache\org.hibernate\hibernate-validator\jars\hibernate-validator-3.1.0.GA.jar
C&#58;\Documents and Settings\daniel.costa\.ivy2\cache\javassist\javassist\jars\javassist-3.11.0.GA.jar
C&#58;\Documents and Settings\daniel.costa\.ivy2\cache\antlr\antlr\jars\antlr-2.7.6.jar
C&#58;\Documents and Settings\daniel.costa\.ivy2\cache\dom4j\dom4j\jars\dom4j-1.6.1.jar
C&#58;\Documents and Settings\daniel.costa\.ivy2\cache\org.hibernate\hibernate-ehcache\jars\hibernate-ehcache-3.3.1.GA.jar
[copy] Copying 71 files to C&#58;\Documents and Settings\daniel.costa\.grails\1.3.6\projects\financas\stage\WEB-INF\lib
[copy] Copying 1 file to C&#58;\Documents and Settings\daniel.costa\.grails\1.3.6\projects\financas\stage\WEB-INF
[delete] Deleting&#58; C&#58;\Documents and Settings\daniel.costa\.grails\1.3.6\projects\financas\resources\web.xml
[propertyfile] Updating property file&#58; C&#58;\Documents and Settings\daniel.costa\.grails\1.3.6\projects\financas\stage\WEB-INF\classes\application.properties
[mkdir] Created dir&#58; C&#58;\Documents and Settings\daniel.costa\.grails\1.3.6\projects\financas\stage\WEB-INF\plugins\hibernate-1.3.6
[copy] Copying 1 file to C&#58;\Documents and Settings\daniel.costa\.grails\1.3.6\projects\financas\stage\WEB-INF\plugins\hibernate-1.3.6
[mkdir] Created dir&#58; C&#58;\Documents and Settings\daniel.costa\.grails\1.3.6\projects\financas\stage\WEB-INF\plugins\jasper-1.1.3
[copy] Copying 3 files to C&#58;\Documents and Settings\daniel.costa\.grails\1.3.6\projects\financas\stage\WEB-INF\plugins\jasper-1.1.3
[jar] Building jar&#58; C&#58;\Daniel\dev\grails\projetos\financas\target\financas-20110216 T1120.war
[delete] Deleting directory C&#58;\Documents and Settings\daniel.costa\.grails\1.3.6\projects\financas\stage
Done creating WAR C&#58;\Daniel\dev\grails\projetos\financas\target\financas-20110216 T1120.war
C&#58;\Daniel\dev\grails\projetos\financas>


Reparem que a nova versão é 20110216 T1122 e no entanto o arquivo ficou com o nome de financas-20110216 T1120.war.
Tags: Grails


Ainda não faz parte da comunidade???

Para se registrar, clique aqui.


Aprenda Groovy e Grails com a Formação itexto!

Newsletter Semana Groovy

Assinar

Envie seu link!


Livro de Grails


/dev/All

Os melhores blogs de TI (e em português) em um único lugar!

 
Creative Commons
RSS Grails Brasil é mantido por itexto Consultoria.
Em caso de problemas contacte Henrique Lobo Weissmann (Kico) por e-mail: kico@itexto.com.br
Todo o conteúdo presente neste site adota o Creative Commons como licença padrão.
Ver: 4.14.0
itexto