많은 종속성이있는 maven 프로젝트가 있습니다. 어셈블리 플러그인을 사용하여 jar 파일을 모두 병합하려고합니다. 그러나 모든 종속성 jar 파일을 큰 문제로 풀지는 않습니다. 나는 그들 모두가 lib 폴더에 들어가기를 원하지만 클래스 경로를 추가하는 방법을 모른다. 내 치어 :maven 어셈블리 종속성 및 클래스 경로가있는 jar 파일을 만듭니다.
<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>test.com</groupId>
<artifactId>simple-weather</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>simple-weather</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.14</version>
</dependency>
<dependency>
<groupId>dom4j</groupId>
<artifactId>dom4j</artifactId>
<version>1.6.1</version>
</dependency>
<dependency>
<groupId>jaxen</groupId>
<artifactId>jaxen</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>velocity</groupId>
<artifactId>velocity</artifactId>
<version>1.5</version>
</dependency>
<dependency>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>lib/</classpathPrefix>
<mainClass>adi.com.weather.Main</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>attached</goal>
</goals>
</execution>
</executions>
<configuration>
<descriptors>
<descriptor>package.xml</descriptor>
</descriptors>
</configuration>
</plugin>
</plugins>
</build>
</project>
내 어셈블리 파일
<?xml version="1.0" encoding="UTF-8"?>
<assembly>
<id>test5</id>
<formats>
<format>jar</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<dependencySets>
<dependencySet>
<unpack>false</unpack>
<scope>runtime</scope>
<outputDirectory>lib</outputDirectory>
</dependencySet>
</dependencySets>
<fileSets>
<fileSet>
<directory>${project.build.outputDirectory}</directory>
<outputDirectory>/</outputDirectory>
</fileSet>
</fileSets>
</assembly>
올바른 pom 항목이있는 것 같습니다. 문제가 어디에 있습니까? lib 폴더에 들어 가지 않는 항아리? 항아리의 경로가 잘못된 것을 나타내는? – Raghuram
매니페스트의 classPath가 제대로 작동하지 않지만 영혼을 발견했습니다. –
좋은 작업 Adi Mor. 이 질문을 닫을 수 있도록 질문에 대한 답변을 직접 게시하고 답변을 수락 할 수 있습니까? 또한 문제를 해결하면 이전 질문에 대한 대답을 수락해야합니다. – Zecas