How to copy .war to Tomcat’s webapps directory using Maven?

<build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-war-plugin</artifactId> <version>3.2.1</version> <configuration> <outputDirectory><!– Tomcat webapps location–></outputDirectory> <!– Example of Tomcat webapps location :D:\tomcat\webapps\ –> </configuration> </plugin> </plugins> </build> Once you have added it to your pom.xml, you can copy the WAR file by calling mvn package or mvn war:war.

Maven: Overview for the values of Maven properties

As a workaround, add this to the <plugins> … </plugins> section inside your project’s pom.xml: <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-antrun-plugin</artifactId> <version>1.7</version> <executions> <execution> <phase>validate</phase> <goals> <goal>run</goal> </goals> <configuration> <tasks> <echoproperties /> </tasks> </configuration> </execution> </executions> </plugin> Now execute mvn validate. On the console, prefixed with [echoproperties], there will be the full list of system properties, including those … Read more

Changing the order of maven plugins execution

Since you say you are very new to Maven….Maven builds are executions of an ordered series of phases. These phases are determined by the lifecycle that is appropriate to your project based on its packaging. Therefore, you control when a plugin’s goal is executed by binding it to a particular phase. Hope that helps. EDIT: … Read more

Maven:Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:2.7:resources

With: <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-resources-plugin</artifactId> <version>2.7</version> </plugin> Was getting the following exception: … Caused by: org.apache.maven.plugin.MojoExecutionException: Mark invalid at org.apache.maven.plugin.resources.ResourcesMojo.execute(ResourcesMojo.java:306) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:132) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208) … 25 more Caused by: org.apache.maven.shared.filtering.MavenFilteringException: Mark invalid at org.apache.maven.shared.filtering.DefaultMavenFileFilter.copyFile(DefaultMavenFileFilter.java:129) at org.apache.maven.shared.filtering.DefaultMavenResourcesFiltering.filterResources(DefaultMavenResourcesFiltering.java:264) at org.apache.maven.plugin.resources.ResourcesMojo.execute(ResourcesMojo.java:300) … 27 more Caused by: java.io.IOException: Mark invalid at java.io.BufferedReader.reset(BufferedReader.java:505) at org.apache.maven.shared.filtering.MultiDelimiterInterpolatorFilterReaderLineEnding.read(MultiDelimiterInterpolatorFilterReaderLineEnding.java:416) at org.apache.maven.shared.filtering.MultiDelimiterInterpolatorFilterReaderLineEnding.read(MultiDelimiterInterpolatorFilterReaderLineEnding.java:205) at java.io.Reader.read(Reader.java:140) at org.apache.maven.shared.utils.io.IOUtil.copy(IOUtil.java:181) … Read more

What is the best way to avoid maven-jar?

In Maven 3.0.x (I tried 3.0.2) you can disable maven-jar-plugin by binding the default-jar execution to a nonexistent phase, as @bmargulies suggested. Unfortunately that doesn’t work in 2.2.1, but you can prevent it from interfering with your own jar by setting an alternative <finalName> and <classifier> for the default-jar execution; it will still create a … Read more

How to check pom.xml for updated dependencies

You can do this with the Versions Maven Plugin. Check the following goals: versions:display-dependency-updates scans a project’s dependencies and produces a report of those dependencies which have newer versions available. versions:display-plugin-updates scans a project’s plugins and produces a report of those plugins which have newer versions available. Here is a sample output (taken from the … Read more

m2e lifecycle-mapping not found

The org.eclipse.m2e:lifecycle-mapping plugin doesn’t exist actually. It should be used from the <build><pluginManagement> section of your pom.xml. That way, it’s not resolved by Maven but can be read by m2e. But a more practical solution to your problem would be to install the m2e build-helper connector in eclipse. You can install it from the Window … Read more

Plugins in Maven and POM.xml

<project> <groupId>org.koshik.javabrains</groupId> <artifactId>JarName</artifactId> (A fldernamed JarName was created) <version>1.0-SNAPSHOT</version> <packaging>jar</packaging> <name>JarName</name> <url>http://maven.apache.org</url> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties> <build> <plugins> <plugin> <groupId>org.jibx</groupId> <artifactId>jibx-maven-plugin</artifactId> <version>1.2.4</version> <executions> <execution> <goals> <goal>bind</goal> </goals> </execution> </executions> </plugin> </plugins> </build> <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>3.8.1</version> <scope>test</scope> </dependency> </dependencies> </project> You can also place plugins in the <build> section of <profile> if you use maven … Read more

Maven 2 assembly with dependencies: jar under scope “system” not included

I’m not surprised that system scope dependencies are not added (after all, dependencies with a system scope must be explicitly provided by definition). Actually, if you really don’t want to put that dependency in your local repository (for example because you want to distribute it as part of your project), this is what I would … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)