java.lang.ClassNotFoundException on Maven dependencies
<p>We have a set of Spring Boot applications organized as microservices running successfully for a few months. We used Sprig Boot 1.3.3.</p>

<p>Now we have a problem with maven build process switching to Spring Boot 1.4.2. We are developing microservice based software architecture. We have <strong>core.common</strong> service which is referenced by other services using dependecies like this:</p>

<pre><code>&lt;dependencies&gt;
    &lt;dependency&gt;
        &lt;groupId&gt;com.group&lt;/groupId&gt;
        &lt;artifactId&gt;core.common&lt;/artifactId&gt;
        &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
        &lt;scope&gt;compile&lt;/scope&gt;
    &lt;/dependency&gt;
&lt;/dependencies&gt; 
</code></pre>

<p>This service is responsible for providing common classes and methods needed to each of other services. </p>

<p>We also use separate service (<strong>root.service</strong>) to build <strong>all other services</strong> and to package them into <code>jar</code> files. This is the part of <code>pom.xml</code> from that <strong>root.service</strong>:</p>

<pre><code>&lt;parent&gt;
        &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
        &lt;artifactId&gt;spring-boot-starter-parent&lt;/artifactId&gt;
        &lt;version&gt;1.4.2.RELEASE&lt;/version&gt;
        &lt;relativePath /&gt; &lt;!-- lookup parent from repository --&gt;
    &lt;/parent&gt;

    &lt;modules&gt;
        &lt;module&gt;../core.adminservice&lt;/module&gt;
        &lt;module&gt;../core.locationservice&lt;/module&gt;
        &lt;module&gt;../core.reportservice&lt;/module&gt;
        &lt;module&gt;../core.userservice&lt;/module&gt;
        &lt;module&gt;../core.notificationservice&lt;/module&gt;
        &lt;module&gt;../core.trackingservice&lt;/module&gt;
        &lt;module&gt;../core.mappingservice&lt;/module&gt;
        &lt;module&gt;../core.common&lt;/module&gt;
    &lt;/modules&gt;
</code></pre>

<p>Until switched to Spring Boot 1.4.2 version we were able to do <code>mvn clean install</code> over <strong>root.service</strong> to test and build the rest of the services from <strong>modules</strong> specification. </p>

<p>After switching to Spring Boot 1.4.2 version, when I try to execute <code>mvn clean install</code> in <strong>root.service</strong> I am getting <code>java.lang.ClassNotFoundException</code>. Exception message says that none of the services form <strong>modules</strong> specification cannot find any of classes from <strong>core.common</strong> service used in particular service from <strong>modules</strong>.
When I try to run <code>mvn compile</code> or <code>mvn test</code> everything runs just fine and I get successful builds and tests. When I try to run services from <strong>eclipse</strong> also everything is just fine.</p>

<p>Do you have any ideas? Please help.</p>

<p><strong>EDIT</strong>
Full stack trace for one use case:</p>

<pre><code>Running com.blockpeek.core.adminservice.tests.services.AdminServiceTest
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.002 sec &lt;&lt;&lt; FAILURE! - in com.blockpeek.core.adminservice.tests.services.AdminServiceTest
initializationError(com.blockpeek.core.adminservice.tests.services.AdminServiceTest)  Time elapsed: 0.002 sec  &lt;&lt;&lt; ERROR!
java.lang.NoClassDefFoundError: com/blockpeek/core/common/services/AbstractCRUDService
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    at java.lang.Class.getDeclaredFields0(Native Method)
    at java.lang.Class.privateGetDeclaredFields(Class.java:2583)
    at java.lang.Class.getDeclaredFields(Class.java:1916)
    at org.junit.runners.model.TestClass.getSortedDeclaredFields(TestClass.java:77)
    at org.junit.runners.model.TestClass.scanAnnotatedMembers(TestClass.java:70)
    at org.junit.runners.model.TestClass.&lt;init&gt;(TestClass.java:57)
    at org.junit.runners.ParentRunner.createTestClass(ParentRunner.java:88)
    at org.junit.runners.ParentRunner.&lt;init&gt;(ParentRunner.java:83)
    at org.junit.runners.BlockJUnit4ClassRunner.&lt;init&gt;(BlockJUnit4ClassRunner.java:65)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.&lt;init&gt;(SpringJUnit4ClassRunner.java:138)
    at org.springframework.test.context.junit4.SpringRunner.&lt;init&gt;(SpringRunner.java:49)
    at sun.reflect.GeneratedConstructorAccessor2.newInstance(Unknown Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:104)
    at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:86)
    at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)
    at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:26)
    at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)
    at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:33)
    at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:283)
    at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:173)
    at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:153)
    at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:128)
    at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:203)
    at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:155)
    at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103)
