boa tarde pessoal,
estou com um problema/duvida, sendo que eu sei que existe a possibilidade mas nao sei como faze-lo.
tenho uma classe java que preciso que seja chamada toda vez que eu COMPILAR meu projeto.
tentei alterar o build.xml inserindo o codigo abaixo, mas nao consegui fazer funcionar:
<target name="revision" description="Cria o arquivo de revisao">
<taskdef name="revisionInfoFile" classname="SVNRevisionInfo">
<classpath refid="compile.classpath"/>
<classpath path="${basedir}"/>
</taskdef>
</target>
Alguem tem alguma sugestao?
Classe a ser chamada na compilacao
[code]/*
- To change this template, choose Tools | Templates
- and open the template in the editor.
*/
package br.com.riopro.util;
import java.io.FileOutputStream;
import java.io.OutputStream;
import java.util.Properties;
import org.tmatesoft.svn.core.wc.SVNClientManager;
import org.tmatesoft.svn.core.wc.SVNRevision;
import org.tmatesoft.svn.core.wc.SVNWCClient;
public class SVNRevisionInfo {
SVNClientManager manager;
SVNWCClient wcClient;
java.io.File localFile;
String svnFileDir = "";
public SVNRevisionInfo() {
try{
java.util.ResourceBundle resourceConfig = null;
//carrega o svnFileDir condominio.uteis/revisiontemp.properties
resourceConfig = java.util.ResourceBundle.getBundle("br.com.riopro.util.revisiontemp");
svnFileDir = resourceConfig.getString("basedirSVN");
}catch(Exception e)
{
System.out.println(e);
svnFileDir = "";
}
localFile = new java.io.File(svnFileDir);
manager = SVNClientManager.newInstance();
wcClient = manager.getWCClient();
}
public SVNRevisionInfo(String svnlocal) {
localFile = new java.io.File(svnlocal);
manager = SVNClientManager.newInstance();
wcClient = manager.getWCClient();
}
public Long getLocalRevisionInfoNumber() throws Exception
{
Long infoLocal = new Long(0l);
infoLocal = new Long(wcClient.doInfo(localFile, SVNRevision.WORKING).getRevision().getNumber());
return infoLocal;
}
public String getLocalRevisionInfoAuthor() throws Exception
{
return wcClient.doInfo(localFile, SVNRevision.WORKING).getAuthor();
}
public boolean createRevisionInfoFile()
throws Exception
{
OutputStream out = new FileOutputStream(svnFileDir + "revision.properties");
Properties propInfoFile = new Properties();
propInfoFile.setProperty("revisionNumber", this.getLocalRevisionInfoNumber().toString());
propInfoFile.setProperty("revisionAuthor", this.getLocalRevisionInfoAuthor());
propInfoFile.store(out, "Client compilation Revision");
out.close();
return true;
}
//metodo para ser chamado pela task ant
public void execute()
throws Exception
{
this.createRevisionInfoFile();
}
}
[/code]