maven-plugin

ClassNotFoundException when running JUnit unit tests within Eclipse (using Maven)

那年仲夏 提交于 2019-12-20 10:32:46
问题 I have just upgraded my SpringSource Tools Suite (STS, a variant IDE of Eclipse) to the latest version (v3.6.1). Then all my JUnit unit tests can not be run again. I am getting this error: Class not found ClassToTest java.lang.ClassNotFoundException: ClassToTest at java.net.URLClassLoader$1.run(URLClassLoader.java:200) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java

How to programatically invoke a maven dependency plugin

99封情书 提交于 2019-12-20 10:23:37
问题 I am trying to invoke maven-dependency-plugin programatically. i am using maven 3 version. the problem is that when i invoke it through pluginManager.executeMojo(session, execution), i receive the following error message: [ERROR] **The parameters 'project', 'local', 'remoteRepos', 'reactorProjects' for goal org.apache.maven.plugins:maven-dependency-plugin:2.1:unpack are missing or invalid** **org.apache.maven.plugin.PluginParameterException: The parameters 'project', 'local', 'remoteRepos',

How to ignore maven profiles in child module?

二次信任 提交于 2019-12-20 05:49:15
问题 I want to run the simple flow, I have 6 profiles: generate-schema,unpack-war,run-jetty,test,stop-jetty,start-stop-app the test profile will run on a different child module when I declare it in the mvn goals/properties: * clean --activate-profiles generate-schema,unpack-war,start-stop-app,test --projects apm-tests,apm-tests\apm-adapter-tests verify.* How can I make the child module run only the tests and skip the rest of the profiles (generate-schema and etc.) ? Parent pom sample: <?xml

difference between keeping a plugin inside a project and inside a profile

女生的网名这么多〃 提交于 2019-12-20 05:24:29
问题 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) 回答1: Part A warSourceDirectory is

Is there a way to update default-bindings.xml for maven on local

坚强是说给别人听的谎言 提交于 2019-12-20 04:17:05
问题 It could sound dumb. But is there a way to edit or update the default-bindings file of maven? /META-INF/plexus/default-bindings.xml Why would I want to do that? Background - I am using latest maven version 3.3.9 on my machine as a home directory within intelliJ. I have a module named testng-test without any external plugin specified. Take a look at the pom.xml for the module : <artifactId>testng</artifactId> <dependencies> <dependency> <groupId>org.testng</groupId> <artifactId>testng<

Writing a Maven Plugin/Mojo: how do you make a goal force the execution of other goals?

风流意气都作罢 提交于 2019-12-19 18:25:18
问题 Note: this thread is about writing a custom Mojo, not using a plugin. I maintain a testing plugin for Maven. Unfortunately, for almost a year now, I've let this particular unknown linger and I'd really like to know how to deal with it so that its users can have a simpler configuration. Let's say we have two goals in our plugin: prepare (phase: generate-sources) do (phase: compile) I want to configure the do Mojo to require prepare to have been executed in the earlier phase of the build.

Reliably finding annotations on class loaded with URLClassLoader

风流意气都作罢 提交于 2019-12-19 11:40:09
问题 I have a code generator that uses URLClassLoader to load classes on a specified path, scan them for annotations, and then using Reflection on the fields/methods, generate DTOs. It works great, in the test app. When I put it into the Maven MOJO, I suddenly lose the ability to see the javax.persistence.Entity annotations on the classes. It loads them, it can see all the fields, but the Entity annotation is no longer visible. I am assuming this is something to do with Classpath issues - is it?

Change default mojo configuration in lifecycle mapping

江枫思渺然 提交于 2019-12-19 10:29:10
问题 I'm writing a Maven 3 plugin which builds plugins for another application. A plugin is basically a JAR file with some fancy manifests. The compiled classes need to be post-processed for the plugin to work with the production build of the host application. Unfortunately, the processed version of the plugin won't work with the debug build of the host. I therefore need to produce two artifacts: the raw classes with the classifier debug and the post-processed version as the main artifact. I've

Find dependencies of a Maven Dependency object

◇◆丶佛笑我妖孽 提交于 2019-12-19 10:20:32
问题 I'm writing a Maven 3 plugin that needs to know the transitive dependencies of a given org.apache.maven.model.Dependency . How can I do that? 回答1: So the following code should give you an impression how to do it. @Mojo( name = "test", requiresDependencyResolution = ResolutionScope.COMPILE, defaultPhase = LifecyclePhase.PACKAGE ...) public class TestMojo extends AbstractMojo { @Parameter( defaultValue = "${project}", readonly = true ) private MavenProject project; public void execute() throws

Find dependencies of a Maven Dependency object

天大地大妈咪最大 提交于 2019-12-19 10:19:20
问题 I'm writing a Maven 3 plugin that needs to know the transitive dependencies of a given org.apache.maven.model.Dependency . How can I do that? 回答1: So the following code should give you an impression how to do it. @Mojo( name = "test", requiresDependencyResolution = ResolutionScope.COMPILE, defaultPhase = LifecyclePhase.PACKAGE ...) public class TestMojo extends AbstractMojo { @Parameter( defaultValue = "${project}", readonly = true ) private MavenProject project; public void execute() throws