Skip to content

Spring boot command line maven commands

Spring boot command line maven commands

 

How to create a spring boot jar file by using mvn command?

Open windows command prompt, go to the project location i.e where pom.xml exist and execute the following command.

In this process, by default, all test cases are also executed so it will take time to create a jar file. If any test case failed then the jar file will not be generated it means that build failed. See in the below how to skip the test case while build jar file.

Command

D:\Projects\pratush_elipse\SpringBoot-Profile-Example>mvn install

The jar will be generated under the target folder

D:\Projects\pratush_elipse\SpringBoot-Profile-Example>mvn install
[INFO] Scanning for projects...
[INFO]
[INFO] ----------< com.narayanatutorial:SpringBoot-Profile-Example >-----------
[INFO] Building SpringBoot-Profile-Example 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:3.1.0:resources (default-resources) @ SpringBoot-Profile-Example ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ SpringBoot-Profile-Example ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:3.1.0:testResources (default-testResources) @ SpringBoot-Profile-Example ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory D:\Projects\pratush_elipse\SpringBoot-Profile-Example\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:testCompile (default-testCompile) @ SpringBoot-Profile-Example ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.22.0:test (default-test) @ SpringBoot-Profile-Example ---
[INFO]
[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[INFO]
[INFO] Results:
[INFO]
[INFO] Tests run: 4, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO]
[INFO] --- maven-jar-plugin:3.1.2:jar (default-jar) @ SpringBoot-Profile-Example ---
[INFO] Building jar: D:\Projects\pratush_elipse\SpringBoot-Profile-Example\target\SpringBoot-Profile-Example-0.0.1-SNAPSHOT.jar
[INFO]
[INFO] --- spring-boot-maven-plugin:2.2.1.RELEASE:repackage (repackage) @ SpringBoot-Profile-Example ---
[INFO] Replacing main artifact with repackaged archive
[INFO]
[INFO] --- maven-install-plugin:2.5.2:install (default-install) @ SpringBoot-Profile-Example ---
[INFO] Installing D:\Projects\pratush_elipse\SpringBoot-Profile-Example\target\SpringBoot-Profile-Example-0.0.1-SNAPSHOT.jar to C:\Users\narayanaswamy.ragi\.m2\repository\com\narayanatutorial\SpringBoot-Profile-Example\0.0.1-SNAPSHOT\SpringBoot-Profile-Example-0.0.1-SNAPSHOT.jar
[INFO] Installing D:\Projects\pratush_elipse\SpringBoot-Profile-Example\pom.xml to C:\Users\narayanaswamy.ragi\.m2\repository\com\narayanatutorial\SpringBoot-Profile-Example\0.0.1-SNAPSHOT\SpringBoot-Profile-Example-0.0.1-SNAPSHOT.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  10.936 s
[INFO] Finished at: 2020-04-23T10:23:03+05:30
[INFO] ------------------------------------------------------------------------

 

Maven command to skip test case execution while creating jar

 

Command

D:\Projects\pratush_elipse\SpringBoot-Profile-Example>mvn install -DskipTests

or

D:\Projects\pratush_elipse\SpringBoot-Profile-Example>mvn install -Dmaven.test.skip=true

 

