Re: Newbie Help

David Worms <[email protected]>
Newsgroups gmane.comp.jakarta.avalon.user
Message-ID <[email protected]>
Yes and no, Maven and Ant are both used as build systems, but with 
different approaches. While I consider Ant more as a scripting 
language, Maven is the prefered way to manage your project, but it is 
less flexible. Since Maven integrate Ant, anything you can do with Ant 
could be achieve with Maven as well. See Apache Commons Jelly for more 
info.

You should not have to include you library manually. Instead, Merlin 
will take care of this for you. Merlin and Maven use a similar 
mechanism to load your library. The exception you got is in one way or 
another link with this issue.

 From memory, here is how it works:
. you install maven
. you point the environment variable MAVEN_REPO to your Maven 
repository (usually, something like ${Maven_HOME}/repository

Now, when you run Merlin, the Merlin Repository will looks for the 
MAVEN_REPO variable and build the classloader from the library in it. 
Maven will force you to respect a certain file structure based on the 
file name of your jar files. For example, in its simplest form, 
myApp-1.0.jar will map to ${MAVEN_REPO}/merlin/myApp/jar/myApp-1.0.jar.

When you build and run your app, you have to specify which library to 
load, both by Maven and Merlin.
For Maven, you insert the dependency in you project.xml file, for 
Merlin, you insert them in your bock.xml file. Also, when using Maven 
to build your component, don't ommit the goal "avalon:meta" in your 
Maven maven.xml file

Here is an example of a Maven project.xml file:

<project>
   <groupId>myApp</groupId>
   <id> myApp</id>
   <name>My App for Test</name>
   <package>net.myApp.test</package>
   <currentVersion>1.0</currentVersion>
   <description>
     A simple App
   </description>
   <dependencies>
     <!-- avalon dependecies -->
     <dependency>
       <groupId>avalon-framework</groupId>
       <artifactId>avalon-framework-api</artifactId>
       <version>4.1.5</version>
     </dependency>
     <dependency>
       <groupId>avalon-framework</groupId>
       <artifactId>avalon-framework-impl</artifactId>
       <version>4.1.5</version>
     </dependency>
     <dependency>
       <groupId>merlin</groupId>
       <artifactId>merlin-unit</artifactId>
       <version>3.3-SNAPSHOT</version>
     </dependency>
     <dependency>
       <id>myAppDependency</id>
       <version>1.0</version>
     </dependency>
     <!-- merlin testing dependencies -->
     <dependency>
       <groupId>merlin</groupId>
       <artifactId>merlin-unit</artifactId>
       <version>3.3-SNAPSHOT</version>
     </dependency>
</project>

Here is an example of a Maven maven.xml file:

<project default="jar:install">
   <preGoal name="java:compile">
     <attainGoal name="avalon:meta"/>
   </preGoal>
</project>

Here is an example of a Merlin project.xml file:

<container name="test">
    <services>
      <service type="net.myApp.test.TestInterface" />
    </services>
    <classloader>
      <classpath>
        <repository>
          <resource id="myAppDependency" version="1.0"/>
        </repository>
      </classpath>
    </classloader>
    <component name="test"
       class="net.myApp.test.TestComponent" />
</container>

Now, your project will have the following file structure:

${myProject}
   /conf/bock.xml
   maven.xml
   project.xml
   src/java
   src/test

Hope this help you to clarify
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.