aspose file tools*
The moose likes Ant, Maven and Other Build Tools and the fly likes moving files from target to src Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "moving files from target to src" Watch "moving files from target to src" New topic
Author

moving files from target to src

Nishnt Rayn
Greenhorn

Joined: Oct 23, 2008
Posts: 14
I use axis2-wsdl2code plugin for generating java source files from wsdl and finding it painful to copy files from target /generated-classes to src package since this has to be done to compile the new src files. I know maven operates is convention-based. However let me know if there is any config i can make in the pom to do this while generation or after that.
thanks in advance
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16250
    
  21

In Maven - and you didn't actually say Maven, but I deduce it because you're referring to a POM. Anyway, in Maven, the convention for source generators is that the generated source code will be generated into target/source-generated and Maven will compile it from there. Generated source is not considered a "permanent" part of the project, so you shouldn't copy it to the user-maintained source tree (src/main/java). Leave it where it is and it will be fine. You can add the target/generated-sources directory to your version control system if you're like me and prefer to keep an archival copy in case the generator breaks someday.

Regardless of what build system you use, I recommend always keeping generated sources in a directory tree of their own. Sooner or later, I always seem to need to wipe out generated sources and recreate them from their inputs. It's a lot easier when you can do this with a brute-force directory tree delete instead of having to sift through non-generated sources and take care not to delete the wrong files.


Customer surveys are for companies who didn't pay proper attention to begin with.
Nishnt Rayn
Greenhorn

Joined: Oct 23, 2008
Posts: 14
Hi Tim, thanks for posting your reply. I know keeping src in target alleviates the pain but my fingers always itch to execute "mvn clean compile install" which apparently will delete the generated source code. Now i will be stuck with wsdl2code plugin for ever Another alternative i am looking for is generating the code in src directory direct. May be we can have it in separate package/folder structure . What is your take on this?
Nishnt Rayn
Greenhorn

Joined: Oct 23, 2008
Posts: 14
here is the "simplified" question. How can i generate the code in src directory when using wsdl2code plugin?
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: moving files from target to src