我已經準備了3個項目。其中兩個建成罐子,其中一個建成戰爭。無法從本地存儲庫下載定製jar
我有maven在eclipse中構建了2個jar項目。我發現他們已經放入本地存儲庫。
但是,當我直接構建戰爭項目時,我已經在pom中設置了依賴關係,它應該從存儲庫下載。但是,它不能下載。當我在build war文件中檢查web_inf/lib時。只有兩個空文件夾找到。
如果我直接構建pom.work.app。構建的war文件將包含所有需要的定製jar項目。
我有搜索互聯網上的相關問題,但沒有建議的解決方案可以幫助。
我在構建戰爭項目中缺少的東西。
這是.m2目錄設置文件
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<localRepository>C:\Users\Vincent\.m2\repository\</localRepository>
<profiles>
<profile>
<id>jboss-public</id>
<repositories>
<repository>
<id>jboss-public-repository</id>
<name>JBoss Public Maven Repository Group</name>
<url>http://repository.jboss.org/nexus/content/groups/public/</url>
</repository>
<repository>
<id>jboss-local-repository</id>
<name>JBoss local Maven Repository Group</name>
<url> file://C:\Users\Vincent\.m2\repository\</url>
</repository>
</repositories>
</profile>
<profile>
<id>wildfly-remote</id>
<properties>
<wildfly-hostname>127.0.0.1</wildfly-hostname>
<wildfly-port>9991</wildfly-port>
<wildfly-username>vincent</wildfly-username>
<wildfly-password>x12345</wildfly-password>
</properties>
</profile>
<profile>
<id>wildfly-local</id>
<properties>
<wildfly-home>G:\Program Files (x86)\wildfly-10.1.0.Final</wildfly-home>
<wildfly-hostname>localhost</wildfly-hostname>
<wildfly-port>9991</wildfly-port>
<wildfly-username>vincent</wildfly-username>
<wildfly-password>x12345</wildfly-password>
</properties>
</profile>
</profiles>
這是pom.work.app文件
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>example.work</groupId>
<artifactId>pom.work.app</artifactId>
<version>0.0.1</version>
<packaging>pom</packaging>
<name>pom.work.app</name>
<url>http://maven.apache.org</url>
<modules>
<module>../jar.work.framework.service</module>
<module>../jar.work.service</module>
<module>../work.ui</module>
</modules>
<properties>
.......
.......
<properties>
<repositories>
<repository>
<id>maven repo</id>
<url>http://repo1.maven.org/maven2</url>
</repository>
<repository>
<id>eaio.com</id>
<url>http://eaio.com/maven2</url>
</repository>
<repository>
<id>maven-restlet</id>
<name>Public online Restlet repository</name>
<url>http://maven.restlet.com</url>
</repository>
<repository>
<id>JBoss Repository</id>
<name>JBoss Repository</name>
<url>http://repository.jboss.org/nexus/content/groups/public-jboss/</url>
</repository>
</repositories>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>example.work</groupId>
<artifactId>jar.work.framework.service</artifactId>
<version>${example.work}</version>
</dependency>
<dependency>
<groupId>example.work</groupId>
<artifactId>jar.work.service</artifactId>
<version>${example.work}</version>
</dependency>
.......
.......
</dependencies>
</dependencyManagement>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.wildfly.plugins</groupId>
<artifactId>wildfly-maven-plugin</artifactId>
<version>1.2.0.Alpha6</version>
<executions>
<execution>
<phase>install</phase>
<goals>
<goal>deploy</goal>
</goals>
<configuration>
<hostname>127.0.0.1</hostname>
<port>9990</port>
<username>vincent</username>
<password>x12345</password>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>${jdk.version}</source>
<target>${jdk.version}</target>
<debug>true</debug>
<debuglevel>lines,source</debuglevel>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.1.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.17</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<id>copy</id>
<phase>install</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<copy file="${basedir}/../work/target/work.ui.war"
tofile="G:\Program Files (x86)\wildfly-10.1.0.Final\standalone\deployments\tmp_work.war" />
</target>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
這是work.ui POM文件
<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>
<parent>
<groupId>excample.work</groupId>
<artifactId>pom.work.app</artifactId>
<version>0.0.1</version>
<relativePath>../pom.work.app/pom.xml</relativePath>
</parent>
<artifactId>work.ui</artifactId>
<packaging>war</packaging>
<name>work Maven Webapp</name>
<repositories>
<repository>
<id>maven repo</id>
<url>http://repo1.maven.org/maven2</url>
</repository>
<repository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>https://repo.spring.io/libs-snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>prime-repo</id>
<name>PrimeFaces Maven Repository</name>
<url>http://repository.primefaces.org</url>
<layout>default</layout>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>excample.work</groupId>
<artifactId>jar.work.service</artifactId>
<version>${xcample.work}</version>
</dependency>
<dependency>
<groupId>excample.work</groupId>
<artifactId>jar.work.framework.service</artifactId>
<version>${xcample.work}</version>
</dependency>
</dependencies>
<build>
<defaultGoal>install</defaultGoal>
<directory>${basedir}/target</directory>
<finalName>${project.artifactId}</finalName>
<sourceDirectory>src/main/java</sourceDirectory>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<warName>${project.artifactId}</warName>
<webXml>src/main/webapp/WEB-INF/web.xml</webXml>
<webResources>
<resource>
<directory>src/main/webapp</directory>
<includes>
<include>**/*</include>
</includes>
</resource>
</webResources>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
這是罐子。 work.service文件
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>example.work</groupId>
<artifactId>pom.work.app</artifactId>
<version>0.0.1</version>
<relativePath>../pom.work.app/pom.xml</relativePath>
</parent>
<artifactId>jar.work.service</artifactId>
<packaging>jar</packaging>
<name>jar.work.service</name>
<url>http://maven.apache.org</url>
<dependencies>
.......
......
</dependencies>
<build>
<defaultGoal>install</defaultGoal>
<directory>${basedir}/target</directory>
<finalName>${project.artifactId}</finalName>
<sourceDirectory>src/main/java</sourceDirectory>
<resources>
<resource>
<directory>
src/main/resources
</directory>
</resource>
</resources>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>default-cli</id>
<phase>generate-resources</phase>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
這是jar.work.framework.service文件
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>example.work</groupId>
<artifactId>pom.work.app</artifactId>
<version>0.0.1</version>
<relativePath>../pom.work.app/pom.xml</relativePath>
</parent>
<artifactId>jar.work.framework.service</artifactId>
<name>jar.work.framework.service</name>
<description>service</description>
<dependencies>
.......
.......
</dependencies>
<build>
<defaultGoal>install</defaultGoal>
<directory>${basedir}/target</directory>
<finalName>${project.artifactId}</finalName>
<sourceDirectory>src/main/java</sourceDirectory>
<resources>
<resource>
<directory>
src/main/resources
</directory>
</resource>
</resources>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>default-cli</id>
<phase>generate-resources</phase>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
後,我建立獨立,他們的jar文件在本地存儲庫中創建兩個jar項目。
構建work.ui後,只有空的文件夾中創建。
我在eclipse中輸入目標「clean install -U」作爲命令 – vincent
刪除了不適合XML的片段。內嵌圖片 –
哪些代碼段?例如? – vincent