Giter Club home page Giter Club logo

properties-maven-plugin's Introduction

MojoHaus Properties Maven Plugin

This is the properties-maven-plugin.

Maven Central GitHub CI

Releasing

  • Make sure gpg-agent is running.
  • Execute mvn -B release:prepare release:perform

For publishing the site do the following:

cd target/checkout
mvn verify site site:stage scm-publish:publish-scm

properties-maven-plugin's People

Contributors

akuhtz avatar bentmann avatar borisbrodski avatar dantran avatar davidkarlsen avatar dennisl avatar dependabot[bot] avatar diamondt avatar hboutemy avatar imadbl avatar jglick avatar khmarbaise avatar kreyssel avatar marko-stankovic avatar mcarlett avatar mykelalvis avatar olamy avatar pgier avatar psenechal-stingray avatar reda-alaoui avatar slachiewicz avatar slawekjaranowski avatar stefanbirkner avatar trygvis avatar yassirh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

properties-maven-plugin's Issues

Expanding default values

Not sure if I'm doing something obviously wrong, but noticing odd behavior where nested placeholders aren't being properly parsed.

Setting up the simple example:
local.properties

defined.value=myValue
some.value=${defined.value:${user.home}}

pom.xml

<build>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>properties-maven-plugin</artifactId>
                <version>1.2.1</version>
                <executions>
                    <execution>
                        <id>read-properties</id>
                        <phase>pre-clean</phase>
                        <goals>
                            <goal>read-project-properties</goal>
                        </goals>
                        <configuration>
                            <useDefaultValues>true</useDefaultValues>
                            <files>
                                <file>${project.basedir}/local.properties</file>
                            </files>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
</build>

${some.value} is resolving as myValue} (Note the unwanted }).

Looking at the logic in https://github.com/mojohaus/properties-maven-plugin/blob/master/src/main/java/org/codehaus/mojo/properties/DefaultValuesAwareExpansionBufferImpl.java#L32-L43 (and related logic in https://github.com/mojohaus/properties-maven-plugin/blob/master/src/main/java/org/codehaus/mojo/properties/ExpansionBuffer.java#L60-L81)

It doesn't seem, offhand, that nested placeholders are being properly accounted for, or am I making a silly mistake?

Hope to add SetProjectPropertiesMojo

I use properties-maven-plugin to load the configuration file through ReadPropertiesMojo in the pom to skip some plugins, but I need to use SetSystemPropertiesMojo to change the value of the property in the subproject without skipping.
I found that ReadPropertiesMojo writes properties to project.setProperties, but SetSystemPropertiesMojo writes properties to System.setProperties.
This leads to <skip>${xxxx}</skip> not being able to get properties correctly in the pom of the subproject.

So after verification, I wonder if the following Mojo can make this process more reasonable:
(My English is not good, the above is translated by machine, please understand)

@Mojo( name = "set-project-properties", defaultPhase = LifecyclePhase.INITIALIZE, threadSafe = true )
public class SetProjectPropertiesMojo    extends AbstractMojo
{
    @Parameter( defaultValue = "${project}", readonly = true, required = true )
    private MavenProject project;
   
    @Parameter( required = true )
    private Properties properties;

    public void execute()
    {
        if ( properties.isEmpty() )
        {
            getLog().debug( "No project properties found" );

            return;
        }

        getLog().debug( "Setting project properties:" );

        Properties projectProperties = project.getProperties();

        for ( Enumeration<?> n = projectProperties.propertyNames(); n.hasMoreElements(); )
        {
            String k = (String) n.nextElement();

        }

        for ( Enumeration<?> propertyNames = properties.propertyNames(); propertyNames.hasMoreElements(); )
        {
            String propertyName = propertyNames.nextElement().toString();
            String propertyValue = properties.getProperty( propertyName );

            getLog().debug( "- " + propertyName + " = " + propertyValue );

            projectProperties.setProperty( propertyName, propertyValue );
        }
        int count = properties.size();

        getLog().info( "Set " + count + " project " + ( count > 1 ? "properties" : "property" ));  
    }
}

