Показать сообщение отдельно
Непрочитано 19.02.2012, 20:04   #9
Аватар для J.O.K.E.R.
Пользователь

Автор темы (Топик Стартер) Re: Компиляция в eclipse

http://rghost.ru/36604028

Добавлено через 9 минут
Я порезал, получилось так:
Код:
<?xml version="1.0" encoding="UTF-8"?>
<project name="L2J_CommunityServer" default="dist" basedir=".">
	<property name="src" location="java" />
	<property name="lib" location="lib" />
	<property name="build" location="build" />
	<property name="build.classes" location="${build}/classes" />
	<property name="build.dist" location="${build}/dist" />
	<property name="build.dist.community" location="${build.dist}/community" />
	<property name="build.dist.doc" location="${build.dist}/doc" />
	<property name="build.dist.libs" location="${build.dist}/libs" />

	<path id="classpath">
		<fileset dir="${lib}">
			<include name="*.jar" />
		</fileset>
	</path>

	<pathconvert property="manifest.libs" pathsep=" ">
		<path refid="classpath" />
		<mapper>
			<chainedmapper>
				<flattenmapper />
				<globmapper from="*.jar" to="../libs/*.jar" />
			</chainedmapper>
		</mapper>
	</pathconvert>

	<target name="init" depends="clean,checkRequirements,getChangelogDateVersion" description="Create the output directories.">
		<mkdir dir="${build}" />
		<mkdir dir="${build.classes}" />
	</target>

	<target name="compile" depends="init" description="Compile the source.">
		<javac srcdir="${src}" classpathref="classpath" destdir="${build.classes}" compiler="javac1.7" debug="true" debuglevel="lines,vars,source" includeantruntime="false" source="1.7" target="1.7" />
	</target>

	<target name="jar" depends="compile">
		<jar destfile="${build.dist.community}/l2jcommunity.jar">
			<fileset dir="${build.classes}" />
			<manifest>
				<attribute name="Built-By" value="${user.name}" />
				<attribute name="Built-Date" value="${build.tstamp}" />
				<attribute name="Class-Path" value="${manifest.libs}" />
				<attribute name="Implementation-URL" value="http://www.l2jserver.com/" />
				<attribute name="Implementation-Version" value="${l2j.version}" />
				<attribute name="Main-Class" value="com.l2jserver.communityserver.L2CommunityServer" />
			</manifest>
		</jar>
	</target>

	<target name="dist" depends="jar">
		<copy todir="${build.dist}">
			<fileset dir="dist" />
		</copy>
		<concat destfile="${build.dist.community}/config/l2jcs-version.properties">version=${l2j.version}${line.separator}builddate=${build.tstamp}</concat>
		<concat destfile="${build.dist.doc}/L2J_CommunityServer_CHANGELOG.txt">${l2j.changelog}</concat>
		<copy todir="${build.dist.libs}">
			<fileset dir="lib" />
		</copy>
		<fixcrlf srcdir="${build.dist.community}" eol="crlf" eof="remove" includes="**/*.bat" />
		<fixcrlf srcdir="${build.dist.community}" eol="lf" eof="remove" includes="**/*.sh" />
		<zip destfile="${build}/L2J_CommunityServer.zip" basedir="${build.dist}" />
	</target>

	<target name="clean" description="Remove the output directories">
		<delete dir="${build}" />
	</target>

	<target name="checkRequirements" description="Check Requirements">
		<fail message="Ant 1.8.2 is required. But your version is ${ant.version}">
			<condition>
				<not>
					<antversion atleast="1.8.2" />
				</not>
			</condition>
		</fail>
		<available classname="java.lang.AutoCloseable" property="JDK7.present" />
		<fail unless="JDK7.present" message="Java 1.7 is required. But your version is Java ${ant.java.version} and probably JDK is not installed." />
	</target>

	<target name="getChangelogDateVersion" description="Get Changelog, Date, Version">
 
		<tstamp>
			<format property="build.tstamp" pattern="dd/MM/yyyy HH:mm" />
		</tstamp>
		
	</target>
</project>
Компилится норм:
Код:
Buildfile: E:\server\eclipse\work\L2J_CommunityServer\build.xml
clean:
checkRequirements:
getChangelogDateVersion:
init:
    [mkdir] Created dir: E:\server\eclipse\work\L2J_CommunityServer\build
    [mkdir] Created dir: E:\server\eclipse\work\L2J_CommunityServer\build\classes
compile:
    [javac] Compiling 52 source files to E:\server\eclipse\work\L2J_CommunityServer\build\classes
jar:
      [jar] Building jar: E:\server\eclipse\work\L2J_CommunityServer\build\dist\community\l2jcommunity.jar
dist:
     [copy] Copying 11 files to E:\server\eclipse\work\L2J_CommunityServer\build\dist
     [copy] Copying 5 files to E:\server\eclipse\work\L2J_CommunityServer\build\dist\libs
      [zip] Building zip: E:\server\eclipse\work\L2J_CommunityServer\build\L2J_CommunityServer.zip
BUILD SUCCESSFUL
Total time: 2 seconds

Последний раз редактировалось J.O.K.E.R.; 19.02.2012 в 20:13. Причина: Добавлено сообщение
J.O.K.E.R. вне форума Отправить сообщение для J.O.K.E.R. с помощью Skype™ Ответить с цитированием