Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using maven-assembly-plugin to rename zip artifacts

I've spent countless hours trying to resolve this issue but i'm still on the dark and hoping someone could give a helping hand. Here is my situation:

  • i have an assembly descriptor that creates a zip artifact. The name of this zip comes from the artifact_id and the version defined in the pom.xml file. I would like to change the name of this artifact. i have added a element in my pom under the plugin section of the to look like:

(finalName)somename.${var1}-${var2}(/finalName) --> i'm using parenthesis here around the fileName element since somehow i cannot use the brackets in this editor.

These ${var1} and ${var2} are defined in an external .properties file. To read in these vars i'm using the properties-maven-plugin. I cannot define these vars within the pom cuz they change for each deployment and cannot be provided from the cmd line. When i run mvn assembly:single, the zip artifact is created as somename.null-null.zip. It looks like the properties defined in the .properties files are null or not being evaluated. When i run mvn in debug mode, i see that the resources are set properly: var1=something and var2=somethingelse. They both have the right values. I'm at loss right now. Any help will be greatly appreciated.

like image 523
Britney Avatar asked Sep 12 '11 17:09

Britney


1 Answers

<plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-assembly-plugin</artifactId>
                <executions>
                    <execution>
                        <id>assembly:package</id>
                        <phase>package</phase>
                        .
                        .
                        <configuration>
                            <finalName>zipName</finalName>
                            <appendAssemblyId>false</appendAssemblyId>

                            <descriptors>
                            .
                            .
                            </descriptors>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
like image 79
Adi Mor Avatar answered Nov 10 '22 06:11

Adi Mor