How to remove version number from war file

前端 未结 5 1743
小蘑菇
小蘑菇 2021-01-02 17:34

I have a Dependency in child pom like this.


        
            sample-groupID
                


        
相关标签:
5条回答
  • 2021-01-02 17:41

    Within the <build> tag specify the name that you need for the artifact as "finalName".

    <build>
        <finalName>sfint</finalName>
    </build>
    
    0 讨论(0)
  • 2021-01-02 17:41

    You can configure maven-ear-plugin to omit the version information in the EAR file:

    <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-ear-plugin</artifactId>
            <version>2.10.1</version>
            <configuration>
               [...]
               <fileNameMapping>no-version</fileNameMapping>
            </configuration>
          </plugin>
        </plugins>
      </build>
    
    0 讨论(0)
  • 2021-01-02 17:50
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-ear-plugin</artifactId>
                    <version>3.0.0</version>
                    <configuration>
                        <outputFileNameMapping>@{artifactId}@@{dashClassifier?}@.@{extension}@</outputFileNameMapping>
    
    0 讨论(0)
  • 2021-01-02 17:52

    If the war/ejb is part of an ear project, one should use bundleFileName to change the module names in the final ear artifact.

    <plugin>
       <groupId>org.apache.maven.plugins</groupId>
       <artifactId>maven-ear-plugin</artifactId>
       <version>${version.ear.plugin}</version>
       <configuration>
         <modules>
           <webModule>
             <groupId>com.foo</groupId>
             <artifactId>myapp-web</artifactId>
             <contextRoot>/myapp</contextRoot>
             <bundleFileName>myapp-web.war</bundleFileName>
           </webModule>
           <ejbModule>
             <groupId>com.foo</groupId>
             <artifactId>myapp-ejb</artifactId>
             <bundleFileName>myapp-ejb.jar</bundleFileName>
           </ejbModule>
         </modules>
       </configuration>
     </plugin>
    
    0 讨论(0)
  • 2021-01-02 17:52

    This will solve your problem:

        <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>myEAR</groupId>
      <artifactId>myEAR</artifactId>
      <version>0.0.1-SNAPSHOT</version>
      <packaging>ear</packaging>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-ear-plugin</artifactId>
            <version>2.10</version>
            <configuration>
              <earSourceDirectory>EarContent</earSourceDirectory>
              <generateApplicationXml>false</generateApplicationXml>
              <version>6</version>
              <defaultLibBundleDir>lib</defaultLibBundleDir>
              <fileNameMapping>no-version</fileNameMapping>
            </configuration>
          </plugin>
        </plugins>
      </build>
      <dependencies>
        <dependency>
            <groupId>myWAR</groupId>
            <artifactId>myWAR</artifactId>
            <version>0.0.1-SNAPSHOT</version>
            <type>war</type>
        </dependency>
      </dependencies>
    </project>
    

    your final EAR will be myEAR-0.0.1.SNAPSHOT.EAR that contains myWAR.war (without version number) if you want to remove version number from EAR also than add myEar

    0 讨论(0)
提交回复
热议问题