maven-plugin

Private Maven Repository in Closed Network

拟墨画扇 提交于 2020-01-06 02:32:09
问题 I am in a closed network, do not have access to http://repo.maven.apache.org We set up a Nexus server and we download all of our .m2's on a publicly accessible computer, burn to disk, then upload to our Nexus server (inefficient but necessary) Currently I am trying to set up the system to only use my nexus server, currently it tries to go to http://repo.maven.apache.org (assuming is set to false) If I have set to true, it does not even attempt to go to my private repo. Basically, I just need

Get directory path of maven plugin in its own Mojo

强颜欢笑 提交于 2020-01-05 08:18:30
问题 I am creating a custom maven plugin. In one of its Mojos, I am reading a Xpp3Dom object from XML file using following code piece: File pluginsFile = new File( "absolute-path-to-file/plugins.xml"); Xpp3Dom Xpp3DomObject = new Xpp3Dom("plugins"); try { FileReader reader = new FileReader(pluginsFile); Xpp3DomObject = Xpp3DomBuilder.build(reader); reader.close(); } catch (Exception e) { // TODO throw exception } The XML file from which I am reading ( plugins.xml ) is stored in src/main/resources

MavenProject: Get the available classes for use on my plugin

守給你的承諾、 提交于 2020-01-05 07:27:31
问题 I'm loading a Maven project as described here. I'm trying to figure out how I can retrieve the source roots so I can figure out the Java classes I have so my Mojo can use them. I tried a couple of the methods in there, like getResources or getScriptSources without luck. Any idea? Thanks in advance! Edit: I was asked to elaborate a little bit in what I'm attempting to do, so here it is: The plugin I'm developing will take the sources in the project and create test cases from those. Unless

Maven Plugins - how to require a license

非 Y 不嫁゛ 提交于 2020-01-04 14:18:10
问题 I would like to make my plugin require a license to run similar to the maven clover plugin. Is there some utility out there that I can generate licenses with that will also allow me to integrate that into the plugin? I need to do the following steps. Modify the existing plugin to validate the license file Generate the license file online and store the information for retrieval later. Thanks, Walter 来源: https://stackoverflow.com/questions/1548831/maven-plugins-how-to-require-a-license

Exec goals before war archive package

久未见 提交于 2020-01-04 02:11:14
问题 I want to run maven-replacer-plugin just before packaging war. I have find "prepare-package" phase but it triggered before war assembled and all resources copied, but I need to make changes when all resources copied and just before archive create. Is this possible in maven? BTW, I use maven-2.2.1. Thanks. 回答1: I have found answer in maven replacer plugin WIKI. The trick is to make all things after war:exploded but then use <useCache>true</useCache> property in war plugin configuration. And

NoSuchElementException thrown while Testing Maven Plugin

倾然丶 夕夏残阳落幕 提交于 2020-01-03 17:17:25
问题 I am trying to test my maven plugin using the maven plugin testing harness. The only documentation I can find on the matter is rather old, and I have found similar threads with the same error, but no resolution, at least not one that solves the problem for me. The error can be boiled down to a NoSuchElementException being thrown when trying to run the lookupMojo method. Has anyone else experience this or a similar issue, and how did you fix it? Let me know if you need any more information and

NoSuchElementException thrown while Testing Maven Plugin

自作多情 提交于 2020-01-03 17:17:15
问题 I am trying to test my maven plugin using the maven plugin testing harness. The only documentation I can find on the matter is rather old, and I have found similar threads with the same error, but no resolution, at least not one that solves the problem for me. The error can be boiled down to a NoSuchElementException being thrown when trying to run the lookupMojo method. Has anyone else experience this or a similar issue, and how did you fix it? Let me know if you need any more information and

Run a custom Maven goal without pom.xml

孤街浪徒 提交于 2020-01-03 08:26:09
问题 I have developed a Maven plugin. How to run custom Maven goal from a directory that does not contain a pom.xml ? E.g. mvn my.plugin:mygoal <- no pom.xml in this dir. 回答1: You can set the requiresProject attribute of your MOJO to false : Flags this Mojo to run inside of a project. By default, it is true meaning that this MOJO requires a project (hence a POM). As such, you should have in your plugin: @Mojo(requiresProject = false, ...) public class MyMojo extends AbstractMojo { ... } 来源: https:

Could not find artifact com.sun.kvem:kenv:jar:2.2 in central

半腔热情 提交于 2020-01-03 04:57:07
问题 I am trying to compile the source code of Proguard 4.6 in a maven project. The code has a dependency on: <dependency> <groupId>com.sun.kvem</groupId> <artifactId>kenv</artifactId> <version>2.2</version> <optional>true</optional> <type>jar</type> </dependency> When I try compile it, I get: Failed to execute goal on project proguard: Could not resolve dependencies for project net.sf.proguard:proguard:jar:4.6: Could not find artifact com.sun.kvem:kenv:jar:2.2 in central (http://repo1.maven.org

Writing a maven custom report plugin; how do I generate the html body or “middle” of my report?

牧云@^-^@ 提交于 2020-01-02 06:55:10
问题 I am attempting to create an custom maven report to generate when I run the mvn site goal in my project. I have followed the instructions here: http://docs.codehaus.org/display/MAVENUSER/Write+your+own+report+plugin Specifically I have created a mojo that implements the appropriate methods, and its "executeReport(...) method is called when I run mvn site. I have also implemented a class that extends AbstractMavenReportRenderer, and filled out the renderBody(...) method with some calls to the