maven-2

src/main/webapp directory not recognized by Eclipse

心不动则不痛 提交于 2019-12-04 09:17:55
问题 I use m2eclipse to import Maven Java projects in Eclipse. It fails to recognize src/main/webapp as a source directory. Graphically in the package explorer (or when I look into Java-Build-Path in the project's properties), this directory isn't in the list of sources folder (while src/main/java or src/main/resources do). To access it, I have to look directly into the src/ directory, and start unfolding... Not very convenient! However, if I run maven install , the resources are copied to the

Calling Maven goals from Java

自闭症网瘾萝莉.ら 提交于 2019-12-04 09:15:28
问题 Is it possible to call Maven goals from Java, for instance, can I do the equivalent of: mvn clean package from a Java class? thanks, Nick 回答1: absolutely, you need to use the Maven Embedder API. Updated link is http://maven.apache.org/ref/3-LATEST/maven-embedder/index.html 回答2: This is easy :) Java code MavenCli cli = new MavenCli(); cli.doMain(new String[]{"clean", "package"}, "project_dir", System.out, System.out); Project configuration: <dependencies> <dependency> <groupId>org.apache.maven

Maven:Non-resolvable parent POM and 'parent.relativePath' points at wrong local POM

血红的双手。 提交于 2019-12-04 08:55:11
问题 I am using maven 3 to run the application but I am getting the following error: [ERROR] The build could not read 1 project -> [Help 1] org.apache.maven.project.ProjectBuildingException: Some problems were encountered while processing the POMs: [FATAL] Non-resolvable parent POM: Failure to find com.topdesk:tis-parent:pom:3. 4 in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates

Maven: Extract dependency resources before test

风流意气都作罢 提交于 2019-12-04 08:36:40
I have a multimodule Maven project. One subproject hosts XSL/XML resource files. The other project hosts Java code that needs to use these files in its unit tests. In the dependency's jar, the resources lie in the folder xml-resources . I found this example and tried to change it for my needs: <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-dependency-plugin</artifactId> <version>2.4</version> <executions> <execution> <id>resource-dependencies</id> <phase>process-test-resources</phase> <goals> <goal>unpack-dependencies</goal> </goals> <configuration> <classifier>xml

Inter Project Dependencies in Maven

无人久伴 提交于 2019-12-04 08:22:00
I have two maven projects: project-api project-impl project-impl's POM specifies a dependency on project-api. The top level aggregation pom lists modules project-api and project-impl. If I run compile at top level, the dependencies resolves correctly. If I run compile at project-impl, then it can't find dependency project-api. How can I set up maven such that when project-impl compiles, it first compiles and collects its dependencies on other projects? you can only do that from the root project mvn -pl child -am this will build your sub project and also all dependencies in the same tree. in

How to configure embedded OpenEJB container for tests properly?

感情迁移 提交于 2019-12-04 08:18:10
This is my SLSB: @Stateless public class MyService { PersistenceContext(unitName = "abc") EntityManager em; public boolean exists(int id) { return this.em.find(Employee.class, id) != null; } } This is my persistence.xml (I'm using Glassfish v3): <persistence> <persistence-unit name="abc"> <provider>org.hibernate.ejb.HibernatePersistence</provider> <jta-data-source>java:/MyDS</jta-data-source> <properties> <property name="hibernate.archive.autodetection" value="class" /> <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLInnoDBDialect" /> </properties> </persistence-unit> <

How can I display a message in Maven

☆樱花仙子☆ 提交于 2019-12-04 07:59:47
问题 How can I display a message in Maven? In ant, we do have "echo" to display a message, but in maven, how can I do that? 回答1: You can use the antrun plugin: <plugin> <artifactId>maven-antrun-plugin</artifactId> <executions> <execution> <phase>generate-resources</phase> <goals> <goal>run</goal> </goals> <configuration> <tasks> <echo>Hello world!</echo> </tasks> </configuration> </execution> </executions> </plugin> One issue though is that you have to choose what phase of the build lifecycle to

Maven : Missing artifact com.sun:tools:jar:1.6.0 compile time exception in POM.xml [duplicate]

你离开我真会死。 提交于 2019-12-04 07:54:53
This question already has answers here : JDK tools.jar as maven dependency (8 answers) Closed 5 years ago . I am getting one weird issue and getting a compile time exception in my pom.xml when i am trying to add dependancy for tools. jar displayed as below( Missing artifact com.sun:tools:jar:1.6.0 ) I have set my JAVA_HOME variable as below: JAVA_HOME : C:\Program Files\Java\jdk1.6.0_34 When i hardcode it to the actual path of JDK1.6 i dont find any error as below. <dependency> <groupId>com.sun</groupId> <artifactId>tools</artifactId> <version>1.6.0</version> <scope>system</scope> <systemPath

Buiding Hadoop with Eclipse / Maven - Missing artifact jdk.tools:jdk.tools:jar:1.6

烂漫一生 提交于 2019-12-04 07:40:11
问题 I am trying to import cloudera's org.apache.hadoop:hadoop-client:2.0.0-cdh4.0.0 from cdh4 maven repo in a maven project in eclipse 3.81, m2e plugin, with oracle's jdk 1.7.0_05 on win7 using <dependency> <groupId>org.apache.hadoop</groupId> <artifactId>hadoop-client</artifactId> <version>2.0.0-cdh4.0.0</version> </dependency> however, I get the following error: The container 'Maven Dependencies' references non existing library 'C:\Users\MyUserId\.m2\repository\jdk\tools\jdk.tools\1.6\jdk.tools

In a Maven project, how can I automatically update the version all child modules, plus the parent?

﹥>﹥吖頭↗ 提交于 2019-12-04 07:35:11
问题 I have a multi-module project. parent POM (1.0-SNAPSHOT) |-- module1 (1.0-SNAPSHOT) |-- module2 (1.0-SNAPSHOT) `-- module3 (1.0-SNAPSHOT) When I execute mvn release:prepare it verify that parent POM has a SNAPSHOT version and all dependent modules don't have a SNAPSHOT version. How automatically update all child modules from SNAPSHOT to the next release version? I would like automatically increment version for all modules. 回答1: The release plugin can handle that. Did you check Updating POM