annotation processing in eclipse

S

stc

JDK 5
JDK EE 5
Eclipse 3.3.1.1

I'm trying to write simple test webservice with only one method that returns
some string. From what I've found on the net it seems as if it's enough to
put @WebService annotation for the class and annotation processor would
generate necessary files for deployment on application server.

I've enabled annotation processing for the project in Eclipse, left default
".apt_generated" source directory and chosen tools.jar from JDK EE as "JARs
that contain annotation processors".

But nothing happens when I build the project (whether it is clean build or
just manual build of a single Java class). What am I missing? I've found
some examples on the net but they all demonstrate how to write one's own
annotation processor and that's not what I need.
 
H

Hendrik Maryns

stc schreef:
JDK 5
JDK EE 5
Eclipse 3.3.1.1

I'm trying to write simple test webservice with only one method that returns
some string. From what I've found on the net it seems as if it's enough to
put @WebService annotation for the class and annotation processor would
generate necessary files for deployment on application server.

Where did you find this?
I've enabled annotation processing for the project in Eclipse, left default
".apt_generated" source directory and chosen tools.jar from JDK EE as "JARs
that contain annotation processors".

But nothing happens when I build the project (whether it is clean build or
just manual build of a single Java class). What am I missing? I've found
some examples on the net but they all demonstrate how to write one's own
annotation processor and that's not what I need.

I suppose the website you are talking about provides some tool to do this.

H.
--
Hendrik Maryns
http://tcl.sfs.uni-tuebingen.de/~hendrik/
==================
http://aouw.org
Ask smart questions, get good answers:
http://www.catb.org/~esr/faqs/smart-questions.html


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.4-svn0 (GNU/Linux)
Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org

iD8DBQFHVXoge+7xMGD3itQRAr1OAJ9gJCS49ZF6OfqAcEweo6q7YLPibwCfeWMx
18MZUBfZQBxxK6dkMiU2Kqc=
=q/UK
-----END PGP SIGNATURE-----
 
S

stc

I've been looking into this subject today and from what I've gathered there
are several standard command-line tools provided by Sun (apt, wsgen...) that
do all the work of generating stubs, wsdl, xsd and other files necessary for
deploying webservice.

Annotation processor is a term mentioned there and Eclipse has some kind of
support for that. I must admit that I couldn't find one clear step-by-step
example, only parts of information I could barely use.

I managed to generate something using apt but I didn't get wsdl and xsd
files...

news:[email protected]...
 
S

stc

Lew said:
stc schreef:



I, too, am interested in the answer to Hendrik's question. What is the
answer?

Not on some specific website but all over the net. At least, that's what I
thought I found. NetBeans generates all files necessary to deploy webservice
just by adding @WebService annotation to the class so I thought Eclipse
could do the same.
 
L

Lew

stc said:
Not on some specific website but all over the net. At least, that's what I
thought I found. NetBeans generates all files necessary to deploy webservice
just by adding @WebService annotation to the class so I thought Eclipse
could do the same.

Please cite a reference for the @WebService annotation.
 
L

Lew

Annotations have to be processed by a processor aware of the annotations. At
a minimum you need a library that implements JSR 181 in your project. It
might be that Eclipse doesn't have logic to handle these annotations, but
perhaps there is a plugin that will remedy that. It seems that NetBeans is
equipped to handle JSR 181 automagically for you right out of the box.
 
S

stc

Lew said:
Lew wrote:
Annotations have to be processed by a processor aware of the annotations.
At a minimum you need a library that implements JSR 181 in your project.
It might be that Eclipse doesn't have logic to handle these annotations,
but perhaps there is a plugin that will remedy that. It seems that
NetBeans is equipped to handle JSR 181 automagically for you right out of
the box.

Eclipse has something under Project Properties - Java Compiler - Annotations
Processing but nothing happens when I configure it. Truth be told, there's
something "Plug-ins and JARs that contain annotation processors" and I put
JDK EE's tools.jar there (it works with apt command line utility) but maybe
it needs specifically written plug-in...
 
L

Lew

stc said:
Eclipse has something under Project Properties - Java Compiler - Annotations
Processing but nothing happens when I configure it. Truth be told, there's
something "Plug-ins and JARs that contain annotation processors" and I put
JDK EE's tools.jar there (it works with apt command line utility) but maybe
it needs specifically written plug-in...

Usually I've found that just having the JAR with the annotation class
definitions in the project class path suffices.
 
F

Franz

Hi,

I have a similar problem: I have custom annotation, but eclipse says
"cannot be resolved to a type". But the strange is that it only occurs
on annotation, which has variables.

For example I have this annotation:
@XmlNode(tagName = "test")
public final class test { ... }

The corresponding annotation-interface is:
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
public @interface XmlNode {
String namespaceUri() default "http://www.test.com/test";
String namespacePrefix() default "test";
String tagName();
}

Any idea, why it is not working?

Thanks in advance,
Franz
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,040
Latest member
papereejit

Latest Threads

Top