Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » 3.4 / JAX-WS / Disappearing APT generated files
3.4 / JAX-WS / Disappearing APT generated files [message #254317] Fri, 27 June 2008 21:00 Go to next message
Eclipse UserFriend
Originally posted by: matt.kolabox.com

Hi,

I am new to Eclipse and Java so I apologize if this is a stupid question.
I downloaded Eclipse 3.4 for Windows. I am trying to build a standalone
web service using JAX-WS (I downloaded the 2.1.3 release).

After a while I figured out how to use the project preferences to get the
build tool to use the JAX-WS factories to create the generated web service
stubs.

It works fine, but almost immediately the files get deleted (by the build
system ?) and not regenerated. If I clear all of the preferences, delete
the .apt_generated folder, it works once and then does the same thing.

I see nothing in the .log file.

What can I do to help diagnose this?

Thanks,
Matt
Re: 3.4 / JAX-WS / Disappearing APT generated files [message #254322 is a reply to message #254317] Sat, 28 June 2008 05:17 Go to previous messageGo to next message
Walter Harley is currently offline Walter HarleyFriend
Messages: 847
Registered: July 2009
Senior Member
"Matt Klein" <matt@kolabox.com> wrote in message
news:0b57246f0c79ec3f12ecc17ab4677403$1@www.eclipse.org...
> Hi,
>
> I am new to Eclipse and Java so I apologize if this is a stupid question.
> I downloaded Eclipse 3.4 for Windows. I am trying to build a standalone
> web service using JAX-WS (I downloaded the 2.1.3 release).
>
> After a while I figured out how to use the project preferences to get the
> build tool to use the JAX-WS factories to create the generated web service
> stubs.
> It works fine, but almost immediately the files get deleted (by the build
> system ?) and not regenerated. If I clear all of the preferences, delete
> the .apt_generated folder, it works once and then does the same thing.


Can you say some more about how you have it configured? That is, precisely
what do you mean by "I figured out how to use the project preferences..."
etc.?

You may need to set the processor to "batch mode" in the APT advanced
factory path options. I seem to recall that the JAX-WS processor makes
assumptions that are only true for command-line APT and do not work with
incremental (IDE) compilation.

Thanks,
-Walter Harley
JDT APT lead
Re: 3.4 / JAX-WS / Disappearing APT generated files [message #254325 is a reply to message #254322] Sat, 28 June 2008 16:51 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: matt.kolabox.com

Walter Harley wrote:
> "Matt Klein" <matt@kolabox.com> wrote in message
> news:0b57246f0c79ec3f12ecc17ab4677403$1@www.eclipse.org...
>> Hi,
>>
>> I am new to Eclipse and Java so I apologize if this is a stupid question.
>> I downloaded Eclipse 3.4 for Windows. I am trying to build a standalone
>> web service using JAX-WS (I downloaded the 2.1.3 release).
>>
>> After a while I figured out how to use the project preferences to get the
>> build tool to use the JAX-WS factories to create the generated web service
>> stubs.
>> It works fine, but almost immediately the files get deleted (by the build
>> system ?) and not regenerated. If I clear all of the preferences, delete
>> the .apt_generated folder, it works once and then does the same thing.
>
>
> Can you say some more about how you have it configured? That is, precisely
> what do you mean by "I figured out how to use the project preferences..."
> etc.?
>
> You may need to set the processor to "batch mode" in the APT advanced
> factory path options. I seem to recall that the JAX-WS processor makes
> assumptions that are only true for command-line APT and do not work with
> incremental (IDE) compilation.
>
> Thanks,
> -Walter Harley
> JDT APT lead
>
>

Changing to batch mode for the processor is a little bit better (the
files are not deleted on a subsequent incremental compilation), but it's
still not correct, because they aren't updated either. Sorry for the
lack of details. Here is the exact configuration:

1) Download 2.1.4 release of JAX-WS.
2) Download 3.4 release of Eclipse w/ Jave EE tools.
3) Create a regular Java project.
4) Create a simple class and expose it as a web service using
@WebService. Create 2 methods and expose them as web methods using
@WebMethod.
5) Add jaxws-ri/lib to project class path.
6) Open project preferences, enable annotation processing.
7) Open factory path preferences and add jaxws-tools.jar as a plug-in.

After 7), the IDE decides that project settings have changed and a
rebuild is necessary. When this happens I get correctly generated files.
IF batch mode is not set, subsequent builds delete the generated files
and do not re-create them. If batch mode is set, the initial files are
left, but are not updated if I change something. However, in batch mode,
if I do a clean build the files are generated properly.

So, batch mode is closer to working. What is batch mode exactly?

Is there any way to get the build system to always do a clean build for
annotation on each incremental build? Or any options I can pass to the
processor to make incremental work?

If not, batch mode as it is is good enough.

Thanks
Re: 3.4 / JAX-WS / Disappearing APT generated files [message #254329 is a reply to message #254325] Sun, 29 June 2008 17:30 Go to previous message
Walter Harley is currently offline Walter HarleyFriend
Messages: 847
Registered: July 2009
Senior Member
"Matt" <matt@kolabox.com> wrote in message
news:g45q6f$i4d$1@build.eclipse.org...
>
> So, batch mode is closer to working. What is batch mode exactly?

In general, if you hit F1 while looking at a preference dialog, you'll get a
Help pane. (Little known feature, impossible to discover - I don't know why
these dialogs don't have a Help button.)

From the help on the dialog that lets you set batch mode:

"When this option is selected, the processors and processor factories in
this jar will be run in a mode that enhances compatibility with the Sun(TM)
command-line tool apt. In this mode, processor classes are loaded at the
beginning of a build, executed over the full set of Java types, and then
unloaded, as they would be when running apt at the command line. Processors
run in this mode are only run during a full build, not during incremental
builds. This option is only configurable for jar files; for plugins it is
always set to false. This option only applies to processors using the Java 5
Mirror APIs. It does not affect processors using the Java 6 annotation
processing APIs."

This feature was added precisely for processors, like JAX-WS, that were
written to run at the command line and that are ill-behaved in the context
of a long-running application like the IDE. If I recall correctly, the
JAX-WS processor stores data in class statics and assumes that it will get
called only once; it doesn't reset its internal state correctly, and that's
why you're seeing failures after the first time it runs. Without rewriting
the processor there's nothing we can do to fix it, other than this ugly
"batch mode" hack.


> Is there any way to get the build system to always do a clean build for
> annotation on each incremental build?

Well, there's no way to do a clean build "for annotations". It seems like
there should be a way to make every build be a clean build (i.e., disable
incremental builds), but I just spent a little while looking for it and
didn't find one. Unfortunately I think you may be stuck just doing a clean
build periodically. Not very satisfactory, I know :-(


> Or any options I can pass to the processor to make incremental work?

No; I think the processor is just broken, with regard to running in an IDE.
It might be possible to fix it, if Sun has open-sourced the code (when
Eclipse's APT implementation started I don't believe they had, but by now
that may have changed).
Previous Topic:Add a method to code
Next Topic:javadoc error messages with Ganymeade
Goto Forum:
  


Current Time: Mon Dec 22 17:52:18 GMT 2014

Powered by FUDForum. Page generated in 0.01698 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software