maven-plugin

Add maven-build-classpath to plugin execution classpath

前提是你 提交于 2019-11-26 15:35:23
问题 I am writing some code-gen maven-plugin. I need my project classpath be injected in to my plugin execution classpath. I found this article. The solution there works but is quite long. Maybe someone of you know an out of the box solution. 回答1: Found the answer! OK , Pascal is right , here it is for the foundation!! So here is the cleanest way ( as far as i know ) to add the compile classpath to the execution of you plugin. Here are some code samples from my code-gen plugin, that is actually

How do I execute a program using Maven?

送分小仙女□ 提交于 2019-11-26 15:01:09
I would like to have a Maven goal trigger the execution of a java class. I'm trying to migrate over a Makefile with the lines: neotest: mvn exec:java -Dexec.mainClass="org.dhappy.test.NeoTraverse" And I would like mvn neotest to produce what make neotest does currently. Neither the exec plugin documentation nor the Maven Ant tasks pages had any sort of straightforward example. Currently, I'm at: <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>exec-maven-plugin</artifactId> <version>1.1</version> <executions><execution> <goals><goal>java</goal></goals> </execution></executions>

Eclipse : Maven search dependencies doesn&#39;t work

一曲冷凌霜 提交于 2019-11-26 14:54:28
I created a new simple Maven project in a new Workspace. When I open the pom.xml 's Dependencies view in Eclipse editor, and I choose Add.. dependency, there's no search results no matter what search criteria I input in the search fields: It instantly give me, for example, Results for 'spring' (0) . In my other workspace, with my existing projects I don't have this problem. Is there a way to fix that ? Xiujun Ma Eclipse artifact searching depends on repository's index file. It seems you did not download the index file. Go to Window -> Prefrences -> Maven and check "Download repository index

Difference of Maven JAXB plugins

大兔子大兔子 提交于 2019-11-26 14:53:58
I have determined that two JAXB plugins for Maven 2 exist, with some different configurations. The one is from Sun: http://jaxb.dev.java.net/jaxb-maven2-plugin/ , the other from Mojohaus: http://mojohaus.org/jaxb2-maven-plugin/ Which of these two plugins can be recommended? Thanks Matt. On my little research project, I found that there's quite another plugin comming from the sunners: <groupId>com.sun.tools.xjc.maven2</groupId> <artifactId>maven-jaxb-plugin</artifactId> and that one: <groupId>org.jvnet.jaxb2.maven2</groupId> <artifactId>maven-jaxb2-plugin</artifactId> and still the one from

Plugin org.apache.maven.plugins:maven-clean-plugin:2.5 or one of its dependencies could not be resolved

时光总嘲笑我的痴心妄想 提交于 2019-11-26 14:00:03
问题 I have install maven in my machine. I have properly set the class-path and maven home folder. Every time I execute mvn clean install , it gives me exception. I have also tried to delete the .m2 folder but the same result. mvn -version output Apache Maven 3.3.3 (7994120775791599e205a5524ec3e0dfe41d4a06; 2015-04-22T19:57:37+08:00) Maven home: C:\maven-3 Java version: 1.7.0_45, vendor: Oracle Corporation Java home: D:\jdk170_45\jre Default locale: en_US, platform encoding: MS950 OS name:

How do I execute a set of goals before my Maven plugin runs?

試著忘記壹切 提交于 2019-11-26 13:08:04
问题 I\'m writing a Maven plugin (Mojo) that needs to execute a standard set of other plugin executions before it is run. Is there a mechanism to declare all the goals within my plugin so I don\'t have to rely on the user defining them all in their POM? 回答1: You can do this by defining a custom lifecycle and invoking that lifecycle before your Mojo is executed via the execute annotation. In your Mojo, declare in the Javadoc the lifecycle to be executed: /** * Invoke the custom lifecycle before

Using Maven for C/C++ projects

只愿长相守 提交于 2019-11-26 12:50:00
问题 I\'m putting Maven build around cluster of amateur, poorly written and frankly - primitive C/C++ code (meaning some C, some C++). Problem is - there\'s lots of it in circulation currently and cannot be easily replaced. Building it requires a lot of tribal knowledge (you have to go from cube to cube just to find out how to compile/build various parts) and releasing is total nightmare. (No - I\'m not going to rewrite it, plz don\'t ask) My question is - should I use maven-native-plugin to

Run a single Maven plugin execution?

对着背影说爱祢 提交于 2019-11-26 12:12:55
问题 I thought I was an experienced Maven user, but I am having a mental block on how to do this! I\'ve been able to use the Maven sql plugin to drop, create, and install a schema in a database via plugin executions I\'ve defined and bound to the pre-integration-test phase. However, now I\'d like to use that same sql plugin to insert some sample data whenever I want from the command line -- that is, not bound to any lifecycle goal. There are a few different sets of sample data, so I\'d like to

Is it possible to create an “uber” jar containing the project classes and the project dependencies as jars with a custom manifest file?

吃可爱长大的小学妹 提交于 2019-11-26 11:44:40
I'm trying to create a executable jar(using maven) that contains the project classes and it's dependencies with a manifest file that has the entry for the main class and the class path entry that points to the dependencies packed in the root of the jar;something like this : Manifest File: ..... Main-Class : com.acme.MainClass Class-Path : dependecy1.jar dependecy2.jar ..... Jar: jar-root |-- .... |-- com/acme/../*.class |-- dependecy1.jar `-- dependecy2.jar I'm using the maven-jar-plugin to create the manifest file and the maven-shade-plugin to create the "uber" jar but the dependencies are

How to get access to Maven&#39;s dependency hierarchy within a plugin

北城余情 提交于 2019-11-26 09:36:22
问题 In my plugin I need to process the dependency hierarchy and get information (groupId, artifactId, version etc) about each dependency and if it was excluded. What is the best way to do this? 回答1: The dependency plugin has the tree goal that does most of this work. It processes a MavenProject using the DependencyTreeBuilder , this returns a DependencyNode with hierarchical information about the resolved dependencies (and their transitive dependencies). You can copy much of the code directly