Also keep in mind that you can use antrun to the pre and post work which should cover most of your requirements
-D On Mon, Oct 28, 2013 at 3:39 PM, Dan Tran <[email protected]> wrote: > Hi Petar > > Please file a jira for this. > > Best if you provide separate jira for each changes > > -D > > > On Mon, Oct 28, 2013 at 10:44 AM, Petar Tahchiev <[email protected]>wrote: > >> Hi guys, >> >> my name is Petar Tahchiev and I am a former Maven developer. Recently >> I've been playing with the APPASSEMBLY plugin, >> and I think I've done some improvements to it (see attached patch). >> All I wanted was to creat a daemon for my project, zip it and deploy it >> to a remote server. I figured out I need to create >> a daemon with the following folder structure: >> >> +ROOT >> - bin/ >> - conf/ >> - lib/ >> - logs/ >> - webapps/ROOT/ >> >> So my first step was to use the maven-war plugin to create the exploded >> folder ROOT in the webapps directory. This worked well. >> After that the maven appassembly plugin should create the rest of my >> folder structure. And it really did, but with >> these minor defects: >> 1) I have a config folder in src/main/config/tomcat/ which contains the >> server.xml and web.xml and a bunch of other >> catalina conf files. When I used the >> >> <copyConfigurationDirectory>true</copyConfigurationDirectory> >> >> it didn't copy my configuration files. So digging in the code I saw that >> this attribute was set on the AssemblyMojo (AM), >> which extends AbstractScriptGeneratorMojo (ASGM), and for daemons I was >> using the GenerateDaemonsMojo (GM) which extended >> the same ASGM, so the structure is pretty much: >> >> (AAM) >> ^ >> | >> (ASGM) >> ^ >> | >> / \ >> (GDM) (AM) >> >> So what I did was to move the copyConfiguration property from (AM) to >> (ASGM) so that both (GDM) and (AM) could use it. I had to also >> copy the <configurationSourceDirectory> and <configurationDirectory> >> attributes, the copyConfigurationDirectory and installDependencies >> methods. After this it worked great - my config files were copied. >> 2) I didn't want to generate a repository in my lib folder, because I was >> generating exploded war file in webapps/ROOT and inside it's >> WEB-INF/lib folder were all the jar files that I needed so I didn't want >> to have any duplication. Unfortunately the same situation as before - >> the generateRepository was specified on (AM) and I needed it both on (AM) >> and (GDM), so I simply moved it to (ASGM). Now that this problem >> was solved, my lib/ repository folder contained only the tanukisoftware >> libraries. Perfect!!! >> 3) Another problem I faced was, that some of my libraries were with scope >> provided (like mysql connectors, and servlet-api and tomcat-embedded >> jars, etc.). But they weren't copied to the repository lib/ folder. So I >> made a small change, after installing the dependencies in the >> lib repository I added another method to copy all the dependencies with >> scope "provided" in the lib repository. And if you really think about >> it it's where they belong - if they should be provided and we are >> creating a server daemon, they must be provided in the lib folder. >> 4) My last change was to add two new attributes <tempDirectory> and >> <logsDirectory>. If those are provided, the maven plugin will create the >> provided folders just before the end. I had a problem that when starting >> the tomcat daemon it was trying to write it's PID file inside the logs >> directory, which weren't there so I had to every time call antrun plugin >> to create that folder, which seemed a huge overkill. Anyways if the >> folders are not provided, no folders are created. >> >> With all those changes I am happily creating my zips, with either jetty >> or tomcat (depending on the profile you run maven in), and I really >> believe that these changes will help someone else too. >> >> Please let me know what you think and if the source looks good enough, >> apply it in the trunk. >> >> Thanks >> >> P.S. I have also modified one of the tests to test if a null-or-empty >> <commandLineArgument> was passed. Before I was getting a Null-pointer >> exception so I added a null check in there. >> >> -- >> Regards, Petar! >> Karlovo, Bulgaria. >> --- >> Public PGP Key at: >> https://keyserver1.pgp.com/vkd/DownloadKey.event?keyid=0x19658550C3110611 >> Key Fingerprint: A369 A7EE 61BC 93A3 CDFF 55A5 1965 8550 C311 0611 >> >> >> --------------------------------------------------------------------- >> To unsubscribe from this list, please visit: >> >> http://xircles.codehaus.org/manage_email >> >> >
