You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Matthew Wheaton <md...@gmail.com> on 2005/12/02 22:26:39 UTC

M2 : How to add local NON-installed JARs to the build path for projects.

Hello,

I am an avid Maven fan, and am struggling to understand how to model my new
projects based on my Maven 1.x experience.

I have a number of Eclipse projects, one called csi_libs.
csi_libs, contains all the compile time (and some deployment) 3rd party jars
needed across all projects.

In Maven 1.x, I simply had a simple Ant task that added all the jars to the
classpath for builds, like so:

    <goal
        name="build:SetClasspath"
        description="Sets the classpath">

    <echo message="Setting the compile classpath . . ." />

    <ant:path id="all.libs.path">

      <!-- get all the deployment libs -->
      <ant:fileset dir="${build.deployLibs}">
        <ant:include name="**/*.*" />
      </ant:fileset>

      <!-- get all the compile only libs -->
      <ant:fileset dir="${build.compileLibs}">
        <ant:include name="**/*.*" />
      </ant:fileset>

    </ant:path>

    <m:addPath id="maven.dependency.classpath" refid="all.libs.path" />

    </goal>

I'm struggling on how to replicate this behavior in Maven 2.

Anyone out there who can assist ?

Thank you.
Sincerely,
Matthew Wheaton

Re: M2 : How to add local NON-installed JARs to the build path for projects.

Posted by Henry Isidro <hi...@exist.com>.
Matthew Wheaton wrote:

>Hello,
>
>I am an avid Maven fan, and am struggling to understand how to model my new
>projects based on my Maven 1.x experience.
>
>I have a number of Eclipse projects, one called csi_libs.
>csi_libs, contains all the compile time (and some deployment) 3rd party jars
>needed across all projects.
>
>In Maven 1.x, I simply had a simple Ant task that added all the jars to the
>classpath for builds, like so:
>
>    <goal
>        name="build:SetClasspath"
>        description="Sets the classpath">
>
>    <echo message="Setting the compile classpath . . ." />
>
>    <ant:path id="all.libs.path">
>
>      <!-- get all the deployment libs -->
>      <ant:fileset dir="${build.deployLibs}">
>        <ant:include name="**/*.*" />
>      </ant:fileset>
>
>      <!-- get all the compile only libs -->
>      <ant:fileset dir="${build.compileLibs}">
>        <ant:include name="**/*.*" />
>      </ant:fileset>
>
>    </ant:path>
>
>    <m:addPath id="maven.dependency.classpath" refid="all.libs.path" />
>
>    </goal>
>
>I'm struggling on how to replicate this behavior in Maven 2.
>
>Anyone out there who can assist ?
>
>Thank you.
>Sincerely,
>Matthew Wheaton
>
>  
>
One of Maven's strengths is its dependency handling mechanism. If you 
manually add your dependencies to the classpath, then you're not using 
Maven's full potential. Although this would work, (you could use the 
antrun plugin) it is better to register your dependencies in the pom and 
let Maven handle them. This entails placing your dependencies in your 
repository which organizes and centralizes the location of your 
artifacts. Check this link out for more info on the dependency mechanism 
of M2: 
http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html

Regards,
- Henry

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: M2 : How to add local NON-installed JARs to the build path for projects.

Posted by Maria Odea Ching <oc...@mergere.com>.
Hi Matthew,

You should specify the scope of your dependency in the pom.xml file. If 
the scope is set to "compile" (default value), then the dependency will 
automatically be included in the compile time classpath. If it is set to 
"runtime", then the dependency would be added in the runtime classpath 
by maven. And so on..

Check out the Dependency Mechanism section 
(http://maven.apache.org/guides/index.html) of the Maven 2 documentation 
for more details.

Regards,
Odea Ching


Matthew Wheaton wrote:

>Hello,
>
>I am an avid Maven fan, and am struggling to understand how to model my new
>projects based on my Maven 1.x experience.
>
>I have a number of Eclipse projects, one called csi_libs.
>csi_libs, contains all the compile time (and some deployment) 3rd party jars
>needed across all projects.
>
>In Maven 1.x, I simply had a simple Ant task that added all the jars to the
>classpath for builds, like so:
>
>    <goal
>        name="build:SetClasspath"
>        description="Sets the classpath">
>
>    <echo message="Setting the compile classpath . . ." />
>
>    <ant:path id="all.libs.path">
>
>      <!-- get all the deployment libs -->
>      <ant:fileset dir="${build.deployLibs}">
>        <ant:include name="**/*.*" />
>      </ant:fileset>
>
>      <!-- get all the compile only libs -->
>      <ant:fileset dir="${build.compileLibs}">
>        <ant:include name="**/*.*" />
>      </ant:fileset>
>
>    </ant:path>
>
>    <m:addPath id="maven.dependency.classpath" refid="all.libs.path" />
>
>    </goal>
>
>I'm struggling on how to replicate this behavior in Maven 2.
>
>Anyone out there who can assist ?
>
>Thank you.
>Sincerely,
>Matthew Wheaton
>
>  
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org