[MTOMCAT-196] for warRunDependencies too

git-svn-id: https://svn.apache.org/repos/asf/tomcat/maven-plugin/trunk@1539227 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/tomcat7-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat7/run/AbstractExecWarMojo.java b/tomcat7-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat7/run/AbstractExecWarMojo.java
index 900773b..c8f3544 100644
--- a/tomcat7-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat7/run/AbstractExecWarMojo.java
+++ b/tomcat7-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat7/run/AbstractExecWarMojo.java
@@ -310,9 +310,21 @@
                     if ( warRunDependency.dependency != null )
                     {
                         Dependency dependency = warRunDependency.dependency;
+                        String version = dependency.getVersion();
+                        if ( StringUtils.isEmpty( version ) )
+                        {
+                            version = findArtifactVersion( dependency );
+                        }
+
+                        if ( StringUtils.isEmpty( version ) )
+                        {
+                            throw new MojoExecutionException(
+                                "Dependency '" + dependency.getGroupId() + "':'" + dependency.getArtifactId()
+                                    + "' does not have version specified" );
+                        }
                         Artifact artifact = artifactFactory.createArtifactWithClassifier( dependency.getGroupId(),
                                                                                           dependency.getArtifactId(),
-                                                                                          dependency.getVersion(),
+                                                                                          version,
                                                                                           dependency.getType(),
                                                                                           dependency.getClassifier() );
 
diff --git a/tomcat7-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat7/run/AbstractStandaloneWarMojo.java b/tomcat7-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat7/run/AbstractStandaloneWarMojo.java
index c0c7386..23b9828 100644
--- a/tomcat7-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat7/run/AbstractStandaloneWarMojo.java
+++ b/tomcat7-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat7/run/AbstractStandaloneWarMojo.java
@@ -70,9 +70,10 @@
 
     /**
      * the type to use for the attached/generated artifact
+     *
      * @since 2.2
      */
-    @Parameter( property = "maven.tomcat.exec.war.attachArtifactType", defaultValue = "war", required = true )
+    @Parameter(property = "maven.tomcat.exec.war.attachArtifactType", defaultValue = "war", required = true)
     protected String attachArtifactClassifierType;
 
     public void execute()
@@ -190,11 +191,22 @@
             {
                 for ( Dependency dependency : extraDependencies )
                 {
+                    String version = dependency.getVersion();
+                    if ( StringUtils.isEmpty( version ) )
+                    {
+                        version = findArtifactVersion( dependency );
+                    }
+
+                    if ( StringUtils.isEmpty( version ) )
+                    {
+                        throw new MojoExecutionException(
+                            "Dependency '" + dependency.getGroupId() + "':'" + dependency.getArtifactId()
+                                + "' does not have version specified" );
+                    }
                     // String groupId, String artifactId, String version, String scope, String type
                     Artifact artifact =
-                        artifactFactory.createArtifact( dependency.getGroupId(), dependency.getArtifactId(),
-                                                        dependency.getVersion(), dependency.getScope(),
-                                                        dependency.getType() );
+                        artifactFactory.createArtifact( dependency.getGroupId(), dependency.getArtifactId(), version,
+                                                        dependency.getScope(), dependency.getType() );
 
                     artifactResolver.resolve( artifact, this.remoteRepos, this.local );
                     JarFile jarFile = new JarFile( artifact.getFile() );