Anyone?* Not being able to merge files isn't a big problem per sé, but it'll involve more work to do for the people that are going to use my archetypes in the (near?) future.
(*: Note that I don't know the policy on 'bumping' a thread, nor am I familiar with the proper term to use when it concerns mailing lists. I prefer forums, tbh =D) Yopy wrote: > > Okay, that works wonderfully, =D. Time for the next question - and if this > is documented somewhere, I wasn't able to find it anywhere. > > I now have a 'partial' archetype that can add a skeleton of functionality > to a project. The general idea is to be able to add the same archetype > multiple times to a project, but currently, I get an OutputFileExists > error. I'm pretty sure I saw an 'overwrite=true' or 'allowOverwrite=true' > property somewhere, which will work just fine for the non-critical stuff > like images and such resources, but there's also a couple of .properties > files with language resources, which really shouldn't be overwritten, but > rather 'merged' with each other. > > Does Maven's Archetype plugin or Velocity offer functionality to do this? > The language labels will in most cases be unique, so determining whether > to overwrite or add shouldn't be too difficult. > > Also, is there a way to have the archetype generate goal check for > duplicate entries for non-overwritable resources before files start to get > written? Currently, folders and such are created, but only later does the > plugin figure out that it can't continue due to existing files, > effectively cluttering the project up. Which isn't a problem right now > during development, since I just delete the whole project and start anew, > but it's not something that would be desirable for active projects. > > Can - once again - anyone point me in the right direction? Or at least > give the proper Google terms to use to find it, I've pretty much expended > my vocabulary already, :/. > > > Raphaël wrote: >> >> Hi >> >> You can find an example of partial archetype in >> http://svn.apache.org/repos/asf/maven/archetype/trunk/archetype-common/src/test/archetypes/partial-1.0/ >> >> You can find some unit tests using that archetype in >> http://svn.apache.org/repos/asf/maven/archetype/trunk/archetype-common/src/test/java/org/apache/maven/archetype/generator/DefaultArchetypeGeneratorTest.java >> >> Regards, >> >> Raphaël >> >> 2009/4/23 Yopy <yopy...@hotmail.com> >> >>> >>> Hi all, I'm having issues with the Archetype plugin. >>> >>> I've made an archetype that sets up a 'skeleton' application, which can >>> be >>> packaged as an OSGI module and distributed. This works fine, no problems >>> there (yet, and the problems that were there I have managed to solve). >>> >>> The next step is to add 'components' to this module. A component, in >>> this >>> case, is a set of classes and resources added to the project's src >>> folder. >>> I >>> figured that partial archetypes would - in theory - do the trick, but >>> I'm >>> having trouble with that. >>> >>> The first problem is that there doesn't seem to be proper documentation >>> on >>> the subject. There is some documentation available on the archetype >>> creation >>> process, but it's limited and whatnot. There's also no or very little >>> documentation on creating and using a partial archetype - the one I >>> found >>> was for an older version, it seems, where the archetype configuration >>> file >>> was still called 'archetype.xml' instead of the current >>> 'archetype-metadata.xml'. >>> >>> But anyways. I've made my archetype's source which is mainly out of a >>> source >>> folder that adds a set of classes to the package the user indicates on >>> the >>> commandline. I've also had to add a pom.xml file in the root of the >>> archetype-resources folder, else the archetype would not install. >>> >>> I've added an <allowPartial>-tag to the archetype-metadata.xml, guessing >>> that's what you have to add to this file in order to make it a partial >>> project - please correct me if I'm wrong. >>> >>> Next, I go to the commandline, mvn archetype:generate my skeleton >>> project, >>> works fine. Next, I archetype:generate the 'partial' archetype, but >>> that's >>> where the problems begin. >>> >>> When calling the archetype:generate command with the partial archetype, >>> I >>> get the error that there is already a Maven2 project with the same name >>> as >>> the archetypeId. It doesn't seem like I can leave this value blank, >>> either. >>> >>> The next attempt is to go into the project skeleton directory and call >>> the >>> command there, but then I get the error that Maven is 'unable to add >>> module >>> to the current project as it is not of packaging type 'pom''. >>> >>> I'm starting to suspect that the 'partial' archetype can only add full >>> modules to a Maven project - is this suspicion correct? >>> >>> If not, then what might I be doing wrong? What is required to create a >>> partial archetype that (attempts to) add files and folders to an >>> existing >>> project's src folder? What should the archetype's prototype pom.xml >>> contain >>> (if anything)? What data should I - besides the fileSets and whatnot - >>> add >>> to the archetype-metadata.xml file? >>> >>> [/questions] >>> >>> It'd help a ton if there would be someone that could help me out, :). >>> >>> Kind regards, >>> -- >>> View this message in context: >>> http://www.nabble.com/-Archetype--Adding-a-package-to-an-existing-project-tp23194570p23194570.html >>> Sent from the Maven - Users mailing list archive at Nabble.com. >>> >>> >>> --------------------------------------------------------------------- >>> To unsubscribe, e-mail: users-unsubscr...@maven.apache.org >>> For additional commands, e-mail: users-h...@maven.apache.org >>> >>> >> >> > > -- View this message in context: http://www.nabble.com/-Archetype--Adding-a-package-to-an-existing-project-tp23194570p23251742.html Sent from the Maven - Users mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org