Cannot use file defined properties for use in a <systemPath/> dependency

It would be nice to be able to use something like:

<dependency>
            <groupId>core</groupId>
            <artifactId>core</artifactId>
            <version>0.1.0</version>
            <scope>system</scope>
            <systemPath>${variable}/core/target/core.jar</systemPath>
</dependency>

However this fails with:

 'dependencies.dependency.systemPath' for core:core:jar must specify an absolute path but is ${variable}/core/target/core.jar

resolve yaml

do not resolve yml....

不能够解析yaml 文件, 有点美中不足.

NullPointerException when write-active-profile-properties goal is set

Maven throws error with write-active-profile-properties goal. It doesn't happen with 1.0-apha versions.

Plugin configuration:

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>properties-maven-plugin</artifactId>
    <version>1.0.0</version>
    <executions>
        <execution>
            <id>WriteLog4jProperties</id>
            <phase>generate-sources</phase>
            <goals>
                <goal>write-active-profile-properties</goal>
            </goals>
            <configuration>
                <outputFile>
                    ${project.build.outputDirectory}/app.properties
                </outputFile>
            </configuration>
        </execution>
    </executions>
</plugin>

Error message says:

Failed to execute goal org.codehaus.mojo:properties-maven-plugin:1.0.0:write-active-profile-properties (default) on project: Execution default of goal org.codehaus.mojo:properties-maven-plugin:1.0.0:write-active-profile-properties failed.: NullPointerException

active development?

is there any active development going on for this plugin? i'd be happy to help w/ getting pull requests merged, rebased, etc.

comma separated list of files

If I want to launch a build and pass in command line 3 property files I do

mvn install -Dfile1=jboss.properties -Dfile2=db.properties -Dfile3=mq.properties 


<execution>
  <phase>initialize</phase>
  <goals><goal>read-project-properties</goal></goals>
  <configuration>
      <files>
          <file>${file1}</file>
          <file>${file2}</file>
          <file>${file3}</file>
        </files>
  </configuration>
</execution>

But when I want to launch another build (for selenium test in my case) and I want pass only 1 property file:

mvn install -Dfile1=jboss.properties 

execution fails with null pointer exception

I would to modify my build in command line by passing 1 or many property files

mvn install -Dmy.property.files=jboss.properties,db.properties,mq.properties 

<execution>
  <phase>initialize</phase>
  <goals><goal>read-project-properties</goal></goals>
  <configuration>
      <commaSeparatedFiles>${my.property.files}</commaSeparatedFiles>
  </configuration>
</execution>

Cannot define one property key more than once

Plugin prevent definition of a property using one key twice. E.g.:

key1=value
key2=use ${key1} and then again ${key1}

The detection of the circular definition is incorrect.
I will create a PR. Check if my solution is OK or not.

Support configurable property file encoding

The read-project-properties, write-project-properties, and write-active-profile-properties goals read/write from properties files using java.util.Properties default encoding, ISO 8859-1. It would be useful to be able to specify the encoding to use when reading or writing the property files. I have a use case where a properties file encoded in UTF-8 contains some characters which are not mappable to ISO 8859-1.

Add possibility to save System properties among with maven prooperties to file.

Currently we can overrride maven property with system property with
mvn -Dprop.name=updatedValuevalue
Plugin saves such property (prop.name) to file only when such property defined in section of maven. If does not contain prop.name then output file will not contain it also.
This behavior forces me to define all properties inside maven but it is not convinient in my case. I just want to pass-through properties from and from maven CLI to samoe extarnal file which will be used later (by my tests). Test has too many different input parameters and I dont want to change pom file every time when I introduce new param.

Cant read external properties for sonar scan