D:\Projects\pratush_elipse\SpringBoot-Profile-Example>mvn install -Dmaven.test.skip=true
[INFO] Scanning for projects...
[INFO]
[INFO] ----------< com.narayanatutorial:SpringBoot-Profile-Example >-----------
[INFO] Building SpringBoot-Profile-Example 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:3.1.0:resources (default-resources) @ SpringBoot-Profile-Example ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ SpringBoot-Profile-Example ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:3.1.0:testResources (default-testResources) @ SpringBoot-Profile-Example ---
[INFO] Not copying test resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:testCompile (default-testCompile) @ SpringBoot-Profile-Example ---
[INFO] Not compiling test sources
[INFO]
[INFO] --- maven-surefire-plugin:2.22.0:test (default-test) @ SpringBoot-Profile-Example ---
[INFO] Tests are skipped.
[INFO]
[INFO] --- maven-jar-plugin:3.1.2:jar (default-jar) @ SpringBoot-Profile-Example ---
[INFO] Building jar: D:\Projects\pratush_elipse\SpringBoot-Profile-Example\target\SpringBoot-Profile-Example-0.0.1-SNAPSHOT.jar
[INFO]
[INFO] --- spring-boot-maven-plugin:2.2.1.RELEASE:repackage (repackage) @ SpringBoot-Profile-Example ---
[INFO] Replacing main artifact with repackaged archive
[INFO]
[INFO] --- maven-install-plugin:2.5.2:install (default-install) @ SpringBoot-Profile-Example ---
[INFO] Installing D:\Projects\pratush_elipse\SpringBoot-Profile-Example\target\SpringBoot-Profile-Example-0.0.1-SNAPSHOT.jar to C:\Users\narayanaswamy.ragi\.m2\repository\com\narayanatutorial\SpringBoot-Profile-Example\0.0.1-SNAPSHOT\SpringBoot-Profile-Example-0.0.1-SNAPSHOT.jar
[INFO] Installing D:\Projects\pratush_elipse\SpringBoot-Profile-Example\pom.xml to C:\Users\narayanaswamy.ragi\.m2\repository\com\narayanatutorial\SpringBoot-Profile-Example\0.0.1-SNAPSHOT\SpringBoot-Profile-Example-0.0.1-SNAPSHOT.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  4.062 s
[INFO] Finished at: 2020-04-23T10:20:23+05:30
[INFO] ------------------------------------------------------------------------

 

Maven configuration by default to skip test case execution while creating jar

If you want to skip tests by default but want the ability to re-enable tests from the command line, you need to go via a properties section in the pom:

    <project>
      [...]
      <properties>
        <skipTests>true</skipTests>
      </properties>
      [...]
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>3.0.0-M4</version>
            <configuration>
              <skipTests>${skipTests}</skipTests>
            </configuration>
          </plugin>
        </plugins>
      </build>
      [...]
    </project>

 

And enable whenever you want to execute the test case

Command

The below command will run all the test case disabled by default in the above configuration.

D:\Projects\pratush_elipse\SpringBoot-Profile-Example>mvn install -DskipTests=false

 

pom.xml.template to pom.xml

we can generate pom.xml from pom.xml.template by using the pomgenerator command as follows.

D:\Projects\pratush_elipse\SpringBoot-Profile-Example>mvn pomgenerate:generate

 

 

References

Apache Maven Skipping Test

 

 

Leave a Reply

Show Button
Hide Button

TAUSLOT88 GAME ONLINE GRATIS sebagai Narayana Tutorial, platform ini menawarkan pengalaman bermain game online yang tak tertandingi. Dengan akses aman dan layanan 24 jam, pengguna dapat menikmati berbagai game online gratis kapan saja dan di mana saja. Keunggulan Narayana Tutorial platform ini terletak pada kemudahannya dalam mengakses game online berkualitas tinggi dengan tampilan yang responsif baik di perangkat mobile maupun PC.


Sebagai situs resmi, TAUSLOT88 GAME ONLINE GRATIS menghadirkan berbagai fitur yang memanjakan para gamer. Nikmati keuntungan bermain game online dengan metode pembayaran yang mudah dan berbagai bonus menarik yang dapat meningkatkan peluang kemenangan. Platform ini juga dikenal dengan sistem fair play yang menjamin setiap pemain memiliki kesempatan yang sama untuk meraih maxwin dalam setiap permainan.


TAUSLOT88 GAME ONLINE GRATIS menghadirkan referensi yang praktis untuk pengguna yang ingin mengenal lebih jauh dunia game online Indonesia. Dari game terbaru hingga permainan populer yang masih banyak dimainkan, informasi yang disajikan dapat menjadi bahan pertimbangan untuk menemukan game sesuai kebutuhan dan perangkat. Narayana Tutorial dengan perkembangan teknologi yang terus berjalan, mengikuti informasi game terbaru menjadi cara sederhana untuk mengetahui tren permainan digital yang sedang ramai diperbincangkan.

