MG>quick comments below

________________________________
From: Jochen Wiedmann <jochen.wiedm...@gmail.com>
Sent: Tuesday, December 12, 2017 7:54 AM
To: dev@ant.apache.org
Subject: Build Script Templates

Hi,

over the last months, I was working in a larger project in a Java
environment, but not directly a Java project. Suffice it to say, that
we have a number of Java subprojects, but generally aren't so much
interested in Java builds, etc.

There's no rule without exceptions, so I've been tasked with
streamlining these subprojects into a form, which allows to maintain
them in a simple, and uniform manner.

Not surprising, I was thinking "Maven" initially, and started to
rewrite some of these subprojects for Maven. However, it quickly
turned out, that access to the Internet is a problem in my particular
corporate environment,
MG>my internet access was problematic so i dropped IVY ..
MG>in maven you can test your pom.xml against local repository with -o option 
e.g.
MG>mvn -o

so I dropped Maven from the picture.

What I came up with, instead, was a set of conventions, which closely
resemble the Maven projects, and a "Maven Jar Template" (MJT). The MJT
is an Ant build script, which is generic, and shared by all our
subprojects. The actual build scripts typically specify a small set of
properties (project.name, project.version,
project.java.source.version, and the like),
MG>Nota Bene:if you add project.groupId and project.artifactId you will satisfy 
the GAV reference to a maven artifact

and import the MJT. As the project follows the MJT conventions, that's it in 
most cases, apart
from things like a uber jar, etc., which aren't handled by the MJT.
However, these are mostly resolved by "overwriting" one of the
imported tasks.
MG>same concept applies in maven where you declare template in 
<dependencyManagement>
MG>and / or <pluginManagement> in parent pom
MG>then later on you can 'override' either declaration for plugin or dependency 
in your artifact's local pom.xml

In general, our build scripts are unusually small, and concise (for
Ant scripts, that is). The experience is so good, that I wonder, if we
couldn't start distributing some of these templates with Ant Core, or
as a separate ant-templates.jar? If so, a build script could look like
below,

Jochen

   <project name="MySampleProject" default="dist">
        <property name="project.name" value="MySampleProject"/>
        <property name="project.version" value="0.1"/>

        <!-- Specify targets, like "clean", "compile", "package", etc.
              following the Maven goals. -->
        <import resource="org/apache/ant/templates/MavenJarTemplate-0.1.xml"/>
MG>do you have a mock of MavenJarTemplate-0.1.xml you can display for us?

        <!-- Specify our own targets -->
        <target name="dist" depends="clean,install"/>
MG>assume install target is declared in MavenJarTemplate-0.1.xml ?
   </project>


--
The next time you hear: "Don't reinvent the wheel!"

http://www.keystonedevelopment.co.uk/wp-content/uploads/2014/10/evolution-of-the-wheel-300x85.jpg

[http://www.keystonedevelopment.co.uk/wp-content/uploads/2014/10/evolution-of-the-wheel-300x85.jpg]


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@ant.apache.org
For additional commands, e-mail: dev-h...@ant.apache.org

Reply via email to