Removed maven-all project since it was moved to maven-modules.
This commit is contained in:
parent
6bd023a04d
commit
480775b0c4
|
@ -1,2 +0,0 @@
|
|||
/output-resources
|
||||
/.idea/
|
|
@ -1,6 +0,0 @@
|
|||
## Apache Maven
|
||||
|
||||
This module contains articles about core Apache Maven. Articles about other Maven plugins (such as the Maven WAR Plugin)
|
||||
have their own dedicated modules.
|
||||
|
||||
### Relevant Articles
|
|
@ -1,51 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<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>
|
||||
<artifactId>maven-2</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<name>maven-2</name>
|
||||
|
||||
<parent>
|
||||
<groupId>com.baeldung</groupId>
|
||||
<artifactId>parent-modules</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.13</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>properties-maven-plugin</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>generate-resources</phase>
|
||||
<goals>
|
||||
<goal>write-project-properties</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<outputFile>${project.build.outputDirectory}/properties-from-pom.properties</outputFile>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<properties>
|
||||
<name>${project.name}</name>
|
||||
<my.awesome.property>property-from-pom</my.awesome.property>
|
||||
</properties>
|
||||
|
||||
</project>
|
|
@ -1,41 +0,0 @@
|
|||
package com.baeldung.maven.properties;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.Properties;
|
||||
|
||||
/**
|
||||
* Reads properties from one file.
|
||||
*
|
||||
* @author Donato Rimenti
|
||||
*/
|
||||
public class PropertiesReader {
|
||||
|
||||
/**
|
||||
* Properties managed by this reader.
|
||||
*/
|
||||
private Properties properties;
|
||||
|
||||
/**
|
||||
* Reads the property file with the given name.
|
||||
*
|
||||
* @param propertyFileName the name of the property file to read
|
||||
* @throws IOException if the file is not found or there's a problem reading it
|
||||
*/
|
||||
public PropertiesReader(String propertyFileName) throws IOException {
|
||||
InputStream is = getClass().getClassLoader()
|
||||
.getResourceAsStream(propertyFileName);
|
||||
this.properties = new Properties();
|
||||
this.properties.load(is);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the property with the given name from the property file.
|
||||
* @param propertyName the name of the property to read
|
||||
* @return the property with the given name
|
||||
*/
|
||||
public String getProperty(String propertyName) {
|
||||
return this.properties.getProperty(propertyName);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
package com.baeldung.maven.properties;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* Test for {@link PropertiesReader}.
|
||||
*
|
||||
* @author Donato Rimenti
|
||||
*/
|
||||
public class PropertiesReaderUnitTest {
|
||||
|
||||
/**
|
||||
* Reads a property and checks that's the one expected.
|
||||
*
|
||||
* @throws IOException if anything goes wrong
|
||||
*/
|
||||
@Test
|
||||
public void givenPomProperties_whenPropertyRead_thenPropertyReturned() throws IOException {
|
||||
PropertiesReader reader = new PropertiesReader("properties-from-pom.properties");
|
||||
String property = reader.getProperty("my.awesome.property");
|
||||
Assert.assertEquals("property-from-pom", property);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue