Hi Bindul,

sadly it's not that easy (or it's so easy that I don't see the solution...). As a default and for compatibility reasons I'd like to declare the dependencies of the Neo4j 2.x artifacts for my Maven plugin:

- org.neo4j:neoj
- org.neo4j.app:neo4j-server
- org.neo4j.app:neo4j-server:static *

For a user it would be possible to override only the first two dependencies with the Neo4j 3.x versions: the third artifact (*) does not exist for Neo4j 3.x (the Neo guys merged the static content into neo4j-server.jar, i.e. into the main artifact without classifier). In this case I would need to exclude "org.neo4j.app:neo4j-server:static" which is still there as a 2.x artifact and pulls in some other deps that are conflicting with the 3.x stuff. Any idea?

Cheers,

Dirk

------ Originalnachricht ------
Von: "Bindul Bhowmik" <bindulbhow...@gmail.com>
An: "Maven Developers List" <dev@maven.apache.org>; "Dirk Mahler" <dirk.mah...@buschmais.com>
Gesendet: 12.04.2017 20:28:16
Betreff: Re: Configurable Dependencies for Maven Plugins?

Dirk,

On Wed, Apr 12, 2017 at 7:06 AM, Dirk Mahler <dirk.mah...@buschmais.com> wrote:
 Hi all,

 is there a way to provide users of a plugin a way of easily switching
 dependencies of it?

Background: I'm developing a Maven plugin (jQAssistant) that comes with a dependency to Neo4j (graph database). Currently I'm using Neo4j 2.3.x which has been compiled against Java 7 but I would like to offer users of the Maven plugin an easy option to use the newer Neo4j 3.x releases which offer
 some new features but require Java 8.

I know that it's possible to overwrite an existing dependency for a plugin,
 e.g.

 <plugin>
   <groupId>com.buschmais.jqassistant</groupId>
   <artifactId>jqassistant-maven-plugin</artifactId>
   <version>1.3.0</version>
   <dependencies>
     <dependency>
       <groupId>org.neo4j</groupId>
       <artifactId>neo4j</artifactId>
       <version>3.1.3</version> <!-- instead of the default 2.3.10 -->
     </dependency>
   </dependencies>
 </plugin>

As long as your code can handle the different versions of the
dependency, I think this is absolutely doable. In fact the Maven
Checkstyle Plugin uses the same approach to allow upgrading checkstyle
versions without upgrading the plugin version [1].


The problem is that in my case the old version comes with another set of
 dependencies than the new one:

I do not think this will be a problem.


 old:

 <dependencies>
      <dependency>
          <groupId>org.neo4j</groupId>
          <artifactId>neo4j</artifactId>
          <version>2.3.10</version>
      </dependency>
      <dependency>
          <groupId>org.neo4j.app</groupId>
          <artifactId>neo4j-server</artifactId>
          <version>2.3.10</version>
      </dependency>
      <dependency>
          <groupId>org.neo4j.app</groupId>
          <artifactId>neo4j-server</artifactId>
          <classifier>static-web</classifier>
          <version>2.3.10</version>
      </dependency>
 </dependencies>

 new:

 <dependencies>
      <dependency>
          <groupId>org.neo4j</groupId>
          <artifactId>neo4j</artifactId>
          <version>3.1.3</version>
      </dependency>
      <dependency>
          <groupId>org.neo4j.app</groupId>
          <artifactId>neo4j-server</artifactId>
          <version>3.1.3</version>
      </dependency>
 </dependencies>

 Is there a good way to deal with it such that a user of the
 jqassistant-maven-plugin can easily switch between both variants?

 Cheers,

 Dirk

 Senior Consultant IT
 buschmais GbR


- Bindul

[1] http://maven.apache.org/plugins/maven-checkstyle-plugin/examples/upgrading-checkstyle.html


 -----------------------------------------------------------------
 Inhaber Torsten Busch, Frank Schwarz, Dirk Mahler, Tobias Israel
 Adresse buschmais GbR, Leipziger Straße 93, 01127 Dresden
 Telefon  +49 (0) 351 3209 23-0
 Fax      +49 (0) 351 3209 23-29
 Mobil    +49 (0) 177 3137411
 E-Mail   dirk.mah...@buschmais.com
 Internet http://www.buschmais.de
 -----------------------------------------------------------------

 Diese E-Mail enthält vertrauliche undoder rechtlich geschützte
 Informationen. Wenn Sie diese E-Mail irrtümlich erhalten haben,
 bitten wir Sie diese E-Mail umgehend zu löschen. Das unerlaubte
 Kopieren sowie die unbefugte Weitergabe dieser E-Mail ist nicht
 gestattet.

 This e-mail may contain confidential or privileged information. If
 you are not the intended recipient we kindly request you to delete
 this e-mail immediately. Any unauthorized copying, disclosure or
 distribution of the material in this e-mail is strictly forbidden.



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



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

Reply via email to