Tuesday, February 3, 2015

Learning Ant

I understand that there are probably many problems with the way I have my project set up. One of these is that, there are multiple project that are dependent of each other (This is not by itself a problem), but rather than referencing the actual project, I have to export it to a jar, and put it in my tomcat lib folder (this is the part that I believe is probably not ideal). This ofter involves me realizing I forgot to run eclipse as an adminstrator, and having to restart the program. After this happening one to many times I decided to try find a way to automate my build process, and copy the files for me. And so I found Ant.

I had seen Ant as an option in eclipse, but I never new anything about it. When I was searching for a solution to my problem though, it looked as though Ant is what I needed so I decided to try to learn what it can do. I was able to use a tutorial I found here, To get a pretty basic understanding of how to use a basic ant script to build a library. That was all I needed to do for my base projects, that doesn't depend on any of my other projects, but for the ones that depended on it, I had to do a little extra searching to figure out how to copy a file (the *.jar), to my lib folder. The answer was just a copy tag, with a fileset child, i.e.
   <copy todir="${lib.dir}">
      <fileset dir="${util.dir}">
   </fileset>
    </copy>

After writting one of these for each of my projects, I began looking into how to get the all to run at once. It looked like it was just a matter of referencing the other Ant files I wanted to run, and giving them dependencies on each other so they run in the correct order. But then I realized that they are run in the directory of the first file, so the relative paths were incorrect. I spent a little time looking for how to do an equivilent of cd, but most sites said I shouldn't need to. So I believe this is another instance were the structure of my project is causing some problems. I also at that point saw some people recomending using Maven instead of Ant. I think I will make do with multiple ant files for now, but if I ever decided that that is to much of a hassle as well, I fill start looking into trying to learn the basics of Maven as well.

I think my next step will be to add Google Authentication to my application, so that I can give users different levels of access to various features.

No comments:

Post a Comment