You can use the finalName property in the build-section of the Maven
pom-file:

<build>
  <finalName>test</finalName>
 . . .</build>


https://stackoverflow.com/questions/14488509/maven-how-to-rename-the-war-file-for-the-project


PGP key:
https://keys.mailvelope.com/pks/lookup?op=get&search=0xF31094A567CE732E


On Wed, Jun 3, 2020 at 9:44 PM Meir Yanovich
<meir.yanov...@personetics.com.invalid> wrote:

> im using the latest version of the maven-ear-plugin
> i like to bundle the test.war into my ear
> but the output is always :
>
> test1-test21999.test-SNAPSHOT.war
>
> which is always the default :
>
>     outputFileNameMapping = @{groupId}@-@{artifactId}@-@{version}@
> @{dashClassifier?}@.@{extension}@
>
> how do i force it to be:test.war
>
>     <?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/maven-v4_0_0.xsd
> ">
>
>              <modelVersion>4.0.0</modelVersion>
>
>              <parent>
>                            <groupId>com.test.id</groupId>
>                            <artifactId>artifact_name</artifactId>
>                            <version>1999_app</version>
>              </parent>
>
>              <artifactId>Test</artifactId>
>              <packaging>ear</packaging>
>              <name>Test</name>
>
>              <dependencies>
>                            <dependency>
>
> <groupId>${project.groupId}</groupId>
>                                         <artifactId>test1</artifactId>
>                                         <type>war</type>
>              </dependency>
>              <profiles>
>                            <profile>
>                                         <id>myapp</id>
>                                         <build>
>
>  <finalName>myapp</finalName>
>                                                      <plugins>
>                                                                   <plugin>
>
>       <groupId>org.apache.maven.plugins</groupId>
>
>       <artifactId>maven-ear-plugin</artifactId>
>
>       <configuration>
>
>                    <modules>
>
>                                 <webModule>
>
>                                     <artifactId>test1</artifactId>
>
>                                              <groupId>Test1</groupId>
>
>
>  <bundleFileName>test.war</bundleFileName>
>
>
>  <outputFileNameMapping>test.war</outputFileNameMapping>
>
>
>  <contextRoot>/myapp</contextRoot>
>
>                                 </webModule>
>
>                    </modules>
>
>       </configuration>
>                                                                   </plugin>
>                                                      </plugins>
>                                         </build>
>                            </profile>
>              </profiles>
> </project>
>
> here is the log after running with -X:
> please notice when it copy and ignoring the renaming
>
>      [INFO] Copying artifact [war:test1:test2:1999.test-SNAPSHOT] to
> [test1-test21999.test-SNAPSHOT.war]
>
>     [INFO] --- maven-ear-plugin:3.0.1:ear (default-ear) @ web-pserver-ear
> ---
>     [DEBUG] Configuring mojo
> org.apache.maven.plugins:maven-ear-plugin:3.0.1:ear from plugin realm
> ClassRealm[plugin>org.apache.maven.plugins:maven-ear-plugin:3.0.1, parent:
> sun.misc.Launcher$AppClassLoader@4e25154f]
>     [DEBUG] Configuring mojo
> 'org.apache.maven.plugins:maven-ear-plugin:3.0.1:ear' with basic
> configurator -->
>     [DEBUG]   (f) earSourceDirectory = C:\foo\ear\src\main\application
>     [DEBUG]   (f) earSourceIncludes = **
>     [DEBUG]   (f) encoding = UTF-8
>     [DEBUG]   (f) escapedBackslashesInFilePath = false
>     [DEBUG]   (f) filtering = false
>     [DEBUG]   (f) finalName =
> web-pserver-ear-2020.vanilla-engage.1-SNAPSHOT
>     [DEBUG]   (f) generatedDescriptorLocation = C:\foo\target
>     [DEBUG]   (f) includeLibInApplicationXml = false
>     [DEBUG]   (f) outputDirectory = C:\foo\target
>     [DEBUG]   (f) outputFileNameMapping = @{groupId}@-@{artifactId}@
> -@{version}@@{dashClassifier?}@.@{extension}@
>     [DEBUG]   (f) project = MavenProject: foo-ear:1999.foo1-SNAPSHOT @
> C:foo\ear\pom.xml
>     [DEBUG]   (f) session =
> org.apache.maven.execution.MavenSession@7569ea63
>     [DEBUG]   (f) skinnyWars = false
>     [DEBUG]   (f) skipClassPathModification = false
>     [DEBUG]   (f) tempFolder =C:\foo\target
>     [DEBUG]   (f) useJvmChmod = true
>     [DEBUG]   (f) version = 7
>     [DEBUG]   (f) workDirectory = C:\foo\target\foo-SNAPSHOT
>     [DEBUG] -- end configuration --
>     [DEBUG] Resolving artifact type mappings ...
>     [DEBUG] Initializing JBoss configuration if necessary ...
>     [DEBUG] Initializing ear execution context
>     [DEBUG] Resolving ear modules ...
>
>
>     [INFO] Copying artifact [war:test1:test2:1999.test-SNAPSHOT] to
> [test1-test21999.test-SNAPSHOT.war]
>
>
>     [INFO] Copy ear sources to C:\foo\target\foo-SNAPSHOT
>     [DEBUG] Jar archiver implementation
> [org.codehaus.plexus.archiver.jar.JarArchiver]
>     [DEBUG] Excluding [] from the generated EAR.
>     [DEBUG] Including [**] in the generated EAR.
>
>

Reply via email to