How do you deal with generated code?

What is a good strategy for working with generated code? One of our projects uses the Apache CXF wsdl2java tool to generate JAX-WS stubs for the wsdls suite. How should this code be handled?

There are two options that I can see:

  • Generate stubs once and save them in version control. In this case, you do not have to deal with problems of the class IDE class, since you have the source files directly in your tree (or nearby). However, you have a lot of mess in version control in addition to the temptation for someone monkeys with generated code

  • Pins are generated each time during assembly. This overrides the pros / cons for # 1 in that the developer now has to deal with running the script assembly and add the resulting jars to his / her class path.

We went with No. 2 because the annoyance of classpath-related issues seemed to outweigh the problems described in No. 1.

What are other people doing? Does anyone have any recommendations for optimizing this process?

+3
source share
7 answers

, . . ant "build-for-eclipse", . , , , voilà, .

, " " , , , - IDE, . , .: -)

.

+8

. , , , , , . , # 1 , , . , .

, , , , , .

+2

№ 3, 1 2, : , ( ).

SO ( "Net" ) . , : source control SOURCE, , , .

IDE, . IDE , .

.

+2

, , J2EE/EJB 2.x XDoclet. , , : , .

, , № 1 . , # 2 (, Eclipse Xdoclet), . : # 2 JVM, , IDE/JVM, .

0

2 . # 2 , (Apache CXF ). , CXF. , , : -)

0

Eclipse IDE/. Java- . , im - hibernate Axis Web Services. :

projectWeb: , , -. : -)

projectORM: , .

projectWS: , Java2WDSL.

projectWSClient: , WDSL2Java.

(SVN). Maven 2 depencendy/build, Maven 2. ( ) (, ).

0

№ 2. , .

. / :
(, , " ", - , - ...)

  • - (*)
  • , (a-la MAKE), .
  • , ( , , )
  • .

( , Source Control, ), - .

Typical examples of the above are the database ORM classes and the Web Services proxy classes.

** (How much is “too long”? It depends on the fact that in very interactive conditions one minute can be “too long.” As I said, these are the criteria that you should think about. In real programming, as in real life, you must choose your evil). *

0
source

Source: https://habr.com/ru/post/1703856/


All Articles