Deploy JAR and WAR to Nexus

333 Views Asked by At

I'm working on a JAVA based application. The POM has been so configured that the packaging phase generates an executable JAR (with the maven-shade-plugin) and a WAR (with the war-plugin). The main packaging in the POM is set to jar. When i execute locally a

mvn clean package

I obtain in my target folder the expected result (WAR + shaded JAR). But for some reason, in the Jenkins CI, in the deploy phase, only the JAR is being send to Nexus, the WAR is ignored. Is there anything specific I should do to have the WAR sent to NEXUS ?

Here below the plugin-configs:

             <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>3.2.3</version>
                <configuration>
                    <archive>
                        <manifest>
                            <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                            <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
                        </manifest>
                        <manifestEntries>
                            <Build-Time>${maven.build.timestamp}</Build-Time>
                        </manifestEntries>
                        -->
                    </archive>
                </configuration>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>war</goal>
                        </goals>
                    </execution>
               </executions>
            </plugin>

and

             <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>3.2.4</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                        <configuration>
                            <finalName>${project.build.finalName}-jar-with-dependencies</finalName>
                        </configuration>
                    </execution>
                </executions>
                <configuration>
                    <createDependencyReducedPom>false</createDependencyReducedPom>
                    <filters>
                        <filter>
                            <artifact>*:*</artifact>
                            <excludes>
                                <exclude>**/Log4j2Plugins.dat</exclude>
                                <exclude>module-info.class</exclude>
                                <exclude>META-INF/*.SF</exclude>
                                <exclude>META-INF/*.DSA</exclude>
                                <exclude>META-INF/*.RSA</exclude>
                            </excludes>
                        </filter>
                    </filters>
                    <shadedArtifactAttached>false</shadedArtifactAttached>
                    <transformers>
                        <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                            <mainClass>my.main.class</mainClass>
                        </transformer>
                    </transformers>
                </configuration>
            </plugin>
0

There are 0 best solutions below