1

I am using Maven for a java project I'm working on because I wish to include a library for graph structures (jgrapht) which cannot be used without Maven (afaik), but I have no used Maven before so I am not very familiar with how to use it.

I downloaded and unzipped the files for jgrapht and attempted to execute the command provided on the jgrapht github to create a project which includes jgrapht. However, when I execute this command I get the error

"[ERROR] Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:3.2.1:generate (default-cli) on project ever-dark: The desired archetype does not exist (org:maven-archetype-jgrapht:1)"

I noticed that the command provided on the github has the wrong version number, so I tried correcting that, but there was no change.

The command given is

"mvn archetype:generate -DarchetypeGroupId=org.jgrapht.archetypes -DarchetypeArtifactId=maven-archetype-jgrapht -DarchetypeVersion=1.2.0"

2 Answers2

1

I think I found a solution. If I simply run 'mvn archetype:generate" it will show a long list, of which I can simply find and select jgrapht. This seems to have worked for now :)

0

This is not really a JGraphT question but more of a "how do I set up a Java project with external dependencies" question. There's at least 3 different ways to include JGraphT into your project:

  1. Create a maven project and add JGraphT as a dependency.
  2. Create a non-maven project, download JGraphT from our website and add the jgrapht JAR to your project's classpath.
  3. Create a non-maven project, download the JGraphT source from our github page and import the source directly into your project. There's not many good use-cases for this approach, so this is generally not what we would recommend.

In general, have a look at our How to use JGraphT as a dependency in your projects wiki page.

Joris Kinable
  • 2,232
  • 18
  • 29