Caused by: java.lang.ClassNotFoundException: com.blockpeek.core.common.services.AbstractCRUDService
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    at java.lang.Class.getDeclaredFields0(Native Method)
    at java.lang.Class.privateGetDeclaredFields(Class.java:2583)
    at java.lang.Class.getDeclaredFields(Class.java:1916)
    at org.junit.runners.model.TestClass.getSortedDeclaredFields(TestClass.java:77)
    at org.junit.runners.model.TestClass.scanAnnotatedMembers(TestClass.java:70)
    at org.junit.runners.model.TestClass.&lt;init&gt;(TestClass.java:57)
    at org.junit.runners.ParentRunner.createTestClass(ParentRunner.java:88)
    at org.junit.runners.ParentRunner.&lt;init&gt;(ParentRunner.java:83)
    at org.junit.runners.BlockJUnit4ClassRunner.&lt;init&gt;(BlockJUnit4ClassRunner.java:65)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.&lt;init&gt;(SpringJUnit4ClassRunner.java:138)
    at org.springframework.test.context.junit4.SpringRunner.&lt;init&gt;(SpringRunner.java:49)
    at sun.reflect.GeneratedConstructorAccessor2.newInstance(Unknown Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:104)
    at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:86)
    at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)
    at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:26)
    at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)
    at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:33)
    at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:283)
    at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:173)
    at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:153)
    at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:128)
    at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:203)
    at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:155)
    at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103)
</code></pre>

<p>Maven Version:</p>

<pre><code>$ mvn -version
Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T17:41:47+01:00)
Maven home: C:\Program Files\apache-maven-3.3.9
Java version: 1.8.0_101, vendor: Oracle Corporation
Java home: C:\Program Files\Java\jdk1.8.0_101\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "dos"
</code></pre>

<p><strong>EDIT 2:</strong> This is what I get if i run <code>mvn -e clean install</code>:</p>

<pre><code>[ERROR] -&gt; [Help 1]                                                                                                                             
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.6.0:compile (def
ult-compile) on project core.adminservice: Compilation failure                                                                                  
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)                                                      
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)                                                      
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)                                                      
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)                             
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)                              
        at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)                
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)                                              
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)                                                                       
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)                                                                       
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)                                                                         
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)                                                                             
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)                                                                              
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)                                                                                
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)                                                                          
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)                                                        
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)                                                
        at java.lang.reflect.Method.invoke(Method.java:498)                                                                                     
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)                                                  
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)                                                          
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)                                                
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)                                                            
Caused by: org.apache.maven.plugin.compiler.CompilationFailureException: Compilation failure                                                    
        at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:1029)                                        
        at org.apache.maven.plugin.compiler.CompilerMojo.execute(CompilerMojo.java:137)                                                         
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)                                    
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)                                                      
        ... 20 more                                                                                                                             
[ERROR]                                                                                                                                         
[ERROR] Re-run Maven using the -X switch to enable full debug logging.                                                                          
[ERROR]                                                                                                                                         
[ERROR] For more information about the errors and possible solutions, please read the following articles:                                       
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException                                                          
[ERROR]                                                                                                                                         
[ERROR] After correcting the problems, you can resume the build with the command                                                                
[ERROR]   mvn &lt;goals&gt; -rf :core.adminservice  
</code></pre>