I'm trying to read few exclusion rules from a external .properties file , so that I can keep my pom.xml clean. I tried using properties-maven-plugin but it fails to see the property (and I don't see that much information /logs about how to debug it to show me like the property file being read and the values that it retrieved). Below is the plugin definition on my pom.xml

 <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>properties-maven-plugin</artifactId>
                <version>1.0.0</version>
                <executions>
                    <execution>
                        <phase>initialize</phase>
                        <goals>
                            <goal>read-project-properties</goal>
                        </goals>
                        <configuration>
                            <files>
                                <file>${basedir}/sonar-project.properties</file>
                            </files>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

The properties file inside my base dir is as below :-

sonar.issue.ignore.multicriteria=e1
sonar.issue.ignore.multicriteria.e1.ruleKey=java:S4502
sonar.issue.ignore.multicriteria.e1.resourceKey=**/*.java

when I trigger "mvn sonar:sonar" it simply ignores the exclusions defined in properties file. But when I define these on pom.xml as below , "mvn sonar:sonar" consider those exclusions.

<properties>
<sonar.issue.ignore.multicriteria>e1</sonar.issue.ignore.multicriteria>
        <sonar.issue.ignore.multicriteria.e1.ruleKey>java:S4502</sonar.issue.ignore.multicriteria.e1.ruleKey>
        <sonar.issue.ignore.multicriteria.e1.resourceKey>**/*.java</sonar.issue.ignore.multicriteria.e1.resourceKey>
</properties>

Can somebody help here? Thanks in advance.

Properties defined in external file are not defined in POM file

I have the following pom file:

<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>test.properties</groupId>
  <artifactId>properties</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>pom</packaging>
	<scm>
		<connection>scm:svn:http://mysvnserver/repo</connection>
	</scm>
	<build>
		<plugins>
			<plugin>
			    <groupId>org.codehaus.mojo</groupId>
			    <artifactId>properties-maven-plugin</artifactId>
			    <version>1.0.0</version>
				<executions>
					<execution>
						<phase>initialize</phase>
						<goals>
							<goal>read-project-properties</goal>
						</goals>
						<configuration>
							<files>
								<file>maven.build.properties</file>
							</files>
						</configuration>
					</execution>
				</executions>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-scm-plugin</artifactId>
				<version>1.9.4</version>
				<executions>
					<execution>
						<id>ConfigScripts</id>
						<phase>generate-sources</phase>
						<configuration>
							<checkoutDirectory>${workspaces}/${workspace}/${project.build.plugins[1].executions[0].id}</checkoutDirectory>
							<scmVersion>${ConfigScripts.branch}/${project.build.plugins[1].executions[0].id}</scmVersion>
							<scmVersionType>branch</scmVersionType>
						</configuration>
						<goals>
							<goal>${SCM.goals}</goal>
						</goals>
					</execution>
					<execution>
						<id>profile</id>
						<phase>generate-sources</phase>
						<configuration>
							<checkoutDirectory>${workspaces}/${workspace}/${project.build.plugins[1].executions[1].id}</checkoutDirectory>
							<scmVersion>${profile.branch}/${project.build.plugins[1].executions[1].id}</scmVersion>
							<scmVersionType>branch</scmVersionType>
						</configuration>
						<goals>
							<goal>${SCM.goals}</goal>
						</goals>
					</execution>
					<execution>
						<id>Context</id>
						<phase>generate-sources</phase>
						<configuration>
							<checkoutDirectory>${workspaces}/${workspace}/${project.build.plugins[1].executions[2].id}</checkoutDirectory>
							<scmVersion>${Context.branch}/${project.build.plugins[1].executions[2].id}</scmVersion>
							<scmVersionType>branch</scmVersionType>
						</configuration>
						<goals>
							<goal>${SCM.goals}</goal>
						</goals>
					</execution>
					<execution>
						<id>Libraries</id>
						<phase>generate-sources</phase>
						<configuration>
							<checkoutDirectory>${workspaces}/${workspace}/${project.build.plugins[1].executions[3].id}</checkoutDirectory>
							<scmVersion>${Libraries.branch}/${project.build.plugins[1].executions[3].id}</scmVersion>
							<scmVersionType>branch</scmVersionType>
						</configuration>
						<goals>
							<goal>${SCM.goals}</goal>
						</goals>
					</execution>
					<execution>
						<id>abcdUtilsJava</id>
						<phase>generate-sources</phase>
						<configuration>
							<connectionUrl>scm:svn:${shared.url}</connectionUrl>
							<checkoutDirectory>${workspaces}/${workspace}/${project.build.plugins[1].executions[4].id}</checkoutDirectory>
							<scmVersion>${abcdUtilsJava.branch}/${project.build.plugins[1].executions[4].id}</scmVersion>
							<scmVersionType>branch</scmVersionType>
						</configuration>
						<goals>
							<goal>${SCM.goals}</goal>
						</goals>
					</execution>
					<execution>
						<id>abcddrs</id>
						<phase>generate-sources</phase>
						<configuration>
							<connectionUrl>scm:svn:${abcddrs.url}</connectionUrl>
							<checkoutDirectory>${workspaces}/${workspace}/${project.build.plugins[1].executions[5].id}</checkoutDirectory>
							<scmVersion>${abcddrs.branch}/${project.build.plugins[1].executions[5].id}</scmVersion>
							<scmVersionType>branch</scmVersionType>
						</configuration>
						<goals>
							<goal>${SCM.goals}</goal>
						</goals>
					</execution>
					<execution>
						<id>eclipse_pref.epf</id>
						<phase>generate-sources</phase>
						<configuration>
						<!-- http://cbsasvnserver1/apps/dcscripts/tags/devtags/WORKSPACE_SCRIPTS_B_ECLIPSE_V01/workspace/scripts/build/shared/import/eclipse_pref.epf -->
							<connectionUrl>scm:svn:${prefs.url}</connectionUrl>
							<checkoutDirectory>${workspaces}/${workspace}/abcddrs/src/prefs</checkoutDirectory>
							<scmVersion>${prefs.tag}</scmVersion>
							<scmVersionType>tag</scmVersionType>
						</configuration>
						<goals>
							<goal>${SCM.goals}</goal>
						</goals>
					</execution>
				</executions>
			</plugin>
		</plugins>
	</build>
	<!-- <properties>
		<SCM.goals>checkout</SCM.goals>
	</properties> -->
