maven site plugin issue on jenkins server - jenkins

I developed a project with spring boot when I run maven build locally it worked fine and when I deploy on Jenkins server , the builds are failing when documenting.Here is my pom file.
<?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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.companyname.services</groupId>
<artifactId>sample project</artifactId>
<version>0.0.2-SNAPSHOT</version>
<packaging>war</packaging>
<name>sample project</name>
<description>Demo project </description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.4.0.RELEASE</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<additionalparam>-Xdoclint:none</additionalparam>
</properties>
<scm>
// git urls
</scm>
<distributionManagement>
<snapshotRepository>
<id>xyz-snapshots</id>
<name>xyz-snapshots</name>
<url>urlname</url>
</snapshotRepository>
<repository>
<id>xyz-releases</id>
<name>xyz-releases</name>
<url>urlname</url>
</repository>
<site>
<id>app-site-deploy</id>
<url>dav:http://xyzcomzpny.com/projects/doc/</url>
</site>
</distributionManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<!-- <dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency> -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-commons</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
when we deploy on jenkins it showing the following error:
Unsupported protocol: 'dav' for site deployment to dav:http://xyzcomzpny.com/projects/doc/. when I use the site tag in other projects it worked. what is causing the builds fail? Do I have to add any tag in my pom file?

Source: https://www.mkyong.com/maven/how-to-deploy-site-with-mvn-site-deploy-webdav-example/
Did you try to declare the Wagon Dav extension ?
<build>
<extensions>
<extension>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-webdav-jackrabbit</artifactId>
<version>1.0-beta-7</version>
</extension>
</extensions>
</build>

Related

Spring + OpenAPI3 getting Swagger 404 when using static openApi.yaml file

I have a simple spring application setup, with an openAPI dependency, in my pom file I added:
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-ui</artifactId>
<version>1.6.6</version>
</dependency>
and I put a sample openapi.yaml file in the static resource folder, I then followed the instructions in the document:
Turn off auto-generation in the project property file:
springdoc.api-docs.enabled=false
Put your yaml file in src/main/resources/static such as src/main/resources/static/myApiFile.yaml
Set the swagger-ui URL for the file:
springdoc.swagger-ui.url=/myApiFile.yaml
Enable the minimal beans configuration:
#Configurationpublic class SpringDocsConfiguration {
#Bean
SpringDocConfiguration springDocConfiguration() {return new SpringDocConfiguration();}
#Bean
public SpringDocConfigProperties springDocConfigProperties() {return new SpringDocConfigProperties();}}
When I run the application and go to the URL: localhost:8080/swagger-ui.html, it shows that the .yaml file can not be fetched:
Here is my pom.xml:
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.dao.diy</groupId>
<artifactId>ADO-Diy</artifactId>
<version>1.0</version>
</parent>
<!-- <groupId>org.dao.diy</groupId>-->
<artifactId>backend</artifactId>
<name>backend</name>
<!-- <version>0.0.1-SNAPSHOT</version>-->
<packaging>war</packaging>
<!-- <name>backend</name>-->
<description>backend</description>
<properties>
<java.version>11</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<!-- <dependency>-->
<!-- <groupId>org.springframework.boot</groupId>-->
<!-- <artifactId>spring-boot-starter-data-mongodb</artifactId>-->
<!-- </dependency>-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-oauth2-client</artifactId>
</dependency>
<!-- <dependency>-->
<!-- <groupId>org.springframework.boot</groupId>-->
<!-- <artifactId>spring-boot-starter-security</artifactId>-->
<!-- </dependency>-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<!-- <dependency>-->
<!-- <groupId>org.springframework.security</groupId>-->
<!-- <artifactId>spring-security-test</artifactId>-->
<!-- <scope>test</scope>-->
<!-- </dependency>-->
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-ui</artifactId>
<version>1.6.6</version>
</dependency>
</dependencies>
<build>
<finalName>ADO-DIY-TESTING</finalName>
<plugins>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<id>copy-resources</id>
<phase>validate</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>./src/main/resources/static/</outputDirectory>
<resources>
<resource>
<directory>../frontend/dist/frontend/</directory>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<excludes>
<exclude>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
<resources>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/*.properties</include>
</includes>
</resource>
</resources>
</build>
</project>
My debugging steps include:
Following the documentation
Googling for existing solutions
Changing file locations
Trying different configuration combinations
Make sure to use the following structure for your resources folder:
resources -> static -> myAPIFile.yaml
Found the answer here: How to point Springdoc Swagger UI to my own YAML file instead of the auto-generated one?

Getting access denied while deploying through jenkins localhost tomcat

I'm new to jenkins deploying my application on localhost tomcat but getting an error of Not authorized.
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.8.2:deploy (default-deploy) on project transpoort: Failed to retrieve remote metadata com.ailogics:transpoort:0.0.1-SNAPSHOT/maven-metadata.xml: Could not transfer metadata com.ailogics:transpoort:0.0.1-SNAPSHOT/maven-metadata.xml from/to transport (http://localhost:8080/manager/text/deploy?path=/transport): Not authorized , ReasonPhrase:. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
This is my pom.xml
<?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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.ailogics</groupId>
<artifactId>transpoort</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>transport</name>
<description>Demo project for Spring Boot</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.4.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
</properties>
<profiles>
<profile>
<id>tomcat-localhost</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<tomcat-server>localhost</tomcat-server>
<tomcat-url>http://localhost:8080/manager</tomcat-url>
</properties>
</profile>
</profiles>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.security.oauth</groupId>
<artifactId>spring-security-oauth2</artifactId>
<version>2.3.3.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<!--<scope>provided</scope>-->
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.cloudinary</groupId>
<artifactId>cloudinary-http44</artifactId>
<version>1.2.0</version>
</dependency>
<dependency>
<groupId>org.mindrot</groupId>
<artifactId>jbcrypt</artifactId>
<version>0.3m</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<!-- enable deploying to tomcat -->
<groupId>org.codehaus.mojo</groupId>
<artifactId>tomcat-maven-plugin</artifactId>
<version>1.1</version>
<configuration>
<server>${tomcat-server}</server>
<url>${tomcat-url}</url>
</configuration>
</plugin>
</plugins>
</build>
<distributionManagement>
<repository>
<id>transport</id>
<url>http://localhost:8080/manager/text/deploy?path=/transport</url>
</repository>
</distributionManagement>
</project>
This is my tomcat-users.xml
<role rolename="manager-gui"/>
<role rolename="manager-script"/>
<user username="tomcat" password="tomcat" roles="standard,manager-gui,manager-script"/>
I used Jenkins->Managed Files->Config File Management to set the server credentials
add this in your project pom.xml file
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<url>http://localhost:8080/manager/text</url>
<server>tomcat</server>
<username>tomcat</username>
<password>tomcat</password>
</configuration>
</plugin>

Maven - optional dependencies not being included in WEB-INF/lib

I've a maven war module that have several optional dependencies declared in pom.xml. In eclipse, those options dependencies are showing as part of the build path, which is what I expected. But during packaging of war file, maven is not including those dependencies in the WEB-INF/lib folder, which is not correct according to maven doc: https://maven.apache.org/guides/introduction/introduction-to-optional-and-excludes-dependencies.html. Any idea why that is the case?
Below is the complete pom.xml
<?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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>dhive</artifactId>
<groupId>com.boss</groupId>
<version>1.0</version>
</parent>
<artifactId>Boss</artifactId>
<packaging>war</packaging>
<dependencies>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>uk.com.robust-it</groupId>
<artifactId>cloning</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>net.sf.jt400</groupId>
<artifactId>jt400</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc14</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>net.sourceforge.jtds</groupId>
<artifactId>jtds</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.qoppa</groupId>
<artifactId>jPDFProcess</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.lowagie</groupId>
<artifactId>itext</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.arch</groupId>
<artifactId>multivalent</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.arch</groupId>
<artifactId>multivalentArch</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.jpedal</groupId>
<artifactId>jpedal</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.arch</groupId>
<artifactId>invoiceTool</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.sun</groupId>
<artifactId>tools</artifactId>
<version>1.6.0</version>
<scope>system</scope>
<systemPath>${env.JAVA_HOME}/lib/tools.jar</systemPath>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ejb-plugin</artifactId>
<version>2.5</version>
<executions>
<execution>
<id>BossClient</id>
<configuration>
<ejbVersion>3.1</ejbVersion>
<generateClient>true</generateClient>
<clientIncludes>
<clientInclude>/com/**</clientInclude>
</clientIncludes>
</configuration>
<goals>
<goal>ejb</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
Created an issue to Maven WAR Plugin for this, https://issues.apache.org/jira/browse/MWAR-351.
To get around this issue, I ended up have to removed the
<optional>true</optional>
from the ejb war module for it to work. For all other projects/Modules that needs the ejb-client from this war module, I ended up have to do exclusion to avoid its dependencies from being added to those projects/modules (See below).
<dependency>
<groupId>com.boss</groupId>
<artifactId>Boss</artifactId>
<version>1.0</version>
<type>ejb-client</type>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
I guess you need to change you plugin in pom.xml try adding following plugin
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.6</version>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
</manifest>
</archive>
</configuration>
</plugin>

Could not find artifact in maven central repo when search returns a match

I am attempting to introduce a dependency on the castor library in my pom. Since my project is at a preliminary stage, all artifacts are from maven central. So I search in search.maven.org for "castor". I take the first result which gives me the following dependency snippet:
<dependency>
<groupId>org.codehaus.castor</groupId>
<artifactId>castor</artifactId>
<version>1.3.3</version>
</dependency>
Now I "mvn clean install" and get the following:
[ERROR] Failed to execute goal on project jaxb: Could not resolve dependencies for project org.test:jaxb:war:0.0.1-SNAPSHOT: Could not find artifact org.codehaus.castor:castor:jar:1.3.3 in central (https://repo.maven.apache.org/maven2) -> [Help 1]
How come a artifact that can be found from the web interface cannot be found by the CLI. I am certainly missing something. Request pointers on what it could be.
Among other posts, I have looked into this and this posts which are related, but not this issue.
My Complete pom:
<?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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.test</groupId>
<artifactId>jaxb</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>jaxb</name>
<description>jaxb</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.1.9.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>org.eclipse.persistence.moxy</artifactId>
<version>2.6.0-M3</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-oxm</artifactId>
<version>4.1.2.RELEASE</version>
</dependency>
<dependency>
<groupId>org.codehaus.castor</groupId>
<artifactId>castor</artifactId>
<version>1.3.3</version>
</dependency>
</dependencies>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<start-class>org.test.jaxb.Application</start-class>
<java.version>1.7</java.version>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.2</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>
The problem you have is that the artifact which you have defined as a dependency:
<dependency>
<groupId>org.codehaus.castor</groupId>
<artifactId>castor</artifactId>
<version>1.3.3</version>
</dependency>
defines a jar artifact as the error messages implies: org.codehaus.castor:castor:jar:1.3.3
The problem is that on Maven Central this kind of artifact does not exist. It only exist a pom file but not a jar file.

change generated war name using maven jetty plugin

I am using maven Struts2 blank artifact to create my web application. Here is my pom.xml :-
<?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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.website.my</groupId>
<artifactId>MyArtifact</artifactId>
<version>3</version>
<packaging>war</packaging>
<name>My Artifact</name>
<properties>
<struts2.version>2.3.12</struts2.version>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-core</artifactId>
<version>${struts2.version}</version>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-config-browser-plugin</artifactId>
<version>${struts2.version}</version>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-junit-plugin</artifactId>
<version>${struts2.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.4</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jsp-api</artifactId>
<version>2.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>8.1.7.v20120910</version>
<configuration>
<war>C:\Users\pranay\Documents\GitHub\MyArtifact\target\myWeb.war</war>
<stopKey>CTRL+C</stopKey>
<stopPort>8999</stopPort>
<systemProperties>
<systemProperty>
<name>log4j.configuration</name>
<value>/Users/lukaszlenart/Projects/Apache/STRUTS_2_3_12/target/checkout/archetypes/struts2-archetype-blank/src/main/resources/log4j.properties</value>
</systemProperty>
<systemProperty>
<name>slf4j</name>
<value>false</value>
</systemProperty>
</systemProperties>
<scanIntervalSeconds>10</scanIntervalSeconds>
<webAppSourceDirectory>/Users/lukaszlenart/Projects/Apache/STRUTS_2_3_12/target/checkout/archetypes/struts2-archetype-blank/src/main/webapp/</webAppSourceDirectory>
<webApp>
<contextPath>/MyArtifact</contextPath>
<descriptor>C:\Users\Pranay\Documents\GitHub\MyArtifact\src\main\webapp\WEB-INF</descriptor>
</webApp>
</configuration>
<dependencies>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
above pom.xml uses jetty server for creating war file.So when I run mvn jetty:war-run then it creates war file with name MyArtifact-3.war(artifactId-version), but I want my war file name to be myWeb.war. I used war tag in configuration of pom.xml to specify the war name I want(according to this link http://www.eclipse.org/jetty/documentation/current/jetty-maven-plugin.html#running-assembled-webapp-as-war). But, it is not working. Please let me know how can I change generated war file name.
Simple enough, just override the <finalName> value.
<project>
<build>
<finalName>${project.artifactId}</finalName>
</build>
</project>

Resources