I am trying to build jar file of my app based on Maven. So I need to not include external jar library's to my build. I need that my app gives this external dependency in runtime from local maven repository or from local folder, those will contain these external libraries. I configure my pom file for this dependency like this:
<profiles>
        <profile>
            <id>compile</id>
            <dependencies>
                <dependency>
                    <groupId>groupId</groupId>
                    <artifactId>some.artifact</artifactId>
                    <version>1.0</version>
                </dependency>
            </dependencies>
        </profile>
and trying to run this jar with this prefix -Pcompile. I am using this answer.
But in the runtime, when I am trying to execute a method, that using this external library, I've got java.lang.NoClassDefFoundError with the name of my class from my external library. 
So how I can make a build that will use external jar libraries from local storage?
 
    