'executable'에 해당되는 글 2건

  1. 2016.04.11 [Java] Build Executable Jar + Local Dependency Jar on Intellij
  2. 2015.12.05 [JAVA] executable jar 생성 시 pom.xml build 설정.

[Java] Build Executable Jar + Local Dependency Jar on Intellij

ITWeb/개발일반 2016. 4. 11. 19:09

예전 글에 일부 설명이 있는데 오늘 삽질한 내용으로 기록해 봅니다.


local 에서 systemPath를 이용해서 dependency 를 설정해 준 경우 manifest 파일에 classpath 로 등록이 되지 않는 문제였습니다.

해결 방법은 아래 코드에 <manifestEntries />를 이용해서 추가해 주었습니다.


<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
<configuration>
<archive>
<index>false</index>
<manifestEntries>
<Class-Path>lib/system-path-jar-0.0.1.jar</Class-Path>
</manifestEntries>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>lib/</classpathPrefix>
<mainClass>MainClass</mainClass>
</manifest>
</archive>
</configuration>
</plugin>


아래 글 참고해서 보세요.

  1. 2015.12.05 [JAVA] executable jar 생성 시 pom.xml build 설정.
  2. 2015.09.22 [Maven] Executable jar + Assembly 를 이용한 tar 묶기.


:

[JAVA] executable jar 생성 시 pom.xml build 설정.

ITWeb/개발일반 2015. 12. 5. 20:40

맨날 잊어버리기 때문에 별거 아니지만 그냥 기록 합니다.


아래 설정은 executable jar 를 만들때 필요한 dependency jar 와 classpath 를 함께 구성해 주기 위해서 사용을 합니다.

자세한 내용은 링크 참고 하시면 됩니다.


[Apache Maven Archiver Examples Classpath]


[build property example]

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<includeScope>compile</includeScope>
<outputDirectory>${project.build.directory}/lib</outputDirectory>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>false</overWriteSnapshots>
<overWriteIfNewer>true</overWriteIfNewer>
</configuration>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
<configuration>
<archive>
<index>false</index>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>lib/</classpathPrefix>
<mainClass>MainClass</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<!-- Ignore/Execute plugin execution -->
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<!-- copy-dependency plugin -->
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<versionRange>[1.0.0,)</versionRange>
<goals>
<goal>copy-dependencies</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore />
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>


: