<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>POM &#8211; CodePills.com</title>
	<atom:link href="https://codepills.com/tag/pom/feed/" rel="self" type="application/rss+xml" />
	<link>https://codepills.com</link>
	<description>Helping you make a better code</description>
	<lastBuildDate>Fri, 10 Jun 2022 22:27:14 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	
	<item>
		<title>How to build with Maven without running tests</title>
		<link>https://codepills.com/how-to-build-with-maven-without-running-tests/</link>
					<comments>https://codepills.com/how-to-build-with-maven-without-running-tests/#comments</comments>
		
		<dc:creator><![CDATA[Andrej Buday]]></dc:creator>
		<pubDate>Thu, 03 Dec 2020 14:44:49 +0000</pubDate>
				<category><![CDATA[Tips & tricks]]></category>
		<category><![CDATA[build]]></category>
		<category><![CDATA[JAR]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Maven]]></category>
		<category><![CDATA[optimization]]></category>
		<category><![CDATA[POM]]></category>
		<category><![CDATA[speed]]></category>
		<category><![CDATA[Spring]]></category>
		<category><![CDATA[SpringBoot]]></category>
		<category><![CDATA[Surefire]]></category>
		<category><![CDATA[tests]]></category>
		<guid isPermaLink="false">https://codepills.com/?p=1084</guid>

					<description><![CDATA[This article will show you multiple ways how to skip the test in your Maven build <a href="https://codepills.com/how-to-build-with-maven-without-running-tests/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
										<content:encoded><![CDATA[<p>Do you try to build your app after the slightest change in code, and it takes ages to pass all the tests? What if there would be a workaround to obey all unnecessary tests and significantly shorten the Maven build time. And all that just but simple maven flag.</p>
<p><span id="more-1084"></span></p>
<p>Whether you want to build your SpringBoot app into the executable JAR file or build classes for a package, remember to use the single Maven flag parameter <code>mvn install -DskipTests</code>, and in the most cases, you will be fine.</p>
<p>However, the rabbit might run deeper, so it will be better to write a bit more info.</p>
<p><code>-DskipTests</code> option only works from Surefire 2.4. Unfortunately, there are no error messages if you do try to use it with Surefire 2.3 or lower. Therefore, your first task is to check your version of Surefire. For this, run <code>mvn -X test</code> and look for a line that mentions surefire. It should look like this: <code>maven-surefire-plugin: resolved to version 2.3 from repository central</code>. If you use pre-Surefire-2.4 start using <code>-Dmaven.test.skip=true</code>.</p>
<p>Fortunately beyond 2020 older version usage shrinks and you should remember to always favor a <code>-DskipTests </code> above <code>-Dmaven.test.skip=true</code>.</p>
<p>Surefire itself is the intermediate plugin between Maven and JUnit/TestNG for which while <code>-DskipTests </code> works and <code>-Dmaven.test.skip=true</code> works for compiler.</p>
<p>You can find (not really much more) additional info about shortening the build time trough skipping the project tests at <a href="https://maven.apache.org/surefire/maven-surefire-plugin/examples/skipping-tests.html" target="_blank" rel="nofollow noopener">maven skipping tests</a> site.</p>
<p>You can add this plugin configuration to your pom if you do not want to set command line arguments:</p>
<pre><code class="language-xml">&lt;plugin&gt;
    &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
    &lt;artifactId&gt;maven-surefire-plugin&lt;/artifactId&gt;
    &lt;configuration&gt;
        &lt;skipTests&gt;true&lt;/skipTests&gt;
    &lt;/configuration&gt;
&lt;/plugin&gt;</code></pre>
<p>Or you can also set skipping tests in you POM file over property:</p>
<pre><code class="language-xml">&lt;properties&gt;
    &lt;maven.test.skip&gt;true&lt;/maven.test.skip&gt;
&lt;/properties&gt;</code></pre>
<p><b>Bonus</b></p>
<p>You can also skip tests in IntelliJ Idea. Just go to Maven tool tab and hit <b>&#8216;Skip Test&#8217;</b> mode.</p>
<p><img decoding="async" class="size-full wp-image-1085 aligncenter" src="https://codepills.com/wp-content/uploads/2020/12/skip_test_maven_in_intellij_idea.png" alt="Skip test Maven in IntelliJ Idea" width="369" height="109" srcset="https://codepills.com/wp-content/uploads/2020/12/skip_test_maven_in_intellij_idea.png 369w, https://codepills.com/wp-content/uploads/2020/12/skip_test_maven_in_intellij_idea-300x89.png 300w" sizes="(max-width: 369px) 100vw, 369px" /></p>
]]></content:encoded>
					
					<wfw:commentRss>https://codepills.com/how-to-build-with-maven-without-running-tests/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
	</channel>
</rss>
