I have a complex pom hierarchy structure. Some of them have a resource plugin configuration that copies resources to the target artifact.
The issue I'm facing is that when I add a new resource configuration to a low level pom, the existing resource plugin configuration on its parent poms stop working.
I'm really not sure if what I'm trying to achieve is possible or not because I couldn't find any documentation about it. If it's possible, I don't know if there is any restriction to it..
I hope Some of you guys can give me a hint on this..
Thanks in advance.
Check this from the pom reference
You can control how child POMs inherit configuration from parent POMs
by adding attributes to the children of the configuration element. The
attributes are combine.children and combine.self. Use these attributes
in a child POM to control how Maven combines plugin configuration from
the parent with the explicit configuration in the child.
Here is the child configuration with illustrations of the two
attributes:
<configuration>
<items combine.children="append">
<!-- combine.children="merge" is the default -->
<item>child-1</item>
</items>
<properties combine.self="override">
<!-- combine.self="merge" is the default -->
<childKey>child</childKey>
</properties>
</configuration>
or if you want a more detailed explanation read this post
Basically, you need to merge the parent and the child configuration of the maven-resource-plugin
The Maven documentation isn't very clear on which POM elements merge and which do not, so a while ago I created some test POMs and played with them a bit. In my tests with Maven 3.0.x, any resource (or testResource) elements in child POMs fully overwrite anything provided by the parent, the elements are not merged. I found that I had to duplicate all of the parent resource config if I needed to add a resource config element in the child.
#Hilikus' answer is the correct way to do it for plugin configuration, so if it's the maven-resource-plugin configuration that needs to change, follow those directions.
Related
What does adding the '#' to name value of application.properties to the beginning and to the end mean?
I couldn't find usage of something like this. I checked the Spring docs as well, but I couldn't find it. Is this usage a generic thing for programming or specific to application.properties of Spring?
Please go through the documentation
Rather than hardcoding some properties that are also specified in your
project’s build configuration, you can automatically expand them by
instead using the existing build configuration. This is possible in
both Maven and Gradle.
The format you mentioned is for Maven
You can automatically expand properties from the Maven project by
using resource filtering. If you use the spring-boot-starter-parent,
you can then refer to your Maven ‘project properties’ with #..#
placeholders
Update
With Spring Boot Actuator dependency added to pom.xml
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
and
info endpoint exposed (for http : management.endpoints.web.exposure.include=info )
a quick verification of this can be done.
Add the following property to pom.xml
<properties>
<app.info.test>Test Value</app.info.test>
</properties>
and following entries in the application.properties file
info.app.name= Test App
info.app.java.source=1.8
info.app.test=#app.info.test#
Hitting http://localhost:8080/actuator/info will give the following response
{"app":{"name":"Test App","java":{"source":"1.8"},"test":"Test Value"}}
Straight Forward answer is the value which you store with #name# in application.properties are initialized when your project build start (based on same parameter name you pass with command).
It's used when you want to pass value of that variable at time of build
or value which are different based on environment.If you don't do that then it value becomes fixed.
when you're want to pass some parameter which are constant or repetitively use in your application like mail configuration or AWS configuration, version or etc. that things define in application.properties file.
When I create a new Configuration in the "Hibernate Configuration" tab, the Session Factory node correctly shows the entities that are listed in the persistence.xml file of the main project, but fails to find all entities from a library project.
I'm using annotation configuration.
This is due to the way persistence.xml works.
You can add an external jar to persistence.xml using the <jar-file> element. The tricky bit is to make it work in Eclipse, where compiled classes are spread around different projects.
As suggested by this answer, you can do so with a relative "file:" url:
<persistence-unit name="myPersistenceUnit">
<jar-file>file:../../LibraryProject1/bin</jar-file>
<jar-file>file:../../LibraryProject2/bin</jar-file>
The "current folder" is the compiler output folder ("bin" in my case) i.e. the one containing META-INF if persistence.xml is located at /MainProject/src/main/resources/META-INF/persistence.xml
I have been trying to follow this tutorial about Alfresco custom content types
http://ecmarchitect.com/alfresco-developer-series-tutorials/content/tutorial/tutorial.html#localizing-strings-for-custom-content-models.
However, when I get to the 'Test your changes' step and I go to manage rules, I can't manage to get the custom types created (sc_doc and sc_whitepaper) in the dropdown list.
My share-config-custom.xml:
<!-- Share configuration related to this particular Share module extension, such as:
- Doclib action config
- Form config
- Aspect and Type config
Note. Any configuration related to the whole Share.war webapp
(i.e. not specific to this share extension) should be
placed in the environment specific config:
alfresco/tomcat/shared/classes/alfresco/web-extension/share-config-custom.xml file
-->
<alfresco-config>
<!-- Document Library config section -->
<config evaluator="string-compare" condition="DocumentLibrary">
<aspects>
<!-- Aspects that a user can see -->
<visible>
<aspect name="sc:webable" />
<aspect name="sc:productRelated" />
</visible>
<!-- Aspects that a user can add. Same as "visible" if left empty -->
<addable>
</addable>
<!-- Aspects that a user can remove. Same as "visible" if left empty -->
<removeable>
</removeable>
</aspects>
</config>
<config evaluator="node-type" condition="DocumentLibrary">
<types>
<type name="cm:content">
<subtype name="sc:doc" />
<subtype name="sc:whitepaper" />
</type>
<type name="sc:doc">
<subtype name="sc:whitepaper" />
</type>
</types>
</config>
</alfresco-config>
PS: Do I have to re-run 'mvn install' after every change I make in the .xml using Eclipse?
Any help will be much appreciated!
I know i am posting this answer bit late
and my solution is bit poor, But it works for me :)
I hope it will also work for you.
Strange thing is i am following same tutorial and at the time of 'Test your changes' stage not able to see my custom types on the server.
so to make it working in my share project i have changed place of
share-config-custom.xml
from src/main/resources/META-INF to src/main/amp/config/alfresco/web-extension
and restart alfresco and now able to view my custom types in type list on server.
plz post your answer if you have make done this by any other way :)
thank you.
I am not sure which kind of project you have created from maven artifacts.
Repository AMP archetype
All-In-One (AIO) archetype
Share AMP archetype
Here you can see list of all maven commands.
If you are not using local maven repository then you can go for "mvn package" to generate new AMP files and then deploy them manually on alfresco server.
I have a java file where a variable taken value at run time.I search for a service using web service discovery and keep its url in a variable.
Now I need to pass this value to pom.xml.
abc.java has code with
String url= http://xx.xx.xx.xx:55939/ABCDevice?wsdl
Pom.xml is:
<wsdlOptions>
<wsdlOption>
<wsdl>url</wsdl> <!-- get urlvalue from java file -->
<wsdlLocation>classpath:com/admin/discovery/ABCService.wsdl
</wsdlLocation>
</wsdlOption>
</wsdlOptions>
In wsdl i want to pass string value "http://xx.xx.xx.xx:55939/ABCDevice?wsdl" which is determined only after run time.
How can i do so ?
I don't consider this as an Apache Maven specific issue, but a general Java issue (Maven probably made you aware of it).
During build-time you have no idea what the url should be. Depending on the type of application you have several options:
JNDI (in case of a webcontainer)
A properties file on a predefined location
System properties
As arguments (in case of executable jar)
Adjust web.xml before deploying (some webcontainers can help you with this)
...
In you use a framework like Spring there are easy ways to inject one the options above.
I am trying to generate a PDF and the main generation works fine, but I face the issue trying to use custom defined properties.
I do have the my properties defined in pom.xml as documented, but when I use them in the content files in the final result I don't see them substituted, but staying with the variable i.e ${myProperty}.
e.g. I have the property defined in pom.xml
<properties>
<myProperty>My other value</myProperty>
</properties>
If I use the same property in pdf.xml it is being properly substituted(i.e on the title tah), but if I
set it in an .apt.vm file as ${myProperty} it doesn't.
The apt file is also with .vm extension as documented on the site.
On the other hand system properties as ${project.name} work fine.
Do you have an idea what am I missing?