JAVA EXAMPLE PROGRAMS

JAVA EXAMPLE PROGRAMS

Publish Your Article Here

How to exclude property files in a jar using Maven


This page shows how to exclude property file from the final build. The final build can be jar file or war file or ear file. You need to place below code snippet in your maven pom.xml file to exclude property files. You need to specify the directory where the files are reside in your application structure. Also you need to specify the file types to be excluded using exclude tag. Below code excludes any file name ending with .properties extension.

	<build>
		<finalName>gtmapi</finalName>
		<resources>
			<resource>
				<directory>src/main/resources</directory>
				<excludes>
					<exclude>*.properties</exclude>
				</excludes>
				<filtering>false</filtering>
			</resource>
		</resources>
	</build>

This code also helpful to exlude anyother file types. All you need to do is provide proper file extension. Below code excludes any file ends with .txt extension.

	<build>
		<finalName>gtmapi</finalName>
		<resources>
			<resource>
				<directory>src/main/resources</directory>
				<excludes>
					<exclude>*.txt</exclude>
				</excludes>
				<filtering>false</filtering>
			</resource>
		</resources>
	</build>

Java problems and solutions

  1. Unable to install Java 7 in Eclipse on Mac - Java 7 Mac OS issues
  2. How to change Java (JVM) version in Mac OS? - Java version Mac OS issues
  3. SunCertPathBuilderException: Unable To Find Valid Certification Path To Requested Target
  4. How to merge two jssecacerts files? - Merge key store files
  5. How to write Micro-Benchmark for java Hotspot?
  6. servlet-api-2.5.jar - jar not loaded - tomcat error
  7. How to exclude property files in a jar using Maven
  8. ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
  9. CGLIB is required to process @Configuration classes
  10. Git command to list conflicted files
  11. Where is default localhost folder in Mac OSX?
  12. How to edit hosts file on Mac OSX
  13. How to set up java version in Maven based projects?
  14. How to split a string by new line character in java?
Knowledge Centre
Prevent a method from being overridden
By specifying final keyword to the method you can avoid overriding in a subcalss. Similarlly one can use final at class level to prevent creating subclasses.
Famous Quotations
I don’t know the key to success, but the key to failure is trying to please everybody.
-- Bill Cosby

About Author

I'm Nataraja Gootooru, programmer by profession and passionate about technologies. All examples given here are as simple as possible to help beginners. The source code is compiled and tested in my dev environment.

If you come across any mistakes or bugs, please email me to [email protected] or you can comment on the page.

Most Visited Pages

Other Interesting Sites

Reference: Java™ Platform Standard Ed. 7 - API Specification | Java is registered trademark of Oracle.
Privacy Policy | Copyright © 2017 by Nataraja Gootooru. All Rights Reserved.