简体   繁体   English

IntelliJ可以编译吗?

[英]Can IntelliJ `make compile`?

I am working on a Java assignment, in the folder there's a Makefile , which looks like this 我正在处理Java作业,在文件夹中有一个Makefile ,看起来像这样

SOURCES = $(wildcard src/*.java src/*/*.java)

all: compile doc

compile: $(SOURCES) pre-build
    @@javac -d bin -Xlint:unchecked $(SOURCES)
    @@cp -r src/view bin/

doc: $(SOURCES)
    @@javadoc @doc_args $(SOURCES)

run: compile
    @@echo "Press 'p' to pause, 'r' to resume, 'cmd-q' to quit"
    @@java -cp bin RunningHeadline data_stream.json &

runcli: compile
    @@java -cp bin model.Feeder  data_stream.json &

pre-build:
    @@mkdir -p bin

clean:
    @@echo "Deleting all generated files"
    @@rm -rf bin/*
    @@rm -rf docs/*

diag:
    @@echo $(SOURCES)

.PHONY: all compile doc run runcli pre-build clean diag

help:
    @@echo "To run GUI client: make run"
    @@echo "To run CLI client: make runcli"

Can I make compile this file in IntelliJ? make compile在IntelliJ中make compile此文件吗?

I am using Windows system. 我正在使用Windows系统。 Though I've got Ubuntu Bash in Windows, it doesn't have a good interaction compatible with Windows. 尽管我在Windows中安装了Ubuntu Bash,但它与Windows的交互性不好。 Just wondered if I can achieve the same functionality in IntelliJ? 只是想知道我是否可以在IntelliJ中实现相同的功能?

Basically this simple script does nothing else but compile some source files and provide different targets for executing the application. 基本上,这个简单的脚本除了编译一些源文件并为执行应用程序提供不同的目标外,什么也不做。

And of course: any decent IDE and more advanced editors can take care of that. 当然,任何体面的IDE和更高级的编辑器都可以解决这一问题。

The real answer: pick an IDE or more powerful editor and adapt the content of this makefile to match the features of that platform. 真正的答案:选择一个IDE或更强大的编辑器,并修改该Makefile的内容以匹配该平台的功能。 What I mean is: don't focus on this makefile. 我的意思是:不要专注于这个makefile。 Understand what you need, and then look out for that functionality in IntelliJ for example. 了解您的需求,然后在IntelliJ中寻找该功能。

Can I make compile this file in IntelliJ? 我可以在IntelliJ中编译此文件吗?

Short answer: No. 简短答案:不可以。

A short search did not reveal any way to run a Makefile in Intellij ... but I may have missed something. 简短的搜索并没有发现在Intellij中运行 Makefile的任何方法...但是我可能错过了一些东西。 (I did find a Makefile plugin, but I think it only implements editing of Makefiles.) (我确实找到了一个Makefile插件,但我认为它仅实现了Makefile的编辑 。)

If you want to use that Makefile to build your code, I suggest that you install a copy of make and a JDK. 如果要使用该Makefile生成代码,建议您安装make和JDK的副本。 Then run make from the command line. 然后从命令行运行make

But (IMO) you are probably better off ignoring the Makefile and building / running your code using Intellij itself. 但是(IMO)您最好还是忽略Makefile并使用Intellij本身构建/运行代码。 Or better still, learn about Maven or Ant or Gradle and create the corresponding build files so that you can use those tools for building your code. 或者更好的是,了解Maven或Ant或Gradle并创建相应的构建文件,以便您可以使用这些工具来构建代码。

The logic of the rules in your Makefile are extremely simple, and you most likely don't need to learn about Make to figure out what they mean. Makefile中规则的逻辑非常简单,您很可能无需了解Make即可了解它们的含义。

Final suggestion: ask your teacher! 最后建议:问老师!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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