maven-2

Netbeans & Maven: different compilation behavior

浪尽此生 提交于 2019-12-07 09:30:03
问题 I am using Netbeans and Maven projects. In some case Netbeans show me compilation failures (red ballon) BUT Maven compile everything without any problem! What can be the reason of this difference. I already checked that both are using the same JDK version. 回答1: One possible reason could be that you have not added the required jar in your net beans class path. But the jar is being listed in your maven pom.xml 回答2: Try doing this, do an mvn install once from your command line in your project

Why Maven is running tests again, when JAR is already there?

点点圈 提交于 2019-12-07 09:00:23
问题 I install my maven project: mvn clean install Everything works fine, JAR file is created in /target directory. Now I run it again: mvn install Maven executes unit tests and static code analysis again. I didn't make any changes to the .java files and JAR is there, so why running tests again? Am I doing something wrong or is it how maven is designed? 回答1: Now I run it again (...) Maven executes unit tests and static code analysis again Because that's simply what you're asking Maven to do. When

Maven Exec Plugin not reading configuration

自古美人都是妖i 提交于 2019-12-07 08:58:42
问题 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

How do you specify a string of goals as the defaultGoal in maven 2?

眉间皱痕 提交于 2019-12-07 08:53:51
问题 I'm just curious, is there a way to specify that you want a string of goals run as the default goal in a maven project? Is there an equivalent to Ant's <project name="MyProject" basedir="." default="main"><target name="main" depends="clean,run"/> ? 回答1: There is something roughly equivalent, you CAN define a default goal or phase that will be executed if none is given in the build element: <build> <defaultGoal>install</defaultGoal> ... </build> But this has to be a single phase, or goal, you

Classloading issues in maven2 with JUnit

笑着哭i 提交于 2019-12-07 07:51:37
问题 I have a project that builds with maven2 and runs a series of JUnit test cases against the code. This has worked fine up until this point, where I now have 2 tests that must run in a certain sequence for things to work correctly, let's say TestA and Test (A then B). Unfortunately, maven2 doesn't understand this, so I'm looking for a way of convincing it that it needs to run the tests in this order. The problem is that I'm setting some final static fields in TestB, but I'm doing this from

Why maven compilation doesn't work with “pom” packaging type

主宰稳场 提交于 2019-12-07 07:41:48
问题 I don't know why my maven build doesn't generate target/classes in current pom setting, the packaging type must be "pom" in my case, please advise what is wrong... Thanks! <?xml version="1.0" encoding="UTF-8" standalone="no"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.abc.sm.doctor<

How can I embed Maven into my application?

谁都会走 提交于 2019-12-07 07:10:16
问题 I'd like to embed Maven or the library that does all the magic into my Java application. The keypoints : They are two tasks I want to perform : 1/ Publishing a jar in local repository 2/ Publishing a jar in a private enterprise repository (Nexus) All required jars MUST be located in a public Maven repository The jars SHOULD be Maven version agnostic (ie not specific to Maven 2 or 3) If you can , please provide a snippet with your response. 回答1: Here is an example embedding Maven 2 libraries:

how to generate jar and war both in project

不羁岁月 提交于 2019-12-07 06:36:23
问题 we have two different project . And and the controller is almost same in two project. project A has controller inside it. So generating war for it is not problem. But project B is requiring Controller's jar of project A controller. Can any body tell me how can i generate the jar file from the controller of project A which i can use in project B? 回答1: The default solution for such thing is to have two separate modules one for the war and one for the controller module. Don't start fighting with

Maven2: Cargo plugin hot deployment & Jonas support

本秂侑毒 提交于 2019-12-07 06:20:15
问题 I am trying to get the Cargo plugin works on my maven project in order to benefit from war hot-deployment targetting the Jonas server. The official documentation is not that clear on what is supported and what is not (for example you can find this: http://cargo.codehaus.org/Hot+Deployment but also this http://cargo.codehaus.org/JOnAS+4.x). Anyway I have the following coniguration in for my war's POM: <plugin> <groupId>org.codehaus.cargo</groupId> <artifactId>cargo-maven2-plugin</artifactId>

com.sun:tools:jar:1.4.2 missing when running “perform eclipse” in roo

安稳与你 提交于 2019-12-07 06:20:00
问题 When I run "perform eclipse" in Roo I get: roo> perform eclipse [INFO] Scanning for projects... [INFO] ------------------------------------------------------------------------ [INFO] Building bugzter [INFO] task-segment: [eclipse:clean, eclipse:eclipse] [INFO] ------------------------------------------------------------------------ [INFO] [eclipse:clean {execution: default-cli}] [INFO] Deleting file: .project [INFO] Deleting file: .classpath [INFO] Deleting file: .wtpmodules [INFO] Deleting