Jaz*_*epi 6 eclipse dependencies maven-3
我在eclipse中有一个maven 3项目,其结构如下.应用程序项目充当所有其他应用程序的父项目.我已经从app项目(第一个pom)中包含了pom.xml,并从app-web项目中包含了pom.xml.(第二个pom)
app
app-ear
app-ejg
app-web
我遇到的问题是我可以在app-web/pom.xml的有效pom中看到来自父项的依赖项,但app-web项目中的java类无法从这些依赖项导入.我得到"导入com.fasterxml无法解析".我也有app-ejb项目的这个问题.我不认为这只是一个"日食错误".如果我尝试从app项目mvn clean install我得到编译错误抱怨同样的事情.
顺便说一句,我所做的唯一改变就是将依赖项从子项的pom.xml中移出并转移到父项中.我希望尽可能集中内容,并尽可能将项目配置保持为DRY.在将依赖关系向上移动之前,事情很好.我正在为安装了m2e,m2e-wtp和WTP补丁的Java EE开发人员使用Eclipse Juno.
应用程序/ pom.xml的
<?xml version="1.0" encoding="UTF-8"?>
<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.boardgamebuilder</groupId>
<artifactId>app</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<name>app application</name>
<modules>
<module>app-ejb</module>
<module>app-web</module>
<module>app-ear</module>
</modules>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java-version>1.6</java-version>
<org.slf4j-version>1.7.2</org.slf4j-version>
<com.fasterxml.jackson-version>2.1.1</com.fasterxml.jackson-version>
</properties>
<dependencyManagement>
<dependencies>
<!-- JSON handler -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>${com.fasterxml.jackson-version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>${com.fasterxml.jackson-version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${com.fasterxml.jackson-version}</version>
</dependency>
<!-- RESTful servlet -->
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-server</artifactId>
<version>1.16</version>
</dependency>
<!-- Logging -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${org.slf4j-version}</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.0.7</version>
</dependency>
<!-- Test -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.10</version>
<scope>test</scope>
</dependency>
<!-- Misc -->
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-web-api</artifactId>
<version>6.0</version>
<scope>provided</scope>
</dependency>
<!-- Define the version of the EJB jar so that we don't need to repeat
ourselves in every module -->
<dependency>
<groupId>com.boardgamebuilder</groupId>
<artifactId>app-ejb</artifactId>
<version>0.0.1-SNAPSHOT</version>
<type>ejb</type>
</dependency>
<!-- Define the version of the WAR so that we don't need to repeat ourselves
in every module -->
<dependency>
<groupId>com.boardgamebuilder</groupId>
<artifactId>app-web</artifactId>
<version>0.0.1-SNAPSHOT</version>
<type>war</type>
<scope>compile</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<pluginManagement>
<plugins>
<!-- Compiler plugin enforces Java 1.6 compatibility and activates annotation
processors -->
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
Run Code Online (Sandbox Code Playgroud)
应用的web/pom.xml中
http://maven.apache.org/maven-v4_0_0.xsd"> 4.0.0
<parent>
<artifactId>app</artifactId>
<groupId>com.boardgamebuilder</groupId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>app-web</artifactId>
<packaging>war</packaging>
<name>app Web module</name>
<build>
<plugins>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
</plugin>
</plugins>
</build>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
28890 次 |
| 最近记录: |