You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by Michal Maczka <Mm...@cqs.ch> on 2003/01/16 13:21:37 UTC

RE: About dependency types (affects such bugs as MAVEN 196 and 19 7)


> -----Original Message-----
> From: Tim Stephenson [mailto:tim@thestephensons.me.uk]
> Sent: Thursday, January 16, 2003 9:19 AM
> To: Turbine Maven Developers List
> Subject: About dependency types (affects such bugs as MAVEN 
> 196 and 197)
> 
> 
> I have also had some problems in using ejb and war artifacts 
> due to the
> dependency 'type' tag and read with interest the discussion of the
> ArtifactFactory.
>

> Now I am not familiar with the internals of maven, so forgive 
> me if I am
> overlooking some things, but it seems the process of 
> downloading correct
> jars at least should be achievable as a plugin. The following 
> jelly script
> seems to do it pretty well in fact.
> 
>     <goal name="maven:prepare-local-repository"
>           description="Compensate for the maven bug that 
> fails to download
> non-jar artifacts">
> 
>       <u:tokenize var="listOfRepoRemote" delim=",
> ">${maven.repo.remote}</u:tokenize>
>       <j:forEach var="repo" items="${listOfRepoRemote}">
>         <j:forEach var="dep" items="${pom.dependencies.iterator()}">
>           <j:set var="artifactType" value="${dep.getType()}"/>
>           <j:if test="${empty(artifactType)}">
>               <j:set var="artifactType" value="jar"/>
>           </j:if>
>           <mkdir
> dir="${maven.home}/repository/${dep.getProjectId()}/${artifact
> Type}s"/>
>           <get
> src="${repo}/${dep.getProjectId()}/${artifactType}s/${dep.getP
> rojectId()}-${
> dep.getVersion()}.${artifactType}"
> 
> dest="${maven.home}/repository/${dep.getProjectId()}/${artifac
> tType}s/${dep.
> getProjectId()}-${dep.getVersion()}.${artifactType}"
>                verbose="true"
>                usetimestamp="true"
>                ignoreerrors="true"/>
>         </j:forEach>
>       </j:forEach>
>     </goal>
> 
> If this was made a very early dependency for maven 'sessions' 
> then I would
> think all the plugins that depend on non-jar artifacts should 
> find them
> exactly where they expect by the time they run.
> 
> I took the liberty of naming this goal in the maven 
> namespace, but hopefully
> it can find a home somewhere?
> 
> Tim
> 


Which version of Maven are you using? In CVS HEAD version this already
works.

In my opinion there are two more issues :

1. Adding to build class non jar artifacts 
   This can be probably solved/hacked by adding preGoal for java:compile and
updated build classpath
2. Handle the artifact which have different type and file extension 
   This can be solved by using <jar> tag in your dependency descriptor.
   I called for renaming <jar> to <file> as name <jar> is simply misleading
and not accurate...

Anyway working with war artifacts is already smooth. 
The are just problems with ejbs...

regards

Michal