简体   繁体   中英

Compile and create a runnable jar file like eclipse, via cli

I would like to create a runnable jar in the same manner in which eclipse does, but from CLI. I am using buildbot and I would like to be able to automatically create, for example, nightly builds automatically, but are also runnable.

My Makefile:

JFLAGS = -g
JC = javac
JAR = jar
JARFLAGS = cfe ./bin/java.jar alone.Gameloop -C resources . -C ./
.SUFFIXES: .java .class
.java.class:
    $(JC) $(JFLAGS) $(wildcard alone/*.java)
    #$(JC) $(JFLAGS) $*.java

CLASSES = \
    $(wildcard alone/*.java) \
#   alone/Enter.java \
#   alone/GameLoop.java \
#   alone/ImageRender.java \
#   Blah.java \
#   Library.java \
#   Main.java 

all: classes

default: classes

packages: jars

jars:
    #echo $(JAR) $(JARFLAGS) $(CLASSES:.java=.class)
    #false
    $(JAR) $(JARFLAGS) $(CLASSES:.java=.class)

classes: $(CLASSES:.java=.class)

clean:
    $(RM) *.class

Thanks for the help! :)

Your stuff looks okay all you have to do is add $(CLASSES) to the jars target as a dependency:

jars: classes $(JAR) $(JARFLAGS) $(CLASSES:.java=.class)

and then make jars will do the stuff nightly

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM