Pergunta

My Ivy declaration is:

<dependency org="pmd" name="pmd" rec="4.2.5" conf="static-analysis->default">
     <exclude module="xom|xml-apis|jdom|dom4j|xercesImpl|ant|junit" 
      matcher="regexp" />
</dependency>

Right now I have that in Maven as:

<dependency>
   <groupId>pmd</groupId>
   <artifactId>pmd</artifactId>
   <version>4.2.5</version>
   <exclusions>
      <exclusion></exclusion>
   </exclusions>
</dependency>

I am not sure how get the exclusion right. I am also not sure how convert the conf attribute from Ivy either.

Foi útil?

Solução

If one concentrates only on dependency management, Maven and Ivy are tools with a similar mission, but quite different implementations.

I don't believe that regular expression exclusions are supported by Maven, although it appears some form of wildcard support was added in version 3, See MNG-3832

My advice is to adopt the simplest solution possible, so just explicitly list the dependencies you don't want:

<dependency>
   <groupId>pmd</groupId>
   <artifactId>pmd</artifactId>
   <version>4.2.5</version>
   <exclusions>
      <exclusion>
        <groupId>*</groupId>
        <artifactId>xom</artifactId>
      </exclusion>
      <exclusion>
        <groupId>*</groupId>
        <artifactId>xml-apis</artifactId>
      </exclusion>
      <exclusion>
        <groupId>*</groupId>
        <artifactId>jdom</artifactId>
      </exclusion>
      ..
      ..
   </exclusions>
</dependency>

Configuration mapping is very tricky to translate, because the concept does not exist in Maven. Maven has a fixed number of "scopes" whereas configurations are often used to simulate scopes, but are not as limited. For more background infomration I recommend

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top