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

| Views: 140
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

Have comments or feedback on what I wrote? Please share them below! Found this useful? Consider sending me a small tip.
comments powered by Disqus
Other posts you may like...