You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by De Smet Ringo <Ri...@staff.telenet.be> on 2008/07/01 12:39:41 UTC

RE: How to refer to different Maven classpaths in Ant-based mojo's?

Hello, 

> Can someone post a snippet of Ant file showing me how I can 
> refer to these classpaths? In our Maven1 jelly setup, I found 
> references like "maven.compile.classpath", but using this as
> 
> <path refid="maven.compile.classpath"/>

Eventually, I found out what was wrong with my code. It took me a
while... :-)

It seems one cannot use the refid. I changed my Ant-based mojo to:

<classpath>
   <pathelement path="${maven.compile.classpath}"/>
</classpath>

This works fine now.

I do have a specific question about the "maven.plugin.classpath" value
though. Look at the code of AntMojoWrapper:

http://svn.apache.org/viewvc/maven/shared/trunk/maven-script/maven-scrip
t-ant/src/main/java/org/apache/maven/script/ant/AntMojoWrapper.java?view
=markup

The "maven.plugin.classpath" value is the list of artifacts retrieved
from the plugin descriptor. But the plugin descriptor of which project:
my self-written maven2.plugin, or the plugin classpath of the project in
which my mojo is called (if any)?

The thing is, that the Ant-based mojo, defined in
be.telenet:maven2.plugin has a forked Java Ant task. I have to pass the
compile dependencies of the maven2.plugin project since the main class
called in the Java ant task is in one of these dependencies. Below is
the Ant build file of the mojo, followed by the console output if I
build a project that uses the mojo.

--- Ant file start ---
<project>
	<target name="wliSqlGen" depends="wliSqlGenDepend">
	</target>
	
	<target name="wliSqlGenDepend" unless="noSqlGen">
		<echo>Creating DDL Scripts for state tables</echo>
		<echo>NOTICE!!!! Use explicit commits if you are
building outside CI</echo>
		<mkdir dir="${dbaDir}/ddl" />
		<java
classname="be.telenet.tool.common.wliconfig.dbscript.DBScriptWriter"
fork="true"
			failonerror="true">
			<classpath>
				<pathelement
path="${maven.plugin.classpath}"/>
				<fileset
dir="${projectDir}/APP-INF/lib">
					<include name="**/*.jar" />
				</fileset>
			</classpath>
			<arg line="-src
${targetDirectory}/${targetEarName} -dest
${dbaDir}/ddl/${artifactId}_statetable.sql" />
		</java>
	</target>
</project> 
--- Ant file end ---

--- Console output start ---
wliSqlGenDepend:
     [echo] Creating DDL Scripts for state tables
     [echo] NOTICE!!!! Use explicit commits if you are building outside
CI
     [java] java.lang.NoClassDefFoundError:
be/telenet/tool/common/wliconfig/dbscript/DBScriptWriter
     [java] Exception in thread "main"
--- Console output end ---

Ringo
*************************************************************

Dit e-mail bericht inclusief eventuele ingesloten bestanden kan informatie bevatten die vertrouwelijk is en/of beschermd door intellectuele eigendomsrechten. Dit bericht is uitsluitend bestemd voor de geadresseerde(n). Elk gebruik van de informatie vervat in dit bericht (waaronder de volledige of gedeeltelijke reproductie of verspreiding onder elke vorm) door andere personen dan de geadresseerde(n) is verboden. Indien u dit bericht per vergissing heeft ontvangen, gelieve de afzender hiervan te verwittigen en dit bericht te verwijderen. 

This e-mail and any attachment thereto may contain information which is confidential and/or protected by intellectual property rights and are intended for the sole use of the addressees. Any use of the information contained herein (including but not limited to total or partial reproduction or distribution in any form) by other persons than the addressees is prohibited. If you have received this e-mail in error, please notify the sender and delete its contents.

Ce courriel et les annexes �ventuelles peuvent contenir des informations confidentielles et/ou prot�g�es par des droits de propri�t� intellectuelle. Ce message est adress� exclusivement � son (ses) destinataire(s). Toute utilisation du contenu de ce message (y compris la reproduction ou diffusion partielle ou compl�te sous toute forme) par une autre personne que le(s) destinataire(s) est formellement interdite. Si vous avez re�u ce message par erreur, veuillez pr�venir l'exp�diteur du message et en d�truire le contenu.

*************************************************************

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