</project>

When I run it I get this output:

[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building properties 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.313 s
[INFO] Finished at: 2017-07-17T11:37:41-04:00
[INFO] Final Memory: 6M/123M
[INFO] ------------------------------------------------------------------------
[ERROR] Could not find goal '${SCM.goals}' in plugin org.apache.maven.plugins:maven-scm-plugin:1.9.4 among available goals status, branch, validate, checkin, diff, update, add, remove, unedit, bootstrap, checkout, tag, edit, check-local-modification, list, changelog, help, export, update-subprojects -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoNotFoundException

If I uncomment the SCM.goals property definition in the POM file, all runs fine. I remember reading somewhere about properties contributed by the properties maven plugin can only be used in configuration (although it seems to work in my executions). Can someone explain why this is the case and whether there is a way to make this work?

Code Error in Example present in Website

Hi,

In the website of properties-maven-plugin; Usage section of read-project-properties, the second example has a typo (https://www.mojohaus.org/properties-maven-plugin/usage.html).

<configuration>
  <urls>
    <url>classpath:/config/dev.properties</url>
    <url>file:///${env.HOME}/mydev.properties</file>
   </urls>
</configuration>

It should be

<configuration>
  <urls>
    <url>classpath:/config/dev.properties</url>
    <file>file:///${env.HOME}/mydev.properties</file>
  </urls>
</configuration>

identify files by wildcard

The goal read-project-properties shall provide the possibility to identify files by wildcard.

The solution could work similar to the maven-resources-plugin, include / exclude parameters.
E.g.

    <resources>
      <resource>
        <directory>${basedir}/src/main/config/my-properties</directory>
        <includes>
          <include>**/*.properties</include>
        </includes>
      </resource>
      ...
    </resources>

(Is there a better name than "resources"? Mojo Noob asks: Could we re-use / overload the "files" parameter?)

error on goal properties:write-project-properties when properties file exists and is read-only

Is there a flag to allow writing the properties file if there already is a properties file and it is read only?
I am getting the following error:
[INFO] --- properties-maven-plugin:1.0.0:write-project-properties (default) @ template_basic_application ---
[ERROR] Could not create FileOutputStream: null
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.900 s
[INFO] Finished at: 2019-04-22T17:10:38+03:00
[INFO] Final Memory: 9M/245M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:properties-maven-plugin:1.0.0:write-project-properties (default) on project template_basic_application: d:\IMS\UTIPNextGen\code\next_frameworks\template_basic_application\src\main\resources\app.properties (Access is denied) -> [Help 1]

Maven properties not evaluated on import.

If imported *.properties file has maven property references, then they do not resolve. Ex:

somePathProp = /r/${project.version}
someRelativePath = ${project.parent.basedir}

Values will not get filtered, resolved, or replaced, and will stay as variable references.

Read Environment variables from .yml file

Hi,

I'm working on Spring Boot application and I have my app configuration under application.yml file, when I try to access one of my properties into another maven plugin I get error.

This is configuration of your plugin @robertotru:

<plugin>
    <groupId>it.ozimov</groupId>
    <artifactId>yaml-properties-maven-plugin</artifactId>
    <version>1.1.1</version>
    <executions>
        <execution>
            <phase>initialize</phase>
            <goals>
                <goal>read-project-properties</goal>
            </goals>
            <configuration>
                <files>
                    <file>src/main/resources/application.yml</file>
                </files>
            </configuration>
        </execution>
    </executions>
</plugin>

When I try to access like this, It can't recognize it
<username>${app.datasource.username}</username>

application.yml:

app:
  datasource:
    username: ${USERNAME}

USERNAME is an environment variable

When I tried with static value it worked awesome, but with Environment variables it doesn't work

Thanks

Preserve existing properties (like Ant does)

I need an option to preserve existing properties from being overwritten.
This will match the Ant behavior, where you can define each property only once.

Since I need this behavior anyway I will implement it myself.
If you find this useful I will be happy to contribute.

Add README.md

Add the file with location and build status information.

write-active-profile-properties configuration param outputFile not allowed

maven throws error while processing

<execution>
  <id>write-properties</id>
  <phase>generate-resources</phase>
  <goals>
    <goal>write-active-profile-properties</goal>
  </goals>
  <configuration>
    <outputFile>
     src/main/resources/maven.properties
    </outputFile>
  </configuration>
</execution>

With error message
Execution write-properties of goal org.codehaus.mojo:properties-maven-plugin:1.0.0:write-active-profile-properties failed. NullPointerException

Intellij IDEA shows that Element "outputFile" is not allowed here.

write-project-properties goal works as expected

Unwarranted "Circular property definition"

Running in 1.0.0

Running the following Test Unit fails but should not. It should be possible to reference the same property twice in another property as this is not a circular reference.

@Test
public void unwarrantedCircularReferenceError() throws MojoFailureException
{
    Properties properties = new Properties();
    properties.setProperty( "port", "8080" );
    properties.setProperty( "myCustomProperty", "http://${port}:${port}/" );

    String value = resolver.getPropertyValue( "myCustomProperty", properties, new Properties() );

    assertEquals( "http://8080:8080/", value );
}

Thank you,

Julien Williams

Multiple files and properties precedence

Hey,

I cannot figure it out and just wanted to know how precedence works here. Say I have multiple files:

<files>
    <file>src/main/resources/application.properties</file>
     <file>src/main/resources/${env}.properties</file>
</files>

and I want to use application.properties as sort of default properties and later override the settings.
I though it will work like that but I just learnt that a property can be defined just once and cannot be overridden.

Is that the case?

properties-maven-plugin adding current date to newly written file.

Hi,

my team is using properties-maven-plugin and we are using write-project-properties goal,

 <plugin>
				<groupId>org.codehaus.mojo</groupId>
				<artifactId>properties-maven-plugin</artifactId>
				<version>1.0-alpha-2</version>
				<executions>
					<execution>
						<phase>generate-resources</phase>
						<goals>
							<goal>write-project-properties</goal>
						</goals>
						<configuration>
							<outputFile>src/test/resources/reportportal.properties</outputFile>
						</configuration>
					</execution>
				</executions>
			</plugin> 

_Properties file

#Properties
#Thu Feb 10 12:50:23 IST 2022 ### current date........
rp.endpoint=https://www.google.com
rp.uuid=28f1d912-66d1-437b-8c12-0cf40330289d
java.version=1.8.0_271
maven.compiler.version=3.6.0_

it is writing down all the properties in given file path, but it also adding current date to that file, due to current date adding into file during git pull and push operation every time we need to revert back our changes from that file.
Is there any way to ignore adding current time into properties file.

Getting eclipse auto builds to respect properties-maven-plugin pom.xml settings

Hi,

We're using this plug in successfully to set system properties using execution configuration such as

                    <execution>
                        <goals>
                            <goal>set-system-properties</goal>
                        </goals>
                        <configuration>
                            <properties>
                                <property>
                                    <name>javax.xml.accessExternalSchema</name>
                                    <value>all</value>
                                </property>
                            </properties>
                        </configuration>
                    </execution>

Whilst this works fine building through maven on the command line it doesn't seem to be reflected when eclipse performs an auto build.

Initially I thought this may help however it still doesn't execute

        <pluginManagement>
            <plugins>
                <!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
                <plugin>
                    <groupId>org.eclipse.m2e</groupId>
                    <artifactId>lifecycle-mapping</artifactId>
                    <version>1.0.0</version>
                    <configuration>
                        <lifecycleMappingMetadata>
                            <pluginExecutions>
                                <pluginExecution>
                                    <pluginExecutionFilter>
                                        <groupId>
                                            org.codehaus.mojo
                                        </groupId>
                                        <artifactId>
                                            properties-maven-plugin
                                        </artifactId>
                                        <versionRange>
                                            [1.0-alpha-2,)
                                        </versionRange>
                                        <goals>
                                            <goal>
                                                set-system-properties
                                            </goal>
                                        </goals>
                                    </pluginExecutionFilter>
                                    <action>
                                        <execute></execute>
                                    </action>
                                </pluginExecution>
                            </pluginExecutions>
                        </lifecycleMappingMetadata>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>

We need the JVM property to be set because this plug in configuration requires it to run correctly

            <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>jaxb2-maven-plugin</artifactId>
                    <configuration>
                        <arguments>-swaggerify</arguments> 
                        <outputDirectory>src/main/java</outputDirectory>
                        <schemaDirectory>src/main/schema</schemaDirectory>
                        <schemaFiles>services/*.xsd, domain/*.xsd, isoschemas/pain*.xsd, ofxschemas/*.xsd, hif5/*.xsd, lockbox/*.xsd, wpf/*.xsd</schemaFiles>
                    <bindingDirectory>src/main/schema</bindingDirectory>
                    <bindingFiles>GlobalBindings.xjb</bindingFiles>
                    <strict>false</strict>
                    <nv>false</nv>
                </configuration>
                <executions>
                    <execution>
                        <id>schema-xjc</id>
                        <goals>
                            <goal>xjc</goal>
                        </goals>
                    </execution>
                </executions>
                <dependencies>
                    <dependency>
                        <groupId>javax.xml.parsers</groupId>
                        <artifactId>jaxp-api</artifactId>
                        <version>1.4.5</version>
                    </dependency>
                    <dependency>
                        <groupId>com.sun.xml.parsers</groupId>
                        <artifactId>jaxp-ri</artifactId>
                        <version>1.4.5</version>
                    </dependency>
                    <dependency>
                        <groupId>com.sun.xml.bind</groupId>
                        <artifactId>jaxb-xjc</artifactId>
                        <version>2.2.7-b53</version>
                    </dependency>
                    <dependency>
                        <groupId>com.sun.xml.bind</groupId>
                        <artifactId>jaxb-impl</artifactId>
                        <version>2.2.7-b53</version>
                    </dependency>
                    <dependency>
                        <groupId>be.redlab.jaxb</groupId>
                        <artifactId>swagger-jaxb</artifactId>
                        <version>0.0.1-SNAPSHOT</version>
                    </dependency>
                </dependencies>
            </plugin>

Appreciate your thoughts on how others manage this

Thanks

Matt

Warning appears when use property from the file in pom.xml version tag.

I am trying to use this plugin to read version value from the properties file.
I took a sample from official site:

<build>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>properties-maven-plugin</artifactId>
                <version>1.1.0</version>
                <executions>
                    <execution>
                        <phase>initialize</phase>
                        <goals>
                            <goal>read-project-properties</goal>
                        </goals>
                        <configuration>
                            <files>
                                <file>src/main/resources/version.properties</file>
                            </files>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

and in pom.xml I use key from the version.properties file like this:

<version>${application.version}</version>

But when I run package goal, I see following output:

[WARNING] 
[WARNING] Some problems were encountered while building the effective model for my.project:server:jar:${application.version}
[WARNING] 'version' contains an expression but should be a constant. @ line 11, column 14
[WARNING] 
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING] 
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING] 
[INFO] 
[INFO] -------------------------< my.project:server >--------------------------
[INFO] Building server ${application.version}
[INFO] --------------------------------[ jar ]---------------------------------

I tried different phases, but result always is the same.
Why this warning appears and how to resolve it?

Thanks.

pom.xml doesn't read my properties

Hello
my pom file is the following:

<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.example</groupId>
    <artifactId>master</artifactId>
    <version>1.0.0-SNAPSHOT</version>
    <name>Master test</name>

    <build>
      <plugins>
        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>properties-maven-plugin</artifactId>
          <version>1.0.0</version>
          <executions>
              <execution>
                  <phase>initialize</phase>
                  <goals>
                      <goal>read-project-properties</goal>
                  </goals>
                  <configuration>
                      <files>
                          <file>my.properties</file>
                      </files>
                  </configuration>
              </execution>
          </executions>
        </plugin>
      </plugins>
    </build>

    <dependencies>
      <dependency>
        <groupId>org.apache.logging.log4j</groupId>
        <artifactId>log4j</artifactId>
        <version>${log4j.version}</version>
      </dependency>
    </dependencies>
</project>

and inside the my.properties file, located at the same level as the pom, only log4j.version=2.5.

Now, when I do a mvn install I get

'dependencies.dependency.version' for org.apache.logging.log4j:log4j:jar must be a valid version but is '${log4j.version}'. @ line 37, column 18

Properties read in parent module unavailable in children

Perhaps my expectations are incorrect but I would expect that if a property file is read in by the parent then those properties should be available to its children as well.

For my use case, I have a couple giant globs of property files in the parent module containing properties that should be disseminated to its children but getting them there has proved a challenge.

It would be nice if we could hoist these up and make them available for child modules.

Unwarranted "Circular property definition" v2

Running in 1.2.0

Running the following Test Unit fails but should not. It should be possible to reference the same property twice in another property as this is not a circular reference.

@Test
public void propertyIncludesAnotherPropertyMoreThanOnceWithIntermediaries() throws MojoFailureException {
    Properties properties = new Properties();
    properties.setProperty("p1", "value");
    properties.setProperty("p2", "${p1}");
    properties.setProperty("p3", "${p2} ${p2}");

    String value = resolver.getPropertyValue("p3", properties, new Properties());

    assertEquals("value value", value);
}

Instead, we get:

Circular property definition: p3=${p2} ${p2} -> p2=${p1} -> p1=value -> p2=${p1}

Which obviously isn't true.

Related to #27

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.