Maven: POM modules and submodules hierarchy - maven

My project is structured like this:
.
|--module
| `-- pom.xml
| --submodule
| `-- pom.xml
`-- pom.xml
The POM's (simplified):
Project:
<project>
<modelVersion>4.0.0</modelVersion>
<artifactId>project</artifactId>
<name>Project</name>
<groupId>org.myorg</groupId>
<version>1.0.6-SNAPSHOT</version>
<packaging>pom</packaging>
<modules>
<module>module</module>
</modules>
(...)
</project>
Module:
<project>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.myorg</groupId>
<artifactId>project</artifactId>
<version>1.0.6-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>module</artifactId>
<name>Module</name>
<groupId>org.myorg</groupId>
<version>1.0.6-SNAPSHOT</version>
<packaging>pom</packaging>
<modules>
<module>submodule</module>
</modules>
(...)
</project>
Submodule:
<project>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.myorg</groupId>
<artifactId>module</artifactId>
<version>1.0.6-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>submodule</artifactId>
<name>Submodule</name>
<groupId>org.myorg</groupId>
<version>1.0.6-SNAPSHOT</version>
<packaging>jar</packaging>
(...)
</project>
When run maven install in POM's project or module the project is built sucessfully. But, when run in submodule occours this error:
Failed to execute goal on project submodule: Could not find artifact org.myorg:project:pom:1.0.6-SNAPSHOT
Why my submodule not find the POM project? The relative path is specified.

The first thing which i noticed is that every sub-module which has a parent contains the line:
<relativePath>../pom.xml</relativePath>
which is useless, cause it's default in maven or in other word just remove it.
Furthermore in a multimodule build you shouldn't define the version. In case if the groupId is always the same you can omit the groupId as well, cause the current module inherits the version from it's parent.
module: pom.xml
<project>
<parent>...
</parent>
<artifactId>module</artifactId>
<packaging>pom</packaging>
<name>Module</name>
<modules>
<module>submodule</module>
</modules>
(...)
</project>
Apart from that you can't go into a sub-module and call
mvn install
If you like to install a separate module of a multi-module build you should use a thing like this:
mvn -amd -pl submodule install
which will do what you like to do, but usually you should install a full mulit-module build unless you exactly know what you are doing.
The options -amd is an abbrevation for --also-make-dependents. The -pl is an abbreviation for --projects to define a list of project which should be made during the call.

First you need to run mvn install on root project it will creates the artifact in your local maven repo. From the second time on wards you can run sub module only. If you don't run on root project maven wont create any artifact for your project so when you run on sub module it unable to find the artifact from the maven repo.

Related

Exclude parent and its children or modules in maven command executing lifecycle

Executing mvn clean install -pl !Parent2 does NOT apply life-cycles on Parent2 children's nor modules. While all sub-projects are in same level I try to combine Project2 & Project2 into one parent Parent2 to exclude it only from many life-cycles. How could this be done ?
Similarly mvn clean install -pl Parent2 only applied on Parent2 without its children/modules !!
Here are the latest POMs I reached to structure. Noting that my only restriction is keeping folders of all in same level (under Parent1)
Parent1
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>any</groupId>
<artifactId>Parent1</artifactId>
<version>whatever</version>
<packaging>pom</packaging>
<modules>
<module>Parent2</module>
<module>Project1</module>
</modules>
</project>
Parent2
<project>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>any</groupId>
<artifactId>Parent1</artifactId>
<version>whatever</version>
</parent>
<packaging>pom</packaging>
<artifactId>Parent2</artifactId>
<modules>
<module>../Project2</module>
<module>../Project3</module>
</modules>
</project>
Project1
<project>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>any</groupId>
<artifactId>Parent1</artifactId>
<version>whatever</version>
</parent>
<packaging>jar</packaging>
<artifactId>Project1</artifactId>
</project>
Project2 (Project3 is exactly the same)
<project>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>any</groupId>
<artifactId>Parent2</artifactId>
<version>whatever</version>
<relativePath>../Parent2</relativePath>
</parent>
<packaging>jar</packaging>
<artifactId>Project2</artifactId>
</project>
I'm interested in applying the exclusion on sub-modules as well. However mvn clean install -pl Parent2 -amd works as wanted & expected applying clean & install into Parent2, Project2 & Project3. However, as pointed by Pawl's comment and according to MNG-5230 issue
Nested modules are not excluded by parent module. The exclusion method mimics the inclusion method and its matcher does not support wildcards etc. So to cascade exclusion would necessitate an extra flag like -amd.
The dependency graph is filtered in the following order when using
-pl:
1. included projects + possibly upstream and downstream
2. excluded projects
3. skipping for resume projects
So it should be possible to directly exclude nested modules as they should be present in the intial dependency graph before filtering starts.
So excluding nested modules using their parent/holder pom is not possible. Here is how I worked around it to solve this. Simply using profiles and completely removing sub-modules outside profiles definition solved it.
In short is using profiles to identify modules with noting that modules identified outside profiles are shared no matter what profile is activated
Example as of OP projects naming followed
Parent1 (Added Project4 as same as Project1 just for clarifying)
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>Parent1</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<profiles>
<profile>
<id>multi-modules-profile</id>
<modules>
<module>Parent2</module>
<module>Project2</module>
<module>Project3</module>
</modules>
</profile>
<profile>
<id>simple-module-profile</id>
<modules>
<module>Project1</module>
</modules>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
</profile>
</profiles>
<modules>
<module>Project4</module>
</modules>
Project1 (& Project4 is similar)
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.example</groupId>
<artifactId>Parent1</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>Project1</artifactId>
Parent2
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.example</groupId>
<artifactId>Parent1</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>Parent2</artifactId>
<packaging>pom</packaging>
Project2 (& Project3 is similar)
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.example</groupId>
<artifactId>Parent2</artifactId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>../Parent2</relativePath>
</parent>
<artifactId>Project2</artifactId>
Now running mvn clean would apply on Parent1, Project1 & Project4 because Project1 is in profile that is activated by default (without specifying profile during the execution). This has same effect running mvn clean -P simple-module-profile because Project4 is shared outside profiles definitions.
Finally, running mvn clean -P multi-modules-profile will be applied to Parent1, Project4, Parent2, Project2 & Project3 leaving Project1 out which is desired. Notice Project4 is always in because it's outside profiles definitions.
EDIT: the answer applies only to:
Similarly mvn clean install -pl Parent2 only applied on Parent2 without its children/modules !!
Use mvn -pl Parent2 -amd clean install to build Parent2 and all of it's modules.
See the reference: https://books.sonatype.com/mvnref-book/reference/_using_advanced_reactor_options.html#_making_project_dependents

Defer properties evaluation in Maven sub-modules

I have some problems trying to run maven in a 3-level multi-module project.
The first level is the super-pom, which defines antrun tasks. It is located in an external repository.
The second one refers to the super-pom, and only include the definition of submodules. Let's say it is in /project
The third level contains the sub-module and its items are located at /project/moduleN.
At the first level, AntRun tasks includes calls to "${project.basedir}".
When I use maven, I go to the second level pom folder and run mvn clean install.
As it only includes sub-modules, it tries to compile them but ${project.basedir} has already been evaluated as being /project, and not /project/moduleN.
I would like to defer the evaluation of those expressions in order to replace them with values from my sub-modules, and not from the pom including them, but I can't find a way to do so.
Here are excerpts from POM files to understand what's going on :
Super POM
<groupId>org.example</groupId>
<artifactId>superpom</artifactId>
<packaging>pom</packaging>
...
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
...
<exec dir="${project.basedir}" ...></exec>
</plugin>
</plugins>
Project POM
<parent>
<groupId>org.example</groupId>
<artifactId>superpom</artifactId>
</parent>
<groupId>org.example</groupId>
<artifactId>projectPom</artifactId>
<packaging>pom</packaging>
<modules>
<module>module1</module>
<module>module2</module>
</modules>
Modules POM
<parent>
<groupId>org.example</groupId>
<artifactId>projectPom</artifactId>
</parent>
<groupId>org.example</groupId>
<artifactId>moduleNPom</artifactId>
<packaging>jar</packaging>

How do I setup maven sub-projects with inter-dependencies?

I'm having a hard time setting up a set of related maven projects with interdependencies between them.
Here's my simplified case:
pom.xml -- parent pom
\base\
pom.xml
src\main\java\Base.java -- this is just a simple class
\derived\
pom.xml
src\main\java\Derived.java -- this is a simple class that needs Base class to compile successfully, and has a main function
My goals are:
be able to compile, on my machine, all projects:
i.e. mnv clean compile is successful in \
be able to compile, on my machine, just one project:
i.e. mnv clean compile is successful in \base\ and \derived\ (though this may not work by design: Inter Project Dependencies in Maven)
[edit: found the answer for this one: base needs to be published locally before derived in compiled: i.e. in \base, do mvn clean compile install instead of doing just doing mvn clean compile. Once this is done, doing mvn clean compile in \derived works fine. Still, it would be great to do this without touching global state, i.e. without having to install base -- so if anyone knows a way of achieving this, please add it as an answer]
be able to run derived project on my machine (mvn exec:run or equivalent) direcly from the source tree:
i.e. mvn exec:run in \derived\ should compile (if needed) and run the derived.jar
the "shared component" use case: push the base artifact to the shared repository, where other people can consume it as a maven dependency (i.e. compile time dependency):
i.e. mvn clean compile ??? will push this to the shared repository specified in ~/.m2/config.xml
the "image directory" use case: push the derived artifact and its depedencies to a local directory, where it can be run via "java -jar ..." or it can exposed as an ftp/http share for other people to get it. I.e., use cases like those:
mvn clean compile ??? will push derived.jar and dependencies (like base.jar) to ~/.m2/maven.repo/.../derived or equivalent, and then I can cd ~/.m2/maven.repo/.../derived and run java -jar derived.jar to run it.
mvn clean compile ??? will push base.jar to ~/.m2/maven.repo/.../base (or derived.jar to its corresponding dir), which is already exposed as a download point via local web or ftp server.
How do I do the goals above?
Here's the relevant section from parent pom:
...
<modelVersion>4.0.0</modelVersion>
<groupId>com.foo</groupId>
<artifactId>parentpom</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<name>parentpom</name>
<modules>
<module>base</module>
<module>derived</module>
</modules>
...
Here's the relevant section from base pom.xml:
...
<parent>
<groupId>com.foo</groupId>
<artifactId>parentpom</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>com.foo.base</groupId>
<artifactId>base</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>base</name>
...
Here's the relevant section from derived pom.xml:
...
<parent>
<groupId>com.foo</groupId>
<artifactId>parentpom</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>com.foo.derived</groupId>
<artifactId>derived</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>derived</name>
<dependencies>
<dependency>
<groupId>com.foo</groupId>
<artifactId>base</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
</dependencies>
...
Thank you in advance for your help.
Your parent pom looks good but your module/derived poms don't: There are several issues which will produce some problems etc.
First you are using different groupId's for the derived/base module. If you have a multi-module build you shouldn't do this. Furthermore, the version of derived/base is inherited by the parent and shouldn't be set explicit which means you should have something like the following:
<modelVersion>...</...>
...
<parent>
<groupId>com.foo</groupId>
<artifactId>parentpom</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>base</artifactId>
<packaging>jar</packaging>
<name>base</name>
The groupId is usually inherited. But sometimes you have a larger number of modules that may be sub-modules of sub-modules which results in a structure like this:
+--- parent (pom.xml)
+--- mod1 (pom.xml)
+--- mod11 (pom.xml)
+--- mod12 (pom.xml)
+--- mod2 (pom.xml)
In Such cases, the mod1 itself is a a pom packaging module:
<modelVersion>...</...>
...
<groupId>com.company.project<groupId>
<artifactId>parent</artifactId>
<packaging>pom</packaging>
<modules>
<module>mod1</module>
<module>mod2</module>
</modules>
mod1:
<parent>
<groupId>com.company.project<groupId>
<artifactId>parent</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<groupId>com.company.project.mod1</groupId>
<artifactId>mod1</artifactId>
<packaging>pom</packaging>
<modules>
<module>mod11</module>
<module>mod12</module>
</modules>
mod11:
<parent>
<groupId>com.company.project.mod1</groupId>
<artifactId>mod1</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>mod11</artifactId>
<packaging>pom</packaging>
<modules>
<module>mod11</module>
<module>mod12</module>
</modules>
If you need to make a dependency between modules the solution is:
<parent>
<groupId>com.company.project.mod1</groupId>
<artifactId>mod1</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>mod11</artifactId>
<packaging>jar</packaging>
<dependencies>
<dependency>
<!-- This shouldn't be a dep which is packaging: pom -->
<groupId>${project.groupId}</groupId>
<artifactId>mod2</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
To compile the whole project with all sub modules in one just go to parent folder and:
mvn clean package
will compile etc. If you like to compile only a single project you can do this by (from parent):
mvn -pl mod1
which will work only if you have installed the whole project once before. Another solution is:
mvn -am -pl mod1
To make the artifacts acessible for others the simplest solution is to install a repository manager and do:
mvn deploy
All others can use and artifact as a SNAPSHOT dependency.

Maven versioning of multi-module projects with parent POM

This is a slightly different version of this previous question, in that I have separate multi-module and parent POMs: In a Maven project, how can I automatically update the version all child modules, plus the parent?
I am trying to update my POMs to go from a development snapshot version to a released version number. I have googled the issue to death, tried the release and version plug-in, and nothing seems to be able to handle my fairly simple setup.
Following published Maven best practices, and trying not to duplicate information when I can avoid to, I ended up with the structure below for my multi-module project.
There is a single version defined by the common pom-parent.xml; and B depends on A.
I find it a bit surprising that the standard plug-ins can't handle what seems to be a fairly basic setup, am I missing something?
None of the workarounds I have come up with are completely satisfactory:
define the product version as a property is a bit flaky, the same module source could get different versions because of a user settings.xml or other trick
merge the root pom.xml and pom-parent.xml and move the product-wide build steps I currently maintain in the root pom into a dedicated module; and hope that the std plug-ins will then work... not tried.
Any suggestion?
root/pom-parent.xml: parent of all the POMs below
<project...>
<groupId>acme</groupId>
<artifactId>ParentPom</artifactId>
<packaging>pom</packaging>
<version>1.0.0-SNAPSHOT</version>
root/pom.xml: multi-module projects with A and B as submodules
<project ...>
<parent>
<groupId>acme</groupId>
<artifactId>ParentPom</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<groupId>acme</groupId>
<artifactId>Product</artifactId>
<packaging>pom</packaging>
<modules>
<module>A</module>
<module>B</module>
</modules>
root/A/pom.xml:
<project ...>
<parent>
<groupId>acme</groupId>
<artifactId>ParentPom</artifactId>
<relativePath>../parent-pom.xml</relativePath>
<version>1.0.0-SNAPSHOT</version>
</parent>
<groupId>acme</groupId>
<artifactId>A</artifactId>
<packaging>jar</packaging>
root/B/pom.xml:
<project ...>
<parent>
<groupId>acme</groupId>
<artifactId>ParentPom</artifactId>
<relativePath>../parent-pom.xml</relativePath>
<version>1.0.0-SNAPSHOT</version>
</parent>
<groupId>acme</groupId>
<artifactId>B</artifactId>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>acme</groupId>
<artifactId>A</artifactId>
<version>1.0.0-SNAPSHOT</version>
</dependency>
</dependencies>
If you have a structure like the following:
root
+-- pom.xml (1.0-SNAPSHOT)
!
+-- module1
! +-- pom.xml (1.0-SNAPSHOT)
+-- module2
+-- pom.xml (1.0-SNAPSHOT)
all modules (module1 and module2) using root as their parent like this:
<parent>
<groupId>xxx</groupId>
<artifactId>xxx</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
If you want to factor out other default setup like pluginManagement or dependencyManagement for other projects as well you have to use a separate parent pom which must be a separate maven project which contains only the pom.xml. Furthermore this project will be deployed and released separately. If you do so you can use this as parent in the root pom of the above structure.
If you like to make a release you will go simply into the root folder of the above structure and the version number etc. will automatically incremented.
mvn -B release:prepare release:perform

Three-level pom (company - project - module) - problems with module project(s)

I am using Eclipse Indigo with m2e (which connects to an external binary of Maven 3.0.3).
Right now, the intended structure of my application is as follows:
Company-parent
--Project-parent
----Module1
----Module2
----ModuleN
I set up my poms such that Company-parent is the project of Project-parent, and Project-parent is the parent of all of the modules. The company-parent and the project-parent seem to be ok. Both are of packaging type POM.
The third level is where I start to encounter problems. I get a variety of maven errors, and all kinds of weird behavior, even with the simplest of module projects defined.
Company parent:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.scoresecret</groupId>
<artifactId>scs-global-parent</artifactId>
<version>1</version>
<packaging>pom</packaging>
</project>
Project parent:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>scs-global-parent</artifactId>
<groupId>com.scoresecret</groupId>
<version>1</version>
</parent>
<artifactId>scs-model-parent</artifactId>
<groupId>com.scoresecret.model</groupId>
<version>1.0-SNAPSHOT</version>
<packaging>pom</packaging>
<modules>
<module>scs-model-core</module>
</modules>
</project>
Module pom:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>scs-model-parent</artifactId>
<groupId>com.scoresecret.model</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>scs-model-core</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>jar</packaging>
I can't do "Maven -> Update Project Configuration", because when I do, I get this error:
Failure to find org.apache.maven.plugins:maven-resources-plugin:pom:2.4.3 in https://my.archiva.location/archiva/repository/internal was cached in the local repository, resolution will not be reattempted until the update interval of scs.internal has elapsed or updates are forced pom.xml /scs-model-core line 1 Maven Configuration Problem
Some other errors I'm receiving:
Could not calculate build plan: Plugin org.apache.maven.plugins:maven-resources-plugin:2.4.3 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.4.3 pom.xml /scs-model-core line 1 Maven Build Problem
Also receiving an error about m2e ignoring one of my plugin goals (from the company level pom) within the module. Am I missing something obvious here? Help!
Thanks :)
you shouldn't have the artifacts located like you described in a directory structure.
+-- Company-parent (pom.xml)
+-- Project-parent (pom.xml)
+----Module1 (pom.xml)
+----Module2 (pom.xml)
+----ModuleN (pom.xml)
To make a real good use of you company-parent (pom.xml) it should be helt into a separated area in version control and released separately in your repository manager (nexus, artifactory, archiva...). This will result in the following structure:
+-- Company-parent (pom.xml) (Separate Project)
The company-parent should be released as often as needed via the release-plugin. Lets assume we have released version 1.0 of the company-parent. The reason to have it separated is, cause the company-parent is used by many projects and not only by a single project.
and the real projects should be put into a separate folder (also in version control):
+-- Project-parent (pom.xml)
+----Module1 (pom.xml)
+----Module2 (pom.xml)
+----ModuleN (pom.xml)
So to use the company-parent in your project the project-parent has to look like:
<project....>
<modelVersion>4.0...</modelVersion>
<parent>
<artifactId>company-parent</artifactId>
<groupId>com.company.base</groupId>
<version>1.0</version>
</parent>
<packaging>pom</packaging>
<groupId>com.company.project1</groupId>
<artifactId>project-parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
...
<dependencyManagement>
<!-- Project specific dependencies -->
</dependencyManagement>
<build>
<pluginManagement>
<plugins>
<!-- Project specific plugins. Better use them of the company pom -->
</plugins>
</pluginManagement>
</build>
<modules>
<module>module1</module>
<module>module2</module>
<module>moduleN</module>
</modules>
..
Now let us take a look into a module which should look like this:
<project....>
<modelVersion>4.0...</modelVersion>
<parent>
<artifactId>project-parent</artifactId>
<groupId>com.company.project1</groupId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<packaging>jar</packaging>
<artifactId>module1</artifactId>
<dependencies>...</dependencies>
<build>..</build>
You should reference the parent pom with explicit path:
<parent>
<artifactId>scs-model-parent</artifactId>
<groupId>com.scoresecret.model</groupId>
<version>1.0-SNAPSHOT</version>
<relativePath>../pom.xml</relateivePath>
</parent>
Otherwise, you need to reinstall the parent pom into the repository every time you change it.
Sounds like maven isn't able to download a plugin (org.apache.maven.plugins:maven-resources-plugin:pom:2.4.3) from the repository https://my.archiva.location/archiva/repository/internal
Failure to find org.apache.maven.plugins:maven-resources-plugin:pom:2.4.3 in https://my.archiva.location/archiva/repository/internal was cached in the local repository, resolution will not be reattempted until the update interval of scs.internal has elapsed or updates are forced pom.xml /scs-model-core line 1 Maven Configuration Problem
If you browse to this URL in a browser, does it exist? I see it's using https - do you need a client cert or some form of basic auth credentials to access this url?
What are your current settings in your .m2/settings.xml show for repositories? Are you behind a company firewall or not connected to the internet which is forcing you to connect to a non-standard maven central repository?
It turns out, that my local repo contained files which ended with the extention ".lastUpdated" ... this was because I was having problems with authentication when I tried encrypting my maven passwords, so it wasn't downloading the dependencies. I deleted those files and simply ran "Maven > Update Dependencies" and it worked no problem, downloading the missing resources from my artifact repository.

Resources