Igor Kromin |   Consultant. Coder. Blogger. Tinkerer. Gamer.

I've been messing around with some Maven POM files recently and started getting this error - MojoExecutionException: The artifact location was not specified. It probably took longer than it should have to resolve it but the solution was very simple in the end.

This is what the full error from Maven looked like...
 Maven Output
[ERROR] Failed to execute goal com.oracle.weblogic:weblogic-maven-plugin:12.2.1-0-0:deploy (default-cli) on project MyProject: org.apache.maven.plugin.MojoExecutionException: The artifact location was not specified.
[ERROR] at weblogic.tools.maven.plugins.BaseMojo.getArtifactFile(BaseMojo.java:112)
[ERROR] at weblogic.tools.maven.plugins.deploy.DeployMojo.populateParameters(DeployMojo.java:387)
[ERROR] at weblogic.tools.maven.plugins.deploy.DeployMojo.getArgs(DeployMojo.java:346)
[ERROR] at weblogic.tools.maven.plugins.deploy.DeployMojo.execute(DeployMojo.java:338)
[ERROR] at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
[ERROR] at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
[ERROR] at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:154)
[ERROR] at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:146)
[ERROR] at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
[ERROR] at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
[ERROR] at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
[ERROR] at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
[ERROR] at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:309)
[ERROR] at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:194)
[ERROR] at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:107)
[ERROR] at org.apache.maven.cli.MavenCli.execute(MavenCli.java:993)
[ERROR] at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:345)
[ERROR] at org.apache.maven.cli.MavenCli.main(MavenCli.java:191)
[ERROR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[ERROR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[ERROR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[ERROR] at java.lang.reflect.Method.invoke(Method.java:498)
[ERROR] at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
[ERROR] at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
[ERROR] at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
[ERROR] at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)


The problem was that I was missing the <source> configuration for the Maven Weblogic Plugin execution I was running. Fixing it was as simple as adding the correct path to my target artifact...


 Maven POM
<execution>
<id>wls-deploy</id>
<phase>install</phase>
<goals>
<goal>deploy</goal>
</goals>
<configuration>
...
<source>${basedir}/target/${project.artifactId}-${project.version}.war</source>
...
</configuration>
</execution>


The path to the artifact (WAR file in my case) can differ, it depends how the rest of the POM file is set up.

After making this change the error went away and I was able to deploy to WebLogic successfully.

-i


A quick disclaimer...

Although I put in a great effort into researching all the topics I cover, mistakes can happen. Use of any information from my blog posts should be at own risk and I do not hold any liability towards any information misuse or damages caused by following any of my posts.

All content and opinions expressed on this Blog are my own and do not represent the opinions of my employer (Oracle). Use of any information contained in this blog post/article is subject to this disclaimer.
Hi! You can search my blog here ⤵
NOTE: (2022) This Blog is no longer maintained and I will not be answering any emails or comments.

I am now focusing on Atari Gamer.