Unable to disable generation of sources JAR with maven-release-plugin - maven-2

I am trying to release a web project using Maven 2.2.1 and the maven-release-plugin 2.0-beta-9, but it always fails when doing release:perform on generating the sources jar for the EAR project, which makes sense since the EAR project doesn't have any source.
[INFO] [INFO] [source:jar {execution: attach-sources}]
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [ERROR] BUILD ERROR
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [INFO] Error creating source archive: You must set at least one file.
To try to disable the building of a sources JAR for the EAR project, I added the following to the POM for my EAR project (the version of the release plugin is set in a parent POM):
<build>
<plugins>
...
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<configuration>
<useReleaseProfile>false</useReleaseProfile>
</configuration>
</plugin>
</plugins>
</build>
Upon running the release again after checking in this change, I got the same error while generating the sources JAR for the EAR project, even though this should have been disabled by the previous POM snippet.
What am I doing wrong? Why is the sources JAR still being built?
Edit:
I've tried to make the source plugin include my application.xml file so that this error doesn't occur by adding the following POM snippet:
<build>
<plugins>
...
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<configuration>
<includes>
<include>${basedir}/META-INF/**/*</include>
</includes>
<useDefaultExcludes>false</useDefaultExcludes>
</configuration>
</plugin>
</plugins>
</build>
Unfortunately, this does not fix the problem either.

I finally figured it out. I needed to add my source files as part of the references:
<resources>
<resource>
<directory>${project.basedir}</directory>
<includes>
<include>META-INF/**/*</include>
</includes>
<excludes>
<exclude>target/**/*</exclude>
<exclude>bin/**/*</exclude>
<exclude>META-INF/.svn/**/*</exclude>
</excludes>
</resource>
</resources>
Doing this made everything work again. I didn't need any special configuration for the release or source plugins to get it to work.

There was a bug in the maven-source-plugin version 2.1 that resulted in the same error as you describe here. Newer Version >= 2.1.1 contain the fix. Here is a link to this Bug for further information. http://jira.codehaus.org/browse/MSOURCES-44

Related

Maven Ear Plugin use missing class on plexus-utils

For project circumstances, I'm using older versions of Maven and Java, when I try to package the project, using maven ear plugin 2.7, uses plexus-utils version 1.1
The problem... It calls org.codehaus.plexus.util.xml.XmlStreamWriter, this class is not on plexus-utils version 1.1
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-ear-plugin:2.7:generate-application-xml (default-generate-application-xml) on project PROJECT_NAME: Execution default-generate-application-xml of goal org.apache.maven.plugins:maven-ear-plugin:2.7:generate-application-xml failed: A required class was missing while executing org.apache.maven.plugins:maven-ear-plugin:2.7:generate-application-xml: org/codehaus/plexus/util/xml/XmlStreamWriter
How it the way to force ear plugin to use other version of plexus-utils who include this class?
A part of pom file:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ear-plugin</artifactId>
<version>2.7</version>
<configuration>
<finalName>PROJECT_NAME</finalName>
<displayName>PROJECT_NAME</displayName>
<modules>
<webModule>
<groupId>some.group</groupId>
<artifactId>some.artifact</artifactId>
<bundleFileName>PROJECT_NAME_01.war</bundleFileName>
<contextRoot>/PROJECT_NAME_01</contextRoot>
</webModule>
</modules>
</configuration>
</plugin>
</plugins>
</build>
Thanks

Dependencies In Same Reactor

I have a very simple Tycho reactor with two modules: one is a standard Maven project with this addition to make it a bundle:
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<executions>
<execution>
<id>default-bundle</id>
<phase>package</phase>
<goals>
<goal>bundle</goal>
</goals>
<configuration>
<instructions>
<Export-Package>org.acme.jar</Export-Package>
</instructions>
<manifestLocation>META-INF</manifestLocation>
</configuration>
</execution>
</executions>
</plugin>
The second is a Tycho project that has a dependency to the above JAR in the MANIFEST.MF.
If I start the build, I get the following exception:
[ERROR] Cannot resolve project dependencies:
[ERROR] Software being installed: plugin 0.0.1.qualifier
[ERROR] Missing requirement: plugin 0.0.1.qualifier requires 'bundle org.acme.jar 0.0.1' but it could not be found
Which is really weird, because the bundle is in the same reactor.
But no worries, I can just add the Maven dependency, too:
<!-- parent pom.xml -->
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>target-platform-configuration</artifactId>
<version>0.26.0</version>
<configuration>
<pomDependencies>consider</pomDependencies>
</configuration>
</plugin>
<!-- plug-in pom.xml -->
<dependencies>
<dependency>
<groupId>org.acme</groupId>
<artifactId>jar</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
Still I get the same exception, which is weird because the documentation claims: Maven resolves the GAV dependencies according to the normal Maven rules.
That's just not true. Evidently org.acme.jar doesn't get resolved. Or maybe Tycho fails to see that it's a bundle.
The JAR module is an API project used for server side components, and we want to drop SWT / Tycho in the long run, so it's not an option to make org.acme.jar an Eclipse plug-in.
How do I define dependencies in the same reactor for Tycho?
I’m afraid that what you ask for is currently not possible. The Tycho Wiki documents this limitation in the dependency on pom-first artifacts HOW-TO.
That being said, if you really want your whole build (maven-bundle-plugin and Tycho parts) to run with a single mvn clean install, then using the maven-invoker-plugin at the end of the “plain Maven” build to fork a “Tycho build” should work. It’s a rather cumbersome workaround, however (example on Github).

