You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by David Snyder <ds...@alumni.brown.edu> on 2006/12/18 22:13:00 UTC

antlib and provided scope

I'm having an issue using the artificat:dependency ant task for
dependencies with "provided" scope.

For the sample files below, if I run the "example-nopom" target, two
paths print out as I would expect.  If I run the "example-pom" target,
I get the error "No files specified for filelist." on the line
<property name="provided.path.string" refid="provided.path"/>.

My ultimate goal here is to be able to to use my existing ant-based
build system, but with Maven managing dependencies using pom files.  I
plan to use the appserver to provide most of the dependencies at
runtime, so there will not be many files in my EAR and WAR files, and
I'd like to be able to generate a report of which dependencies are
specified with "provided" scope.

Am I misunderstanding how this is supposed to work, or is this a bug?

Thanks,
David

build.xml:
-----------------------
<project name="test-provided-scope" xmlns:artifact="urn:maven-artifact-ant">
    <property name="buildsystem.lib" value="lib"/>
	
    <typedef resource="org/apache/maven/artifact/ant/antlib.xml"
uri="urn:maven-artifact-ant">
        <classpath>
        <fileset dir="${buildsystem.lib}">
             <include name="*.jar"/>
	</fileset>
	 </classpath>
    </typedef>
	
    <target name="example-nopom" description="--> example without a pom">
		<artifact:dependencies pathId="compile.path">
			<dependency groupId="commons-beanutils"
artifactId="commons-beanutils" version="1.6"/>
		</artifact:dependencies>
    	
		<artifact:dependencies pathId="provided.path">
			<dependency groupId="org.hibernate" artifactId="hibernate"
version="3.1" scope="provided" />
		</artifact:dependencies>
    	
    	<property name="compile.path.string" refid="compile.path"/>	
    	<property name="provided.path.string" refid="provided.path"/>	
    	
    	<echo>COMPILE: ${compile.path.string}</echo>
    	<echo>PROVIDED: ${provided.path.string}</echo>
    </target>

	<target name="example-pom" description="--> example with a pom">
	
			<artifact:pom id="pom" file="example-pom.xml"/>
		
			<artifact:dependencies pathId="compile.path" pomrefid="pom"
usescope="compile"/>
	    	
			<artifact:dependencies pathId="provided.path" pomrefid="pom"
usescope="provided"/>
	    	
	    	<property name="compile.path.string" refid="compile.path"/>	
	    	<property name="provided.path.string" refid="provided.path"/>	
	    	
	    	<echo>COMPILE: ${compile.path.string}</echo>
	    	<echo>PROVIDED: ${provided.path.string}</echo>
	    </target>
</project>

example-pom.xml:
------------------------------
<project
		name="test-provided-scope" xmlns:artifact="urn:maven-artifact-ant">
		
	<property name="buildsystem.lib" value="C:\sandbox\build-scripts\2.0\lib"/>
	
	<typedef resource="org/apache/maven/artifact/ant/antlib.xml"
uri="urn:maven-artifact-ant">
	    <classpath>
		<fileset dir="${buildsystem.lib}">
			<include name="*.jar"/>
		</fileset>
	    </classpath>
	</typedef>
	
    <target name="example-nopom" description="--> example">

		<artifact:dependencies pathId="compile.path">
			<dependency groupId="commons-beanutils"
artifactId="commons-beanutils" version="1.6"/>
		</artifact:dependencies>
    	
		<artifact:dependencies pathId="provided.path">
			<dependency groupId="org.hibernate" artifactId="hibernate"
version="3.1" scope="provided" />
		</artifact:dependencies>
    	
    	<property name="compile.path.string" refid="compile.path"/>	
    	<property name="provided.path.string" refid="provided.path"/>	
    	
    	<echo>COMPILE: ${compile.path.string}</echo>
    	<echo>PROVIDED: ${provided.path.string}</echo>
    </target>

	<target name="example-pom" description="--> example">
	
			<artifact:pom id="pom" file="example-pom.xml"/>
		
			<artifact:dependencies pathId="compile.path" pomrefid="pom"
usescope="compile"/>
	    	
			<artifact:dependencies pathId="provided.path" pomrefid="pom"
usescope="provided"/>
	    	
	    	<property name="compile.path.string" refid="compile.path"/>	
	    	<property name="provided.path.string" refid="provided.path"/>	
	    	
	    	<echo>COMPILE: ${compile.path.string}</echo>
	    	<echo>PROVIDED: ${provided.path.string}</echo>
	    </target>
</project>

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