You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by Tim Stephenson <ti...@thestephensons.me.uk> on 2003/01/16 09:19:10 UTC

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()}/${artifactType}s"/>
          <get
src="${repo}/${dep.getProjectId()}/${artifactType}s/${dep.getProjectId()}-${
dep.getVersion()}.${artifactType}"

dest="${maven.home}/repository/${dep.getProjectId()}/${artifactType}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