2016-05-06 4 views
0

を失敗について、私は 'tomcat7-のmaven-pluginの' を実行するとき、私はマルチモジュールのMavenリモート展開が

  • のpom.xml(ポンポンをパッケージには、二つのモジュールを持っている)問題を抱えている
  • サービス
    • のpom.xml(包装JAR)
  • WEB2
    • のpom.xml(包装戦争、サービスに依存します)

親:

<?xml version="1.0" encoding="UTF-8"?> 
<project xmlns="http://maven.apache.org/POM/4.0.0" 
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 
    <modelVersion>4.0.0</modelVersion> 
    <groupId>DeployTest</groupId> 
    <artifactId>DeployTest</artifactId> 
    <packaging>pom</packaging> 
    <version>1.0-SNAPSHOT</version> 
    <modules> 
     <module>web2</module> 
     <module>service</module> 
    </modules> 
    <build> 
     <finalName>DeployTest</finalName> 
     <plugins> 
      <plugin> 
       <artifactId>maven-compiler-plugin</artifactId> 
       <configuration> 
        <source>1.7</source> 
        <target>1.7</target> 
        <encoding>UTF-8</encoding> 
       </configuration> 
      </plugin> 
     </plugins> 
    </build> 
</project> 

子供サービス:

<?xml version="1.0" encoding="UTF-8"?> 
<project xmlns="http://maven.apache.org/POM/4.0.0" 
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 
    <parent> 
     <artifactId>DeployTest</artifactId> 
     <groupId>DeployTest</groupId> 
     <version>1.0-SNAPSHOT</version> 
    </parent> 
    <modelVersion>4.0.0</modelVersion> 
    <artifactId>service</artifactId> 
    <groupId>service</groupId> 
    <version>1.0</version> 
</project> 

子供-ウェブ:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> 
    <parent> 
     <artifactId>DeployTest</artifactId> 
     <groupId>DeployTest</groupId> 
     <version>1.0-SNAPSHOT</version> 
    </parent> 
    <modelVersion>4.0.0</modelVersion> 
    <artifactId>web2</artifactId> 
    <packaging>war</packaging> 
    <name>web2 Maven Webapp</name> 
    <url>http://maven.apache.org</url> 
    <dependencies> 
     <dependency> 
      <groupId>service</groupId> 
      <artifactId>service</artifactId> 
      <version>1.0</version> 
     </dependency> 
    </dependencies> 
    <build> 
     <finalName>web2</finalName> 
     <plugins> 
      <plugin> 
       <groupId>org.apache.tomcat.maven</groupId> 
       <artifactId>tomcat7-maven-plugin</artifactId> 
       <version>2.1</version> 
       <configuration> 
        <url>http://192.168.1.109:8080/manager/text</url> 
        <username>admin</username> 
        <password>admin</password> 
        <server>tomcat</server> 
        <path>/DeployTest</path> 
       </configuration> 
      </plugin> 
     </plugins> 
    </build> 
</project> 

Whe nは、私は 'tomcat7を:再デプロイ' を実行には、例外がスローされます。

[ERROR] Failed to execute goal on project web2: Could not resolve dependencies for project DeployTest:web2:war:1.0-SNAPSHOT: Failure to find service:service:jar:1.0 in http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced -> [Help 1] 
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal on project web2: Could not resolve dependencies for project DeployTest:web2:war:1.0-SNAPSHOT: Failure to find service:service:jar:1.0 in http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced 
    at org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.getDependencies(LifecycleDependencyResolver.java:210) 
    at org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.resolveProjectDependencies(LifecycleDependencyResolver.java:117) 
    at org.apache.maven.lifecycle.internal.MojoExecutor.ensureDependenciesAreResolved(MojoExecutor.java:258) 
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:201) 
    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.MojoExecutor.executeForkedExecutions(MojoExecutor.java:365) 
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:199) 
    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:84) 
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59) 
    at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183) 
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161) 
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320) 
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156) 
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537) 
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196) 
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:141) 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
    at java.lang.reflect.Method.invoke(Method.java:606) 
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290) 
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230) 
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409) 
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352) 
    at org.codehaus.classworlds.Launcher.main(Launcher.java:47) 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
    at java.lang.reflect.Method.invoke(Method.java:606) 
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144) 
Caused by: org.apache.maven.project.DependencyResolutionException: Could not resolve dependencies for project DeployTest:web2:war:1.0-SNAPSHOT: Failure to find service:service:jar:1.0 in http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced 
    at org.apache.maven.project.DefaultProjectDependenciesResolver.resolve(DefaultProjectDependenciesResolver.java:189) 
    at org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.getDependencies(LifecycleDependencyResolver.java:185) 
    ... 32 more 

助けてください私... おかげで...あなたの子供サービスのpom.xmlで

答えて

0

、私は方法を見つけました。

ウェブのpom.xmlから次のコードを削除します。

<build> 
     <finalName>DeployTest</finalName> 
     <plugins> 
      <plugin> 
       <artifactId>maven-compiler-plugin</artifactId> 
       <configuration> 
        <source>1.7</source> 
        <target>1.7</target> 
        <encoding>UTF-8</encoding> 
       </configuration> 
      </plugin> 
     </plugins> 
    </build> 

は、親のpom.xmlに<build>ノードを次のコードを追加します。

  <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-install-plugin</artifactId> 
       <version>2.5.2</version> 
       <executions> 
        <execution> 
         <id>deploy_install</id> 
         <phase>package</phase> 
         <goals> 
          <goal>install</goal> 
         </goals> 
        </execution> 
       </executions> 
      </plugin> 
      <plugin> 
       <groupId>org.apache.tomcat.maven</groupId> 
       <artifactId>tomcat7-maven-plugin</artifactId> 
       <version>2.2</version> 
       <configuration> 
        <url>http://192.168.1.109:8080/manager/text</url> 
        <username>admin</username> 
        <password>admin</password> 
        <path>/DeployTest</path> 
       </configuration> 
      </plugin> 
0

、行を削除<groupId>service</groupId>

あなたの子供 - ウェブのpom.xmlで

、とサービスのプロジェクトを参照:

最後に
<dependencies> 
    <dependency> 
     <groupId>${project.groupId}</groupId> 
     <artifactId>service</artifactId> 
     <version>${project.version}</version> 
    </dependency> 
</dependencies> 
+0

は、あなたの答えをありがとう、しかし、問題がまだ存在しますデプロイテスト:サービス:jar:http://repo.maven.apache.org/maven2の1.0がローカルリポジトリにキャッシュされました。 – zhangbowen

+0

サービスpomから ' 1.0'を削除しました。 xmlを追加し、 ' jar 'there – Pras

+0

コマンド実行時にサブモジュールを参照できないのですか? – zhangbowen

関連する問題