maven-plugin

How to call maven-resources-plugin programmatically

耗尽温柔 提交于 2019-12-05 21:42:58
I am writing a custom Maven plugin and part of the plugin's job is to filter-copy some resources. The code I've written looks like this: CopyResourcesMojo rm = new CopyResourcesMojo(); rm.setOutputDirectory(outputDir); //determined dynamically in a loop rm.setOverwrite(true); rm.setFilters(filters); //determined dynamically in a loop rm.setResources(this.resources); //Actually is of type List<Resource> rm.execute(); //NulPointerException because rm's project member is null. This throws a NullPointerException because the CopyResourceMojo doesn't have access to my mojo's project , and the

Maven - Add Integration Tests

我怕爱的太早我们不能终老 提交于 2019-12-05 21:01:23
trying to split my tests in a Maven build into Unit & Integration tests. I am using the failsafe plugin to run the Integration Tests and attempting to use the build-helper-maven-plugin to add the Integration Tests from the src/it/java directory. I am getting an error when I attempt to do the build and I can't see the reason, the path to my Integration Test source looks to be correct from the root folder of the module. [ERROR] Failed to execute goal org.codehaus.mojo:build-helper-maven-plugin:3.0.0:add-test-source (add-test-resource) on project XXXX: The parameters 'sources' for goal org

how to configure <manifest> only once in pom.xml in a desktop application

不羁的心 提交于 2019-12-05 18:52:14
I'm making a swing application with maven and I try to keep the pom.xml under tight reins (this file tends to become a pile of junk after pasting there whatever we find in google). My pom is with jar and I use the maven-assembly-plugin with "jar-with-dependencies" descriptor. So I need to define twice the part of my project (main class and versions), once for the normal jar and the other once for the jar-with-dependencies. I think the problem comes from the jar-with-dependencies assembly descriptor, instead of unpacking the normal jar and fusion the manifests, it creates a new jar from $

Using map of maps as Maven plugin parameters

纵饮孤独 提交于 2019-12-05 18:42:17
Is it possible to use a map of maps as a Maven plugin parameter?, e.g. @Parameter private Map<String, Map<String, String>> converters; and then to use it like <converters> <json> <indent>true</indent> <strict>true</strict> </json> <yaml> <stripComments>false</stripComments> </yaml> <converters> If I use it like this, converters only contain the keys json and yaml with null as values. I know it is possible to have complex objects as values, but is it also somehow possible to use maps for variable element values like in this example? This is apparently a limitation of the sisu.plexus project

Maven Exec Plugin not reading configuration

拟墨画扇 提交于 2019-12-05 16:35:19
I'm trying to execute my project using the Maven exec:exec goal and I've tried to configure it with this snippet: <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>exec-maven-plugin</artifactId> <version>1.1.1</version> <configuration> <executable>java</executable> <arguments> <argument>-jar ${staging.dir}/project.jar</argument> </arguments> </configuration> <executions> <execution> <goals> <goal>exec</goal> </goals> </execution> </executions> </plugin> When I run mvn exec:exec I get the output: ------------------------------------------------------------------------ [ERROR]BUILD ERROR

Error resolving version for plugin 'org.apache.maven.plugins:maven-jar-plugin' from the repositories ,Plugin not found in any plugin repository

人盡茶涼 提交于 2019-12-05 15:47:09
I am trying to Maven build my Java project but it is getting failed and i am getting below error: Error resolving version for plugin 'org.apache.maven.plugins:maven-jar-plugin' from the repositories [local (C:\Users\Vinita.Gupta.m2\repository), central ( https://repo.maven.apache.org/maven2)] : Plugin not found in any plugin repository -> [Help 1] I am trying to build the project in Eclipse Neon and have installed and setup Maven path,m2connector for Eclipse. Note: I am not connected to network using any proxy Most of the solutions which i have found online were having issues due to proxy

How can I define Plugin Versions correctly in maven pom.xml?

不想你离开。 提交于 2019-12-05 15:36:21
问题 I am struggeling in my attempts to create web-apps, and due to office conventions, I am using a Maven/Jetty/Eclipse setup, while attempting to create java web apps. In my command window, I am trying to compile and run, by typing mvn jetty:run. This currently results in a lot of warnings, before I get a (very likely) related build failure. I would like to resolve these errors before moving on, even if they are not the reason of the build failure. The warning message seems to say that I am

Is it possible to run multiple maven-exec-plugin executions in parallel?

大城市里の小女人 提交于 2019-12-05 14:52:27
Is it possible to run multiple exec-maven-plugin executions in parallel somehow? We want to have different database types deployed for DAL integration testing, and while it's obviously possible to do this in sequence, it's a huge waste of time. <build> <plugins> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>exec-maven-plugin</artifactId> <executions> <execution> <id>first-dbtype-deployment</id> <goals> <goal>java</goal> </goals> <configuration> <mainClass>com.example.DeployDBTypeOne</mainClass> </configuration> </execution> <execution> <id>second-dbtype-deployment</id> <goals>

how to add arbitrary information in manifest from maven assembly plugin

こ雲淡風輕ζ 提交于 2019-12-05 12:11:11
问题 i use the assembly plugin to create a uber jar from several maven artifacts. Now I like to add some company specific entries into the Manifest of the created assembly jar. But how ? the archive element doesnt allow arbitrary elements (or is there a way to add foobar: tutu inside the archive tag ?) also in addition with maven-jar-plugin it does not work as this only affects the default artifact of the project and not the assembled. Any idea how to do this ? 回答1: argh... after posting it i

How to remove repositories from Effective POM

人走茶凉 提交于 2019-12-05 10:16:57
I have hard times learning Maven those days, it seems more difficult than learning all 4-5 programming languages I know altogether. However first steps are made and I succeeded to build a first Java REST services project based on Jersey in Eclipse with m2eclipse plugin. As I tried to do that I added a bunch of global repositories most of which are either irrelevant or incorrect and somehow I added all of them to 'Effective POM' instead of project POM so there are number of garbage repositories globally. Now the question: How can I edit/manage 'Effective POM' in order to remove those