Installing and deploying a maven artifact with version constructed by custom properties

I have a Maven project that generates a WAR file and tries to get the artifact version from properties in .properties files that are maintained in the codebase. I also try to form the final name of the WAR file using custom properties.
Snippet :
<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.xyz.webapps</groupId>
<artifactId>webapps</artifactId>
<version>${info.version}-${application.env}</version>
<packaging>war</packaging>
<!-- Filling in the artifact version with properties read below -->
...
<!-- Filling in the WAR name -->
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.war.final.name>${pom.artifactId}-${pom.currentVersion}.war</maven.war.final.name>
<maven.test.skip>true</maven.test.skip>
</properties>
...
<build>
<plugins>
...
<!-- I read those properties files here -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
<version>1.0-alpha-2</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>read-project-properties</goal>
</goals>
<configuration>
<files>
<file>${project.basedir}/webapps-main/src/main/resources/MessageResources.properties</file>
<file>${project.basedir}/build.properties</file>
</files>
</configuration>
</execution>
</executions>
</plugin>
...
</plugins>
...
</project>
The name of the WAR file gets generated properly when I do a "mvn clean package" :
[INFO] Assembling webapp[webapps] in [/home/jubuntu/workspace/ui/new/webapps/target/webapps-2.8-qa]
[INFO] Processing war project
[INFO] Copying webapp resources[/home/jubuntu/workspace/ui/new/webapps/webapps-main/src/main/webapp]
[INFO] Webapp assembled in [4690 msecs]
[INFO] Building war: /home/jubuntu/workspace/ui/new/webapps/target/webapps-2.8-qa.war
But when I do a "mvn clean install" ( or a "mvn clean deploy" ) , the properties don't expand for some reason (the package phase still generates the WAR with the right name) :
[INFO] Building war: /home/jubuntu/workspace/ui/new/webapps/target/webapps-2.8-qa.war
[INFO] [install:install {execution: default-install}]
[INFO] Installing /home/jubuntu/workspace/ui/new/webapps/target/webapps-2.8-qa.war to /home/jubuntu/.m2/repository/com/xyz/webapps/webapps/${info.version}-${application.env}/webapps-${info.version}-${application.env}.war
Is there something wrong that I'm doing here ? How would I make this work for installing and deploying my artifact ? I use maven version 2.2.1 for my builds. Thanks.
You can't do this. It's not supported by Maven. It's fundamental.

Cannot construct org.apache.maven.plugin.war.util.WebappStructure as it does not have a no-args constructor

