Can anyone please explain the functionality for below?
A) Actually below code is working for me, BUT I didnt understood why we need to use below for maven-war-plugin
<warSourceDirectory>src/main/webapp</warSourceDirectory>
<webXml>src/main/webapp/WEB-INF/web.xml</webXml>
B) whats the difference between keeping a plugin inside a project and inside a profile? ( say maven-surefire-plugin ) which way is better (assume I MUST use <profile> tag in my pom.xml)
Part A
warSourceDirectory is directory for static web files, jsp, images, WEB-INF etc. The default value is good, so you dont need to change this parameter.
webXml - is location of web.xml file, deployment description. With spring boot you dont need web.xml at all. Set parameter failOnMissingWebXml to false.
Part B
Plugin defined inside a project are used by this project always. Plugin defined in profile are used only when you enable profile - so this plugin is not default.
Related
When configuring the Surefire Maven plugin for Quarkus, I have come accross the following in the doc
<maven.settings>${session.request.userSettingsFile.path}</maven.settings>
For my project I would also need to do the same thing for the settings-security.xml file because we use password encryption.
In Quarkus this can be done using
<settings.security>
I can define this with a project property in the pom.xml with the hard-coded path of the settings-security.xml file in my CI/CD environment (it is not the default one). But ideally I would like to extract it from the Maven execution environment using something similar to ${session.request.userSettingsFile.path}
I have 2 questions (I still have a very limited experience of Maven for the moment, so please bear with me)
I have found plenty of examples with the ${session.request.userSettingsFile.path} property, but no documentation. Anyone know where these properties are documented? It is not at all clear to me where they come from.
Is there an equivalent to ${session.request.userSettingsFile.path} for the settings-security.xml file, or do I have to define the path in the project properties?
Thanks
Is there a way to configure Maven duplicate-finder-maven-plugin plugin to scan only specific location and excluding everything else? Because in this moment, the results shows myriads of conflict that come from project dependencies.
From the configuration, it looks that the way to do it is explicitly excluding every dependency I don't want to scan.
Question: Is there a better practice? How to scan - for example - only the code that is under my direct responsibility, like com.my-company.my-project?
From the official documentation your case is already documented as following:
Ignore all classes that aren't from my company:
<configuration>
<ignoredClassPatterns>
<ignoredClassPattern>^((?!com[/.]mycompany).*)$</ignoredClassPattern>
</ignoredClassPatterns>
</configuration>
Note that the configuration option above is only available from plugin version 1.2.1 and later.
My maven top level project refers to a common-db project. In this project I have a spring file which defines the DB parameters.
However, I want the top-level project to define the DB parameters through the profile and inject these into the spring config file in /src/main/resources.
The top-level project only does the filtering on its own /src/main/resources files and ignores those located in the JAR dependencies.
How can I do this?
So you want to depend on common-db but then modify its contents to change the parameters in the config file? Ok, if you really want to do that, you could do something convoluted where you use dependency:unpack to expand the common-db jar, then overwrite / filter its contents, and then use a custom jar:jar execution to re-jar up the dependency and ship it with your application.
But, wow - why would you jump through all these hoops? Like #hoaz suggested, just place your application-specific config in the same classpath location so that it is loaded before common-db's default configuration. This is the convention followed by many, many Java libraries.
Might be a stupid question, but in my current maven project i do not have a web.xml in my /web-app/WEB-INF folder.
There is no web-xml in my project and never has been, im trying to add it but my application is non-responsive to anything written in the web.xml. What am i missing?, iv tried specifying the path to it through the config.groovy like:
grails.project.web.xml="web-app/WEB-INF/web.xml"
Am i missing something? Do i need to specify the web.xml in some other config file in order to make my project utilize it ?
Run
grails install-templates
to copy templates that Grails uses for all code generation activities (including "web.xml").
"web.xml" file will be created in "src/templates/war" directory.
You may be able to get away with something similar to this https://stackoverflow.com/a/5891646/107847. It doesn't install separate web.xml but does allow you add what ever content you need or edit any of the generated content.
I have the following property in Maven and I cannot find any information about it:
<properties>
<!-- development mode (exclude in production) -->
<exclude.bootstrap>true</exclude.bootstrap>
</propertes/>
Thanks for pointing me to the right documentation.
I haven't seen something like this before. IMHO this is just a regular, your own (or POM's author) property, probably used somewhere in this POM or its modules. There is an option that this is a special property, maybe related to some of declared plugins, but - as I said - I haven't used a plugin that uses this.