Meta-profiles in Maven - maven-2

I'm looking for a way to create meta-profiles that just activate sub-profiles in Maven. Let's take a very concrete example. I have the following profiles:
"server-jboss"
"server-tomcat"
"database-hsql"
"database-oracle"
To build the project, you have to choose one profile for the server and one for the database. I want to create two "meta-profiles":
"dev" => "server-tomcat","database-hsql"
"prod" => "server-jboss","database-oracle"
The first idea that comes is to activate the subprofiles by a property:
<profile>
<id>database-oracle</id>
<activation>
<property>
<name>prod</name>
</property>
</activation>
</profile>
But this way, I cannot share subprofiles between meta-profiles. For example, I want my profile "database-oracle" to be activated by both "pre-prod" and "prod" meta-profiles.
Note: my sub-profiles just contain properties. They are used for filtering resources and in the child poms. This is why I think there could be a solution for this particular situation.
The ideal situation for me would be to have them externalized in external properties files, but one issue at a time ;)

Activating profiles from another profile is not possible (this has been discussed in this previous question). Your first idea, using identical properties to activate different profiles, is the best thing you can implement but has indeed limitations.

Have you tried a solution using the maven-properties-plugin? Some possibilities are discussed in this question and here.

Related

How can we use spring-data-jpa-datatables spring-data-envers together in one project

I have this enabled in my database config. Which enabled to fetch Audit logs with the help of JPA methods. (spring-data-envers) is being used in POM for this
#EnableJpaRepositories(
repositoryFactoryBeanClass = EnversRevisionRepositoryFactoryBean.class)
Now I want to use jquery datatable's back-end processing. For this I will be using (spring-data-jpa-datatables) in my POM.
#EnableJpaRepositories(repositoryFactoryBeanClass = DataTablesRepositoryFactoryBean.class)
How can I use both of them in one Single Project.
DataTablesRepositoryFactoryBean seems to be rather simple.
It performs a simple check and then does it's own thing or invokes super, i.e. JpaRepositoryFactoryBean
By reimplementing that but inheriting from EnversRevisionRepositoryFactoryBean instead you should be able to use both in one project.

spinnaker configuration files precedence documentation?

Configuration for a particular spinnaker system can be written in a number of different files. Is precedence documentation available?
e.g. for clouddriver:
/opt/spinnaker/config/clouddriver.yml
/opt/spinnaker/config/clouddriver-local.yml
/opt/clouddriver/config/clouddriver.yml
or settings can be in the provider section of
/opt/spinnaker/config/spinnaker-local.yml
I wrote a blog post on this very topic a while back, because several users were getting confused:
https://www.travistomsu.com/2016/12/19/configuring-spinnaker/
The gist is that there are various levels of shared settings (with overrides) and service-specific settings (with overrides).
The order of loading looks like:
spinnaker.yaml (shared across all services, do not edit - will be overwritten on update)
spinnaker-local.yaml (override across all services, editable)
service.yaml (service-specific, do not edit)
service-local.yaml (override for this particular service, editable)
As per my comment I found the documentation here
Based on that, even though there is no mention of /opt/subsystem/config/subsystem.yml I will go with using /opt/spinnaker/config/clouddriver-local.yml

weblogic - controlling the thread count of a web app

I'd like to control how many threads can be used by a web application.
So far I thought it can be set by creating an application-scope workmanager (Deployments -> [application] -> Configuration -> Workload) and setting the Maximum Thread Constraint.
However recently I have the feeling that it is not true as this workmanager should be referenced from the code so it has to be used explicitly from the application.
What I'd need is to configure that from now on the XYZ application can use max 5 threads but no more. It can be done on global level but I want to control only one application.
As far as I know, if you define the workmanager in app's weblogic.xml or weblogic-application.xml, it's for sure will work on application level instead of config.xml which is domain-level config.
If you create and configurate the workmanager's max-threads-constraint and then reference to it in your app’s web.xml file like this:
<init-param>
<param-name>wl-dispatch-policy</param-name>
<param-value>your_workmanager_name</param-value>
</init-param>
i'm pretty sure, that this constraint will apply only on certain app's level.
I have the feeling that it is not true as this workmanager should be referenced from the code so it has to be used explicitly from the application.
Where'd you find this? I may be wrong but I never heard or read that it should be referenced explicitly from code instead of xml.
For more details take a look on this and this in case you hadn't.

Maven profile activation based on classpath property

Is it possible to activate a Maven profile based on a classpath property that you in turn set based on reading a properties file? I have verified that the classpath exists at the phase where my profile is supposed to take effect, and also separately gave the property through command line which worked, but when I attempt to read it from properties file, and attempt to run the profile based on classpath property, it does not work. I even tried setting the interested property as system property hoping that profile will be activated, but same result. This link refers as if classpath properties can be read, but this link mentions as if only system properties can be read for profile activation. However, for me both don't work. Any pointers will be helpful.
Thanks,
Paddy

Why might my Maven Mojo lose its configuration properties when run individually?

I've got an outstanding issue in jasmine-maven-plugin and I can't figure it out.
You're welcome to try this out yourself, but the gist is that when one runs:
mvn jasmine:test
The properties configured in the pom.xml for the plugin are not set on the Mojo bean.
Upon inspection it's pretty clear that each property on the bean is falling back on its default value. However, when you run the test phase itself (which jasmine:test is bound to), like:
mvn test
It works fine.
Any ideas? The preamble at the top of the TestMojo looks like:
/**
* #component
* #goal test
* #phase test
* #execute lifecycle="jasmine-lifecycle" phase="process-test-resources"
*/
Update: Now I'm even more confused. Upon further reading, it seems this behavior is really unexpected, since the configuration that I'm seeing as missing is done in a <configuration> element right under the plugin, not under an <execution/>, per this document:
Note: Configurations inside the tag differ from those that are outside in that they cannot be used from a direct command line invocation. Instead they are only applied when the lifecycle phase they are bound to are invoked. Alternatively, if you move a configuration section outside of the executions section, it will apply globally to all invocations of the plugin.
And of course I'm an idiot. I was looking at the wrong POM, and sure enough the configuration was inside an <execution> block.
So I'll try to feed Google by answering my own question in big bold letters:
When you invoke a Maven goal from the command line, it will only pick up your pom.xml's configuration element if that configuration was made directly under the <plugin/> element, and not under any <execution/> element.