[INFO] [war:war {execution: default-war}]
[INFO] Packaging webapp
[INFO] ------------------------------------------------------------------------
[ERROR] FATAL ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Cannot construct org.apache.maven.plugin.war.util.WebappStructure as it does not have a no-args constructor
---- Debugging information ----
message : Cannot construct org.apache.maven.plugin.war.util.WebappStructure as it does not have a no-args constructor
cause-exception : com.thoughtworks.xstream.converters.reflection.ObjectAccessException
cause-message : Cannot construct org.apache.maven.plugin.war.util.WebappStructure as it does not have a no-args constructor
class : org.apache.maven.plugin.war.util.WebappStructure
required-type : org.apache.maven.plugin.war.util.WebappStructure
path : /webapp-structure
line number : 1
-------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] Trace
com.thoughtworks.xstream.converters.ConversionException: Cannot construct org.apache.maven.plugin.war.util.WebappStructure as it does not have a no-args constructor
---- Debugging information ----
message : Cannot construct org.apache.maven.plugin.war.util.WebappStructure as it does not have a no-args constructor
cause-exception : com.thoughtworks.xstream.converters.reflection.ObjectAccessException
cause-message : Cannot construct org.apache.maven.plugin.war.util.WebappStructure as it does not have a no-args constructor
class : org.apache.maven.plugin.war.util.WebappStructure
required-type : org.apache.maven.plugin.war.util.WebappStructure
path : /webapp-structure
line number : 1
-------------------------------
at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:63)
at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:45)
at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:46)
at com.thoughtworks.xstream.core.TreeUnmarshaller.start(TreeUnmarshaller.java:117)
at com.thoughtworks.xstream.core.ReferenceByXPathMarshallingStrategy.unmarshal(ReferenceByXPathMarshallingStrategy.java:29)
at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:846)
at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:833)
at com.thoughtworks.xstream.XStream.fromXML(XStream.java:781)
at org.apache.maven.plugin.war.util.WebappStructureSerializer.fromXml(WebappStructureSerializer.java:73)
at org.apache.maven.plugin.war.AbstractWarMojo.buildWebapp(AbstractWarMojo.java:404)
at org.apache.maven.plugin.war.AbstractWarMojo.buildExplodedWebapp(AbstractWarMojo.java:375)
at org.apache.maven.plugin.war.WarMojo.performPackaging(WarMojo.java:181)
at org.apache.maven.plugin.war.WarMojo.execute(WarMojo.java:143)
at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:556)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:535)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: com.thoughtworks.xstream.converters.reflection.ObjectAccessException: Cannot construct org.apache.maven.plugin.war.util.WebappStructure as it does not have a no-args constructor
at com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider.newInstance(PureJavaReflectionProvider.java:59)
at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.instantiateNewInstance(AbstractReflectionConverter.java:257)
at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.unmarshal(AbstractReflectionConverter.java:124)
at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:56)
... 31 more
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4 seconds
[INFO] Finished at: Sat Sep 24 17:25:45 CEST 2011
[INFO] Final Memory: 15M/37M
[INFO] ------------------------------------------------------------------------
JDK: 1.7
Maven compiler Plugin:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
</plugin>
When I run install target above error occurs, how can I resolve it?
Perhaps a version of maven war plugin is being used, which does not work with Java 7? As per this issue (which describes a similar problem), 2.1.1 version of maven war plugin should work.
Include the following in your pom.xml
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
</plugin>
I had this problem when doing a mvn install. I resolved it by doing a mvn clean first, followed by a mvn install.
Using maven 2.1.1, JDK 1.7.0.45.
It's confirmed: JDK7 with Maven 2.x will produce this error.
I am using Maven 2.2.1 and JDK7 and got this error. I changed the JDK to version 1.6 and it's working fine.
Instead of changing JDK versions and Maven versions, try this:
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
<version>2.3.2</version>
</plugin>
Confirmed, I ran into the same issue with maven 3.0.2 and jdk 1.7.0_02. After running against jdk 1.6.0_30 it compiled just fine.
I don't think the version was the problem.
I solved deleting my target folder (because it contains webapp-cache.xml) and doing Maven install again.
Apache Maven WAR Plugin 3.0.0 resolved all issues:
<artifactId>maven-war-plugin</artifactId>
<version>3.0.0</version>
It doesn't matter if you use jdk 1.6, 1.7 or 1.8
This definitely seems to be related to incompatible plugin, library and language versions.
Two years, and two Java versions later, I had this same error while doing a sample project from an older book on Spring and Hibernate.
I was able to resolve the error by commenting out all of the version tags for the apache.maven.plugins and setting the Java version to 1.8. This let me know what was the latest and greatest version of the libraries, with the cost of some warnings from Maven about missing the version tags. If you care about the warnings, you can set the version tags to be latest version and the warnings from Maven should go away.
I executed mvn clean package and then just mvn package.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<!-- <version>2.1-beta-1</version> -->
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<!-- <version>2.1</version> -->
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
if your using jdk 1.6 kindly add this plugin entry to your pom.xml
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<compilerArgument>-Xlint:all</compilerArgument>
<showWarnings>true</showWarnings>
<showDeprecation>true</showDeprecation>
</configuration>
</plugin>
I had this problem with my eclipse Kepler. As soon as I moved to 4.4 (Luna) , all gone. Must be an issue with eclipse + maven embedded
I tried both JDK 1.7 and 1.8. No difference.
For me changing plugin version could not solve problme and changing JDK version is not in my control.
However running mvn clean before mvn tomcat6:deploy solved this problem.
Make sure to have the JDK version in your Build path and the version specified in the
source tag match the same.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.1</version>
<configuration>
**<source>1.7</source>**
<target>1.7</target>
<debug>true</debug>
</configuration>
</plugin> `
I had the build path pointing to jdk 1.7 and "1.6" in the source tag, when I corrected the version to 1.7 in source tag the issue got resolved.
Execute mnv clean and mvn package.
Try to delete all your cache. When i deleted target folder, it works fine.
(Target folder is where maven puts all compiled code)
I was getting the same error after i upgraded my java version from 8 to some 8.x, i fixed it by going to pom then 1. right click > maven > add plugin 2. type in org.apache.maven and then look for war plugin add it and save, then just clean and install. It should work.
use this plugin
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>3.2.2</version>
</plugin>
Example pom.xml
pom.xml screenshot`
Use this below plugin to get rid of this issue ( Latest ) and refer this
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.10.1</version>
<configuration>
<source>11</source>
<target>11</target>
</configuration>
</plugin>
</plugins>
<finalName>SampleProject</finalName>
</build>

