Reutilização de Bibliotecas em projetos ( mylib.jar )

4 views
Skip to first unread message

Marcos Azevedo

unread,
Nov 4, 2013, 6:45:59 AM11/4/13
to gwt-b...@googlegroups.com
Olá pessoal!

Estou tentando criar uma lib de components GWT para fazer a reutilização em outros projetos, porém não estou conseguindo.
Eu utilizei esse tutorial: http://blog.roberthanson.org/2006/05/how-to-package-gwt-components.html, porém sempre aparece a msg:

- cannot be resolved to a type
- Previous compiler errors may have made this type unavailable
- Check the inheritance chain from your module; it may not be inheriting a required module or a module may not be adding its source path entries properly

Alguém já teve o mesmo problema?

Abraços,

Marcos Azevedo.

Victor Pinto

unread,
Nov 4, 2013, 7:08:53 AM11/4/13
to gwt-b...@googlegroups.com
Você incluiu a sua lib no arquivo nome_do_projeto.gwt.xml?


[]'s
Victor Pinto A. de Oliveira


--
Você está recebendo esta mensagem porque se inscreveu no grupo "GWT Google Web Toolkit Brasil" dos Grupos do Google.
Para cancelar a inscrição neste grupo e parar de receber seus e-mails, envie um e-mail para gwt-brasil+...@googlegroups.com.
Para postar neste grupo, envie um e-mail para gwt-b...@googlegroups.com.
Visite este grupo em http://groups.google.com/group/gwt-brasil.
Para obter mais opções, acesse https://groups.google.com/groups/opt_out.

Marcos Azevedo

unread,
Nov 4, 2013, 7:12:29 AM11/4/13
to gwt-b...@googlegroups.com
Sim, inclui sim.

Abs.

Marcos Azevedo

unread,
Nov 4, 2013, 8:00:58 AM11/4/13
to gwt-b...@googlegroups.com
Victor, segue abaixo o que fiz passo a passo.

1 - Criei um projeto web application projetct ( google ) para ser minha lib;
2 - No arquivo gwt.xml da minha lib coloquei:

<?xml version="1.0" encoding="UTF-8"?>

<module>
  
  <inherits name='com.google.gwt.user.User'/>

</module>

3 - Exportei via *.jar.
4 - importei a minha lib no projeto que vou utilizar.
5 - informei no gwt.xml do meu projeto o <inherits name="br.com.testelib.Testelib" />
6 - E quando instancio um objeto da minha lib aparece:

Victor Pinto

unread,
Nov 4, 2013, 9:10:50 AM11/4/13
to gwt-b...@googlegroups.com
Marcos,
   Eu nunca fiz isso. 
   No projeto qeu você quer exportar não precisa informar no gwt.xml qual pasta será exportada?


[]'s
Victor Pinto A. de Oliveira


--

Marcos Azevedo

unread,
Nov 4, 2013, 12:44:45 PM11/4/13
to gwt-b...@googlegroups.com
Pessoal! Segue abaixo link que consegui fazer funcionar:

Link.: https://groups.google.com/forum/#!topic/google-web-toolkit/OjEzMr_oca0

Descrição:

You can follow the steps below to package an existing module, say module A defined in project A, that you want to reuse in another project, say project B that defines module B which itself defines an entrypoint class.

1) Create / move all the GWT code that you want to reuse in project A.

2) Create / update the module XML file for module A in the normal way, except you no longer need to define an entry point class.

3) Create a JAR for project A (project-a.jar), which should include 1) GWT source code that you want to reuse from the project, 2) The module XML file, 3) Any other public resources referenced by the module XML file,  4) The binary .class files for any server-side code that you want to reuse

4) Add the project-a.jar file to the project B classpath, as well as any other launch configurations related to project B (typically hosted mode and compile configurations).

5) Reference the module A xml file from the module B xml file (e.g. <inherits name="com.google.projectA.ModuleA" />). Note that since the module A xml file should already include the <inherits name="com.google.gwt.user.User" /> inherits tag, you shouldn't need to add that reference again to the module B xml file.

You should be ready to go. Give those instructions a try and let us know if you managed to package and reuse your module.

Reply all
Reply to author
Forward
0 new messages