Is Maven ${project.name} ever null? - maven

I want to use ${project.name} for resource filtering. I know that this value comes from the Maven Model object. But the documentation doesn't indicate if this can ever return null.
Is a value always assigned to ${project.name} during resource filtering, even if the POM does not specify a <name>? I would prefer some authoritative reference. Thanks.

Yes, it can be, if you haven't defined it in the <name/> tag.
Why do you want to use ${project.name}, instead of ${project.artifactId}? You should be using the latter instead.

Related

Setting a property for only a specific phase

I want to be able to set a property for a specific maven phase. How can I do that?
For example, assume that I want to set a property like this:
<properties>
<spring.profiles.active>production<spring.profiles.active>
</properties>
only when one is executing mvn package. I know that I can manually set a property, but I want it to be automatic so it is not forgotten.
This is not possible.
But probably there is a solution for the original problem you want to solve. Please write a new question which describes the use case.

Does Gorilla/schema support the `json` reflection tag natively?

In the documentation, Gorilla/schema says that you must specify the schema reflection tag to unpack the struct. I've seen it unpack when I don't have the schema tag, for example when I just am using the json tag.
When the schema tag isn't specified what does Gorilla do under the covers? Does it look at other tags or does it do a case-insensitive match? Is there a huge performance hit as a result of not specifying the schema tag?
EDIT: Specified/linked package
For others searching for this answer -
This package has the ability to use any tag. The default is schema (which is initialized here). To change the tag it's searching for, use decoder.SetAliasTag("json"). While I think the fallback logic is around this function, I'm not totally certain what the performance hit really is from not explicitly setting a different tag.

Multi Value option in Apache Nifi Processor

I was designing on my own custom processor. I added couple of simple property descriptor into it with simple non-empty validators. I was looking for a validator by which I can add multiple values into one property descriptor. Something like below.
My property descriptor will have multi value selection option.
Does anyone know how can I achieve it ?
Multi-value selection for a single property descriptor is not supported. Would be curious to better understand the use case. Now, of course you can have many properties and even support dynamically generated (at runtime) properties.
Thanks
Joe

How to push a value of an unchanged field into the target in a plugin's input parameters?

I'm deleting an instance of an entity and depending on the value of an option set in it, I wish to carry our different course of action. The problem is that the field isn't changed, hence, not provided to the plugin's target.
How can I easily tell the stupid plugin to fetch all the fields?
The way I do it now is to use pre-image but I'll be showing the plugin to some rookies and they will definitely not like it. And they won't believe me that's the way to go, for sure, because they're a cocky bunch.
Is there a work-around for that?
Using the pre-image is the suggested way in this scenario, the alternative is to instantiate a service factory in order to get an IOrganizationService and retrieve the entity using the target's Id.
It is part of the IPluginExecutionContext (of which Target is one part.) I think the beginners are confused if they think of Target as anything more than a property of IPluginExecutionContext.
It wouldn't make sense to have these values as part of Target, because then it would cause an update of the field to its current value - if you forced it into Target you would see the update in the audit details.
Thus, CRM has PreEntityImages, Target, and PostEntityImages, if Target was used the way "they" want it would not be able to differentiate between values being updated, previous values, and the final result of the entity.

Which method is called to initialize a Maven plugin before its execution?

I'm writing a Maven plugin and would like to convert a set of strings inputted as parameter excludes to a pattern before the plugin execution. I implemented the interface org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable but when I access in the initialize method the parameter excludes is null in the execute method is not null.
Which method is called to initialize a Maven plugin before its execution and has access to the parameters?
The best recommendation i can give is to take a deep look into the documentation which will give you the advice to define some kind of parameters and may be some default values for different parameters. The first method is usually the execute() method of the AbstractMojo class which you have to inherit from. If you need some kind of default values just check the parameters if they haven't been initialized (which means being null) and give the values you like for them.

Resources