Where can I store this property for use by Maven and Java? -


i'm using maven 3.0.3 , java 6. want put wsdl url property somewhere both maven build process can acccess , runtime java code (i'm building maven jar project) can access. how structure/configure this? in runtime java code, have like

string wsdlurl = getproperty("wsdl.url"); 

and in maven, want access wsdl url in plugin ...

                    <plugin>                             <groupid>org.codehaus.mojo</groupid>                             <artifactid>jaxws-maven-plugin</artifactid>                             <executions>                                     <execution>                                             <goals>                                                     <goal>wsimport</goal>                                             </goals>                                             <configuration>                                                     <wsdlurls>                                                             <wsdlurl>${wsdl.url}</wsdlurl>                                                     </wsdlurls>                                                     <sourcedestdir>${basedir}/src/main/java</sourcedestdir>                                                     <packagename>org.myco.bsorg</packagename>                                             </configuration>                                     </execution>                             </executions>                     </plugin> 

create .properties file inside src/main/resources directory.

inside pom.xml

use properties-maven-plugin , load properties file, (after usage site):

<project>   <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>src/main/resources/common.properties</file>               </files>             </configuration>           </execution>         </executions>       </plugin>     </plugins>   </build> </project> 

from java

use properties#load(inputstream) , load properties this:

string propertiesfilename = "/common.properties";  properties properties = new properties(); inputstream inputstream = this.getclass().getclassloader()     .getresourceasstream(propertiesfilename);  properties.load(inputstream); 

Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -