Cannot generate runnable JAR for very simple Eclipse Maven project

I would like to generate a runnable JAR for my Eclipse Java projects. The JAR should contain all my code, with unmodified namespaces, classes, resources etc. My workspace is organized into a multitude of different projects.

When I right-click a project node in Project Explorer, and select “Run As > Maven install“, I get the following:

[INFO] Scanning for projects...
[INFO] ---------------------< foo.Project1:foo.Project1 >----------------------
[INFO] Building foo.Project1 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[WARNING] The POM for foo.Project2:foo.Project2:jar:0.0.1-SNAPSHOT is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  0.220 s
[INFO] Finished at: 2020-06-26T12:20:11+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project foo.Project1: Could not resolve dependencies for project foo.Project1:foo.Project1:jar:0.0.1-SNAPSHOT: Could not find artifact foo.Project2:foo.Project2:jar:0.0.1-SNAPSHOT -> [Help 1]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1]

foo.Project1 runs fine under Eclipse. Its pom.xml file is:

<project xmlns="" xmlns:xsi="" xsi:schemaLocation="">

(A ZIP of the two projects can be accessed here:

I tried the first solution suggested in How can I create an executable JAR with dependencies using Maven? (with 2300+ score) by:

1: adding the following in the build section of the pom.xml:


2: right-clicking the project node, then “Run As > Maven build…

3: defining “Goals” as: clean compile assembly:single, and hitting Run

Same errors.

What am I doing wrong?


If you want to use foo.Project2 as dependency, you need to build it first with clean install.

You always need to build a project before you can use it as dependency in the Maven build.

Eclipse cheats a bit by also allowing you to reference projects from the workspace and therefore allows you to run the program. But for the “real build”, you need to build everything in the right order.

Leave a Reply

Your email address will not be published. Required fields are marked *