toto rajacuan69.net tv toto togel login pt surya toto indonesia tbk toto band meong toto joyo toto alexis toto login alternatif login alternatif mak toto slot login odeng toto dana toto 32264 nuvo toto pasti toto mini toto login link tv toto link toto slot toto toilet zoro toto slot sambal toto slot login kloset toto sambal toto link alternatif pengeluaran toto hari ini mawar toto wap m 11 toto dayak toto es toto login ips toto pengeluaran toto macau 2024 dasar toto jumpa toto masuk toto login turki toto login pajak toto slot toto tv viva toto granat toto dpl toto toto mawar paito toto macau 4 live toto macau 4d hari ini obor toto angka keluar toto macau 4d elexis toto login alternatif live draw hk toto halim toto togel prediksi jitu toto macau unggul toto toto 328 cyk toto 1001 toto nanas toto 888 situs toto 008 jenius toto login rupiah toto togel topi toto login joni toto login toko toto toto macau 5d result bam toto slot racun toto togel kupang toto login honda toto login alternatif miki toto togel kalio toto eric toto login sanji toto login wati toto login link alternatif viutoto situs toto resmi terpercaya totojitu olx toto macau login sbc toto slot toto login dua toto slot dana toto login alternatif app banker toto dosen toto slot miko toto slot fantasi toto azul toto slot mawar toto resmi ilmu toto slot kang toto 2 alexistoto togel login alexis toto yuni toto slot toto kl 4d info hari ini live hari ini ultra 4d toto tv toto slot login evil toto togel mantra toto sambal toto togel diamon toto lazada toto nias toto link alternatif fin4d toto beruk toto kise toto tarian toto king cobra toto togel login dubai toto slot pak toto slot login akses toto togel toto macau 4d dumai toto login oki toto login gawang toto partai toto togel kos toto login kartu toto togel panutan toto link alternatif bakau toto pajero toto login bb toto link toto kl opa toto login bayu toto login bbm toto rog toto login gp toto livi toto harga toto oreo 5d sekin toto toto slot --duren777 paito 5d toto macau w3 angka jitu toto penidabet toto opera toto togel keluaran toto macau 5d hari ini rejeki toto slot wisata toto login evos toto slot login pm toto login rp toto tv toto login link alternatif toto slot gacor lintas88 10001 toto live draw toto imperial toto login toto closet sensi toto saudi toto link alternatif toto 8000 login link alternatif sigma toto wati toto login alternatif mugen toto ilmu toto togel mesir toto login alternatif syair toto macau 4d mawar toto gacor batam toto login alternatif arisan toto link alternatif gajah toto tirai toto login kadek toto arwah toto link alternatif mio toto login alternatif la toto slot dpr toto dana toto togel login surya toto skin toto togel login gn toto rcti toto viper toto mio toto alternatif alexis toto alternatif paito toto macau 4d warna banten toto login link alternatif aa toto login gacor180 toto batam toto slot login wayang toto eda toto login laku toto link alternatif login cancer toto togel login bujang toto login olx toto apk toto playme8 rupiah100 toto sultan toto login heylink saham toto login singosari toto login king house toto jarak lubang kloset duduk toto payung toto slot sakau toto link alternatif logam toto login toto nusa koi toto login alternatif cemara toto pelita toto link alternatif bembeng toto markas toto login toto slot --rupiahtoto🚀 lipan toto t0p 1 toto bella toto mio toto link situs toto login password toto slot sip777💰 denis toto login padang toto login rokokbet toto nmax toto sambo toto login situs toto 139 login toto cc dhl toto link alternatif hujan toto login toto macau --win(77superslot) mangga toto login slot toto 4d cantik toto alexis togel toto duo toto login sumbar toto login son toto saham toto togel login dana toto togel live toto anita toto login baruna toto taysen toto 77 menpora toto rawon toto login rukan toto polo toto login maria toto togel situstoto situs toto 176 login alternatif link alternatif mio toto 88 login toto super login toto king678.com hujan toto togel arai toto ojk toto mega toto 5d win asia toto 88 sapi toto login toto wastafel draw toto macau fuso toto login hoki toto login