Java – how do you handle the generated code?

What is a good strategy for handling generated code? One of our projects uses Apache CXF's wsdl2 Java tool to generate Jax - WS stubs for a set of wsdls What should the code do?

I can see two options:

>The stub is generated once and stored in version control This way, you don't have to deal with the IDE classpath problem because of the active files in your tree (or nearby) However, in addition to enticing someone to use generated code, you still have a lot of confusion in version control > generate stubs every time you build This reverses #1 the pros / cons because the developer now has to deal with running the build script and adding the generated jar to his / her classpath

We chose #2 because the problems related to classpath seem to be more troublesome than those detailed in #1

What are the others doing? Does anyone have any suggestions to simplify the process?

Solution

My attitude is that the generated code will never actually be stored in version control There must be a convincing reason to do it I usually create an ant task "build for eclipse" to build all the generated code I run it and refresh the directory of generated code. Look, I'm good for it

The goal is that you have a "one click" trivial task that any developer can do. They will have all the source code in their ide - whether generated or not - but there is no output in source control If it is the output of the generator, by definition it is not the source

The above is the Java compiled by programming house for you - how do you deal with the generated code? I hope this article can help you solve Java - how do you deal with the generated code? Program development problems encountered.

If you think the content of the programming home website is good, you are welcome to recommend the programming home website to programmers and friends.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>