All Questions
125 questions
1
vote
0
answers
69
views
Writing tests for apache maven resolver
I have a class in my maven project that is used to resolve artifacts during a mojo execution. However I need to write tests for this ArtifactResolver class that tests it on a real repo which is let's ...
0
votes
1
answer
82
views
Resolving maven dependencies at runtime during plugin execution
I have a maven plugin that checks some dependencies. Those dependencies at unknown at first, so I can't add them to the pom file. Thus, I need a way to resolve dependencies at runtime during the ...
0
votes
0
answers
47
views
How to install remote dependencies using MavenSession?
How can I install remote dependencies using MavenSession in a Maven plugin that I am working on?
I wasn't able to try because of the poor documentation of maven. I am new to maven so I don't know how ...
2
votes
1
answer
143
views
How to make a Maven plugin Mojo parameter's default value an empty string?
How can a Maven plugin Mojo parameter be configured so that the default value is an empty String?
The defaultValue property of the Parameter annotation already defaults to "", so configuring ...
0
votes
0
answers
1k
views
OpenAPI Generator Maven Plugin 6.6.0 creates Build Failure in Maven Clean Install
I have to produce a OpenAPI Specification from an existing REST based project. One thing i did was to include the springdoc-openapi and swagger-webmvc-ui dependency and it was creating the desired ...
1
vote
1
answer
4k
views
org/springframework/boot/maven/BuildInfoMojo has been compiled by a more recent version of the Java Runtime
i'm getting this error when i mvn clean install my project:
org/springframework/boot/maven/BuildInfoMojo has been compiled by a more recent
version of the Java Runtime (class file version 61.0), this ...
0
votes
1
answer
168
views
RunMojo compatibility problem with camel plugin
I have installed Camel plugin for IntelliJ.
To start debugging, we must create an ad-hoc application
The problem is that it gives me that error running it, when building the war file
org/apache/...
0
votes
1
answer
109
views
Need jar for WebLogic exporter "https://github.com/oracle/weblogic-monitoring-exporter#Configuration"
Can you please help me to get the jar file for WebLogic exporter "https://github.com/oracle/weblogic-monitoring-exporter#Configuration" . I am new to java packaging and tried many times with ...
0
votes
0
answers
1k
views
Maven compilation failure due to mojo compiler
I've downloaded java 1.8 and maven 3.8.2 but whenever I run my app I keep getting this:
[INFO] >>> tomcat7-maven-plugin:2.2:run (default-cli) > process-classes @ project >>>
[INFO]...
0
votes
1
answer
132
views
Maven ignores plugin configuration from pom.xml
While executing a phase everything works as expected, when I try to call a plugin (mojo) directly like
mvn net.masterthought:maven-cucumber-reporting:5.5.0:generate
maven seems to ignore <...
0
votes
3
answers
1k
views
org.dbunit.database.AmbiguousTableNameException with MySQL 8
can anybody help me with this?
using dbunit-maven-plugin-1.0-beta-3 with mysql 8 to load meta data to database tables with mysql-connector-java-8.0.22.
Got the error as follows
org.apache.maven....
1
vote
1
answer
315
views
Maven plugin-development - How to detect modified files?
I'm writing new maven plugins, I've successfully used StaleSourceScanner in a combination with SuffixMapping, but it is just not working with SingleTargetSourceMapping. Always all files are detected ...
0
votes
0
answers
323
views
How to read multi module maven project information(like dependencies) separately with maven-project plugin
I'm trying to read POM information(dependencies) from multi module maven project. This maven project contains other maven project for which i have to read separately.
I am using maven-project-2.2.1....
1
vote
0
answers
73
views
How to pass custom input with mvn clean install and access this input in mojo class?
I am creating a custom maven-plugin which requires some json files in the the mojo class and do some further processing on them. I will be taking these files as input from the user. is there any way ...
0
votes
1
answer
5k
views
MojoExecutionException: Some Enforcer rules have failed. Look above for specific messages explaining why the rule failed
When I execute command ./mvnw -Pprod,swagger,webpack clean package -X
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-enforcer-plugin:3.0.0-M1:enforce (enforce-versions) on project --: ...
1
vote
0
answers
29
views
Maven Lifecycle and Plugin
I am currently writing a Maven Mojo that generates a class for the user so they don't have to create it manually (the class is essentially just boilerplate and my plugin fills in the information ...
0
votes
1
answer
283
views
Maven Mojo does not utilize the reactor when called through a phase. It works fine when called as independent goal
I have implemented a custom maven mojo to perform some operation on all modules mentioned in the input POM. The mojo works as expected when called from command line like:
mvn plugin_group_id:...
1
vote
0
answers
259
views
Trigger a Mojo programmatically from another Mojo
Can I make a Mojo that runs during integration-test phase trigger another Mojo that runs during verify phase?
This question is a follow up on my previous question. I extended the frontend-maven-...
0
votes
0
answers
240
views
How to run two Maven Mojos with different parameters
I wrote a Maven plugin with two Mojos. They are meant to be run in the command line, not attached to any phase of the build.
They happen to have different parameters, and I don't know how to specify ...
4
votes
1
answer
331
views
Passing value from Mojo to pom
I am developing a maven plugin , I have a parameter called "FinalVersion" which is created as a @Parameter in Mojo and its value is being set in Mojo class.
I need to pass "finalversion" to my pom ...
1
vote
1
answer
364
views
What version of Java should I use for developing my MOJO Maven Plugin?
I am currently implementing a new Maven Plugin and I would like to use Java 11 for compilation and execution.
However, I would like my Maven plugin to be used by most of our projects. Some of them ...
1
vote
1
answer
3k
views
Executing Mojo failed with `java.lang.NoSuchMethodError` org.codehaus.plexus.util.DirectoryScanner.setFilenameComparator
I have created 2 Mojos and recently decided to upgrade all my versions usign the maven version plugin.
Now, an executing one of my Mojos, I get this exception:
An API incompatibility was encountered ...
1
vote
1
answer
466
views
Unable to parse configuration of mojo org.owasp:dependency-check-maven:5.2.4:check
I'm getting error for configuration entry 'formats', which am not able to find under dependency-check-maven-5.2.4.pom & dependency-check-parent-5.2.4.pom
Unable to parse configuration of mojo ...
2
votes
1
answer
1k
views
how share a .properties file from parent project to child projects
I have a parent project with a .properties file, this file is filtering according to profiles defined over the project, this project has child projects or modules, I would like the .properties file ...
12
votes
2
answers
5k
views
How to specify a default goal for a Maven plugin?
I've defined a Maven plugin with multiple goals. Currently users run my plugin as follows:
<plugin>
<groupId>myGroupId</groupId>
<artifactId>myArtifactId</...
0
votes
0
answers
2k
views
How do you use Mojohaus maven plugins?
So I'm trying to follow along with this tutorial.
I usually work with Gradle, so I'm not too savvy about maven plugins, but there's not much Gradle to be had out there, so ... Maven it is.
But when ...
0
votes
0
answers
113
views
Why Maven mojo does not delete, move or replace files
I have created a new Maven mojo plugin. I want to rename some generated files from another plugin, replace content for some files.
This is my mojo:
package com.mymojo.maven.plugins;
import java.io....
0
votes
2
answers
322
views
How can you chain/stitch Maven plugins?
I want to chain two Maven plugins which should execute in sequence. The output from the first plugin should be used as input for the second plugin. Let me explain:
I want to write a plugin which ...
1
vote
0
answers
206
views
How to retrieve avaliable versions of a maven dependency programmatically?
I want to find all available versions of a dependency in my project using a Mojo. I need this information to create a complete dependency tree where not only the transitive dependencies are included, ...
0
votes
1
answer
274
views
Mojo complex dependency injection
I'm trying to use the @Parameter above a field in a mojo.
@Parameter(required = false)
public Map authentication;
In plugin usage I'm passing:
<configuration>
<authentication>
...
2
votes
1
answer
2k
views
Pass parameters to a maven mojo invoked programmatically
Here I have my Maven Mojo:
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven....
0
votes
0
answers
49
views
Best way to attach additional jars to maven project [java]
I have a maven based project, which after execution I want to install all the generated jars to the maven repository.
I cannot add additional jar details in the pom.xml because the additional jars ...
1
vote
0
answers
441
views
Mapping complex objects in maven plugin
I want to configure some complex objects in maven plugin .. like -
<?xml version="1.0" encoding="UTF-8"?>
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>...
6
votes
4
answers
16k
views
ClassCaseException org.slf4j.impl.SimpleLoggerFactory cannot be cast to ch.qos.logback.classic.LoggerContext
A type incompatibility occurred while executing com.cerner.clinicaldev:gatling-plugin:1.0.0-SNAPSHOT:run: org.slf4j.impl.SimpleLoggerFactory cannot be cast to ch.qos.logback.classic.LoggerContext
I ...
0
votes
0
answers
40
views
How can I process a remote file given Maven information (artifact id, group id, and version)
I'm writing a maven plugin to find out if the dependencies for a given application (local) exist in a different application (remote), this would let me see if the local program i have is compatible ...
0
votes
0
answers
53
views
Access a maven resource jar from java code
I am creating a maven plugin and need to retrieve a jar from within my code. I don't want to just search through the .m2 folder, but actualy use maven to retrieve the requested resource (both local ...
-2
votes
1
answer
270
views
Mojo plugin for writing to filesystem [closed]
I would like to write mojo plugin like this:
/**
* @goal write-to-fs
*/
public class WriteToFsMojo extends AbstractMojo
{
public void execute() throws MojoExecutionException
{
...
2
votes
1
answer
2k
views
Maven plugin AbstractMojoTestCase PlexusContainerException
I'm trying to create a maven plugin for the first time.
everything works till now except for the testing part.
I want to write some test cases before I start at coding the plugin itself.
I've had ...
1
vote
0
answers
504
views
Change property of Maven POM
I need to change a property of my pom.xml.
I searched and I didnt found any plugin that changes properties in the pom.xml. So I decided to write my own pPlugin. Is there any way to persist the ...
2
votes
2
answers
671
views
Passing parameters to maven plugin while writing unit tests
I have a maven mojo plugin with parameters like this:
public class SomeMojoPlugin
extends AbstractMojo
{
@Parameter( property = "templatefile", required = true )
private File templateFile;...
3
votes
1
answer
875
views
How to use MavenBuildHelper in Maven mojo
I am developing a maven-plugin with multiple Mojos. In one of them, my goal is to attach additional artifact to my project. Similar to attach-artifact of maven-build-helper-plugin. But I don't want to ...
1
vote
0
answers
264
views
how to create maven mojo plugin to overwrite files directories in target project
I am writing a maven plugin which generates java source code based on input text file and some additional configuration.
e.g. User creates maven project and adds my plugin in his project's pom.xml as ...
2
votes
1
answer
737
views
how to make zip files (produced by a self-made maven plugin)from target folder end up in the local repository?
I am creating my own maven-environment-plugin that creates and bundle resources for a predefined folder structure for each environment defined in the configuration. The plugin is outputting the folder ...
4
votes
3
answers
2k
views
Maven: Get goal configuration from execution element
Let's imagine I have following mojo:
@Mojo(name = "some-goal")
public class MyMojo {
@Parameter(required = true)
protected ComplexObject param;
/*...*/
}
Also I have plugin's descriptor ...
4
votes
1
answer
3k
views
Maven Mojo Mapping Complex Objects
I'm trying to write a maven plugin, including a mapping of a custom class in mvn configuration parameters.
Does anybody know how the equivalent class "Person" would look like:
http://maven.apache.org/...
1
vote
0
answers
86
views
Mojo Execution from release plugin
I want to write a mojo, which responsibility is to validate the POM against a set of rules (in addition to those specified by Maven). As an example, it'll make sure there's an organization element, ...
1
vote
0
answers
381
views
Can't find Mojo definition if packaging maven-plugin is added to pom
I'm developing a Maven plugin and I'm getting the error: No mojo definitions found for plugin: my.plugin:my-artifact-id but ONLY if I have <packaging>maven-plugin</packaging> added to my ...
1
vote
1
answer
543
views
Maven plugin MOJO API in term of parameters
From my understanding
the MOJO relative to the compile goal of the maven-compiler-plugin
defines its own parameters,just like any other MOJO plugins.
For example it should have a parameter defined ...
0
votes
0
answers
218
views
Custom maven goal as part of project? (MOJO)
I've been working on this all day and can't seem to find a solution to fit my requirements.
Addition to compile life cycle that generates code. (I thought a MOJO would work here)
MOJO depends on ...
5
votes
2
answers
7k
views
Maven: Read encrypted password from settings.xml in pom.xml
I am trying to use an encrypted password in my settings.xml. I have in my pom.xml a plugin connecting to the database, usin sql-maven-plugin:
<plugin>
<groupId>org.codehaus.mojo</...