티스토리 뷰

부트없이 표준프레임워크 배치 템플릿(commandline)을 jar로 묶는 방법이다.

pom.xml 에 아래의 build 설정을 해주고 build를 하면 실행가능한 jar를 만들수 있다.

표프의 배치템플릿에 부트 도입이 시급하다..

 

	<build>
		<defaultGoal>install</defaultGoal>
		<directory>${basedir}/target</directory>
		<finalName>egovframework.example.bat.template.sam.commandline</finalName>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-compiler-plugin</artifactId>
				<configuration>
					<source>1.8</source>
					<target>1.8</target>
					<encoding>UTF-8</encoding>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-dependency-plugin</artifactId>
				<version>2.6</version>
				<executions>
					<execution>
						<id>copy-dependencies</id>
						<phase>package</phase>
						<goals>
							<goal>copy-dependencies</goal>
						</goals>
						<configuration>
							<outputDirectory>${project.build.directory}/lib</outputDirectory>
						</configuration>
					</execution>
				</executions>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-jar-plugin</artifactId>
				<version>2.6</version>
				<configuration>
					<archive>
						<index>true</index>
						<manifest>
							<addClasspath>true</addClasspath>
							<mainClass>egovframework.example.bat.commandline.EgovCommandLineJobRunner</mainClass>
						</manifest>
						<manifestEntries>
							<mode>development</mode>
							<url>${pom.url}</url>
							<key>value</key>
						</manifestEntries>
					</archive>
				</configuration>
			</plugin>
		</plugins>
	</build>

 

job파일 수정

/batch-cmdline-standalone/src/main/resources/egovframework/batch/job/delimitedToDelimitedJob.xml

 

reader

<property name="resource" value="classpath:/egovframework/batch/data/inputs/csvData.csv" />

 

writer

<property name="resource" value="file:./test-outputs/csvOutput.csv" />

 

실행명령어

 

java -cp "C:/eGovFrame-3.9.0/workspace.edu/batch-cmdline-standalone/target/egovframework.example.bat.template.sam.commandline.jar;C:/eGovFrame-3.9.0/workspace.edu/batch-cmdline-standalone/target/lib/*" egovframework.example.bat.commandline.EgovCommandLineJobRunner /egovframework/batch/context-commandline.xml delimitedToDelimitedJob
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/05   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
글 보관함