1

m 在修复中......不用说 m 对 maven 很陌生

谷歌搜索了一些东西并创建了一个多模块项目.....我使用标记到我的主 POM 的 assembly.xml 将所有模块工件 *.jar 归档到最终的 si-installer.jar 中。

这是我的主人 pom 的样子

 <modules>
    <module>si_config_support/src/main/java/com/tcs/bancs/si</module>
    <module>SI_CORE/src/main/xsd</module>
    <module>SI_CORE/src/main/java/com/tcs/bancs/si/core</module>
    <module>SI_CORE/src/main/java/com/tcs/bancs/si/impl/adapter/jmsadapter</module>
    <module>SI_CORE/src/main/java/com/tcs/bancs/si/impl/actions</module>
    <module>SI_CORE/src/main/java/com/tcs/bancs/si/core/process/message</module>
    <module>SI_CORE/src/main/java/com/tcs/bancs/si/main</module>
</modules>

<build>
    <extensions>
        <extension>
            <groupId>org.apache.maven.wagon</groupId>
            <artifactId>wagon-ssh</artifactId>
            <version>1.0-beta-7</version>
        </extension>
    </extensions>  

    <plugins>
        <plugin>

<groupId>org.codehaus.mojo</groupId>  
<artifactId>wagon-maven-plugin</artifactId>  
<version>1.0-beta-3</version>  
  <executions>
    <execution>
      <id>upload-javadoc</id>
      <phase>deploy</phase>
      <goals>
        <goal>upload</goal>
      </goals>
      <configuration>
        <serverId>InBlrBnc107</serverId>
        <fromDir>/home0/u485309/User/Maven_SonarTest/target</fromDir>
        <includes>*.jar</includes>
        <excludes>pom.xml</excludes>
        <url>http://172.19.97.248:8081/artifactory/simple</url>
        <toDir>SIDeployment/Service-Integrator/si-main</toDir>
      </configuration>
      </execution>
    </executions>
    </plugin>


        <!--plugin>
    <groupId>org.apache.maven.plugins</groupId> 
    <artifactId>maven-antrun-plugin</artifactId>
    <version>1.6</version>
    <executions>
      <execution>
        <phase>deploy</phase>
        <configuration>
          <target>
            <scp file="/home0/u485309/User/Maven_SonarTest/target/si-installer-9.0.jar" todir="sidevperf:password@172.19.98.18:/home/sidevperf/USERS" trust="true"/>
          </target>
        </configuration>
        <goals>
          <goal>run</goal>
        </goals>
      </execution>
    </executions>
     <dependencies>
          <dependency>  
            <groupId>ant-jsch</groupId>  
            <artifactId>ant-jsch</artifactId>  
            <version>1.8.1</version>  
        </dependency> 

        <dependency>          
            <groupId>com.jcraft</groupId>           
            <artifactId>jsch</artifactId>          
            <version>0.1.42</version>       
       </dependency>  
     </dependencies> 
  </plugin-->

        <plugin>
            <groupId>org.apache.maven.plugins</groupId> 
            <artifactId>maven-install-plugin</artifactId>
            <version>2.4</version>
            <configuration>
                <createChecksum>true</createChecksum>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId> 
            <artifactId>maven-assembly-plugin</artifactId>
            <version>2.4</version>
            <configuration>
                <appendAssemblyId>false</appendAssemblyId>
                <finalName>si-installer-9.0</finalName>
                <descriptors>
                    <descriptor>si-assembly.xml</descriptor>
                </descriptors>
                <attach>false</attach>
                <archive>
                    <manifest>
                        <mainClass>com.tcs.mswitch.installer.Install</mainClass>
                    </manifest>
                </archive>
            </configuration>
            <executions>
                <execution>
                    <id>make-assembly</id>
                    <phase>install</phase>
                    <goals>
                        <goal>single</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
            <version>2.1</version>
            <executions>
                <execution>
                    <id>copy-dependencies</id>
                    <phase>package</phase>
                    <goals>
                        <goal>copy-dependencies</goal>
                    </goals>
                    <configuration>
                        <outputDirectory>${project.basedir}/installer/thirdparty-lib</outputDirectory>
                        <overWriteIfNewer>true</overWriteIfNewer>
                        <includeScope>provided</includeScope>
                        <outputAbsoluteArtifactFilename>true</outputAbsoluteArtifactFilename>
                    </configuration>
                </execution>    
            </executions>
        </plugin>

我的 si 程序集是这样的:

<assembly>
<id>Service-Integrator</id>
<formats>
    <format>jar</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>

<fileSets>
    <fileSet>
        <directory>/home0/u485309/User/Maven_SonarTest/si_config_support/src/main/java/com/tcs/bancs/si/target</directory>
        <outputDirectory>SI_COMPONENTS/lib</outputDirectory>
        <includes>
            <include>si-config-support-9.0.jar</include>
        </includes>
    </fileSet>
    <fileSet>
        <directory>/home0/u485309/User/Maven_SonarTest/SI_CORE/src/main/xsd/target</directory>
        <outputDirectory>SI_COMPONENTS/lib</outputDirectory>
        <includes>
            <include>si-config-9.0.jar</include>
        </includes>
    </fileSet>
    <fileSet>
        <directory>/home0/u485309/User/Maven_SonarTest/SI_CORE/src/main/java/com/tcs/bancs/si/core/target</directory>
        <outputDirectory>SI_COMPONENTS/lib</outputDirectory>
        <includes>
            <include>si-core-9.0.jar</include>
        </includes>
    </fileSet>

    <fileSet>
        <directory>/home0/u485309/User/Maven_SonarTest/SI_CORE/src/main/java/com/tcs/bancs/si/impl/adapter/jmsadapter/target</directory>
        <outputDirectory>SI_COMPONENTS/lib</outputDirectory>
        <includes>
            <include>si-jms-adapter-9.0.jar</include>
        </includes>
    </fileSet>
    <fileSet>
        <directory>/home0/u485309/User/Maven_SonarTest/SI_CORE/src/main/java/com/tcs/bancs/si/impl/actions/target</directory>
        <outputDirectory>SI_COMPONENTS/lib</outputDirectory>
        <includes>
            <include>si-processing-actions-9.0.jar</include>
        </includes>
    </fileSet>
    <fileSet>
        <directory>/home0/u485309/User/Maven_SonarTest/SI_CORE/src/main/java/com/tcs/bancs/si/core/process/message/target</directory>
        <outputDirectory>SI_COMPONENTS/lib</outputDirectory>
        <includes>
            <include>si-message-processor-9.0.jar</include>
        </includes>
    </fileSet>
    <fileSet>
        <directory>/home0/u485309/User/Maven_SonarTest/SI_CORE/src/main/java/com/tcs/bancs/si/main/target</directory>
        <outputDirectory>SI_COMPONENTS/lib</outputDirectory>
        <includes>
            <include>si-main-9.0.jar</include>
        </includes>
    </fileSet>
    <fileSet>
        <directory>/home0/u485309/User/Maven_SonarTest/installer/groovy-dependencies</directory>
        <outputDirectory/>
        <includes>
            <include>**/*</include>
        </includes>
        <!--excludes>
            <exclude>META-INF/**/*</exclude>
        </excludes-->
    </fileSet>
    <fileSet>
        <directory>/home0/u485309/User/Maven_SonarTest/installer/thirdparty-lib</directory>
        <outputDirectory>SI_COMPONENTS/thirdparty-lib</outputDirectory>
        <includes>
            <include>*.jar</include>
        </includes>
        <excludes>
            <exclude>bancsjmx-2.0.jar</exclude>
            <exclude>xsd.jar</exclude>
        </excludes>
    </fileSet>
    <fileSet>
        <directory>/home0/u485309/User/Maven_SonarTest/installer/thirdparty-lib</directory>
        <outputDirectory>SI_COMPONENTS/lib</outputDirectory>
        <includes>
            <include>bancsjmx-2.0.jar</include>
            <!--include>xsd.jar</include-->
        </includes>
    </fileSet>

    <fileSet>
        <directory>/home0/u485309/User/Maven_SonarTest/DeliveryComponents</directory>
        <outputDirectory>SI_COMPONENTS</outputDirectory>
        <includes>
            <include>**/*</include>
        </includes>
    </fileSet>
</fileSets>

我有两个问题-:

1)我的所有阶段都针对每个模块运行,因此我的 si-installer.jar 将是我的最终 jar 为所有模块创建,并且 ant 任务也为所有模块运行..也使用 wagon 上传到工件发生所有阶段?只有在所有子模块的编译完成后,我才能停止像包和部署这样的阶段运行?

2)我的最终工件 jar si-installer.jar 有时包含我所有的子模块 jar,而在其他时候只有一个 jar(最后在 assembly.xml 的文件集中提到的 bancsjmx.jar)进入最终工件 si-installer.jar哪个是 assembly.xml 中的 bancsjmx.jar,我很困惑?这种行为也是零星的……有时我把我所有的罐子都放在最后一个罐子里……有时我只说一个……好像 maven 做了一些多线程的东西……文慢了就好了!!!请帮忙

以前有人遇到过这样的问题吗?

4

0 回答 0