properties-maven-plugin: Error loading properties-file

I want to extract all the properties from my pom.xml into a properties-file. These are the common properties like dependency-versions, plugin-versions and directories.
I'm using the properties-maven-plugin, but its not working as i want it to.
The essential part of my pom.xml:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
<version>1.0-alpha-1</version>
<executions>
<execution>
<phase>initialize</phase>
<goals>
<goal>read-project-properties</goal>
</goals>
<configuration>
<files>
<file>${basedir}/pom.properties</file>
</files>
</configuration>
</execution>
</executions>
</plugin>
Now when i run "mvn properties:read-project-properties" i get the following error:
[INFO] One or more required plugin parameters are invalid/missing for 'properties:read-project-properties'
[0] Inside the definition for plugin 'properties-maven-plugin' specify the following:
<configuration>
...
<files>VALUE</files>
</configuration>.
The pom.properties-file is located in the same dir as the pom.xml.
What can i do to let the properties-maven-plugin read my properties-file?
EDIT
I filed an issue at http://jira.codehaus.org/browse/MOJO-1523.
It has been closed as "not a bug", the reason is:
It's by design. The project definition
has to be self-contained, otherwise it
is no longer complete if it is refered
from elsewhere as part of the
transitive deps.
Your configuration element is defined inside an execution and thus applies to this execution only.
So either call mvn initialize (or a phase posterior to initialize) to use the configuration of your current execution binding.
Or use a global configuration:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
<version>1.0-alpha-2</version>
<configuration>
<files>
<file>etc/config/dev.properties</file>
</files>
</configuration>
...
</plugin>
And then call
mvn properties:read-project-properties
But that wouldn't make much sense in the particular case of this plugin (you want the properties to be available during the build) so this leaves you with the first solution.
Update: I did a test on my side and, indeed, with the following POM:
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>com.stackoverflow</groupId>
<artifactId>Q2664362</artifactId>
<version>1.0-SNAPSHOT</version>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
<version>1.0-alpha-2</version>
<executions>
<execution>
<phase>initialize</phase>
<goals>
<goal>read-project-properties</goal>
</goals>
<configuration>
<files>
<file>etc/config/dev.properties</file>
</files>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
Running mvn test won't work: maven will try to download junit:jar:${junit.version} (i.e. it doesn't use the value of the property) and this will obviously fail.
$ mvn test
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building SO - Q2664362 - maven-properties-plugin demo
[INFO] task-segment: [test]
[INFO] ------------------------------------------------------------------------
[INFO] [properties:read-project-properties {execution: default}]
[INFO] [resources:resources {execution: default-resources}]
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /home/pascal/Projects/stackoverflow/Q2664362/src/main/resources
Downloading: http://repo1.maven.org/maven2/junit/junit/${junit.version}/junit-${junit.version}.pom
[INFO] Unable to find resource 'junit:junit:pom:${junit.version}' in repository central (http://repo1.maven.org/maven2)
[INFO] [compiler:compile {execution: default-compile}]
[INFO] Nothing to compile - all classes are up to date
[INFO] [resources:testResources {execution: default-testResources}]
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /home/pascal/Projects/stackoverflow/Q2664362/src/test/resources
Downloading: http://repo1.maven.org/maven2/junit/junit/${junit.version}/junit-${junit.version}.jar
[INFO] Unable to find resource 'junit:junit:jar:${junit.version}' in repository central (http://repo1.maven.org/maven2)
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failed to resolve artifact.
...
The odd part is that the download of the dependency occurs after properties:read-project-properties. I'm not sure but this sounds like a bug, you should open an issue.
Try using validate phase instead of initialize for maven 3.x (link).
EDIT2
See here for a workaround using Ant Tasks, which makes this use case possible
I encounter your question, but i tried to add this resources here, it works well.
<build>
<resources>
<resource>
<directory>src/config</directory> //your config folder
<filtering>true</filtering>
</resource>
</resources>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
<version>1.0-alpha-2</version>
<executions>
<execution>
<phase>initialize</phase>
<goals>
<goal>read-project-properties</goal>
</goals>
<configuration>
<files>
<file>src/config/config.properties</file> //your config file
</files>
</configuration>
</execution>
</executions>
</plugin>
</build>
Hope you resolve this as above