开发者

Is there an easy way to tell if a Java project is written from i.e. NetBeans or Eclipse?

开发者 https://www.devze.com 2023-03-31 09:13 出处:网络
Is there an easy way to tell if a Java project is written in a specific IDE? Seems to me like Java projects made by a specific IDE will not be totally transparent to another IDE so it is imp开发者_运维

Is there an easy way to tell if a Java project is written in a specific IDE? Seems to me like Java projects made by a specific IDE will not be totally transparent to another IDE so it is imp开发者_运维知识库ortant to know beforehand which IDE the project was created with.

Regards.


Eclipse projects save out .project and .classpath

NetBeans saves out .nbproject

IntelliJ can use file-based .iws, .ipr and .iml or directory based .idea


If it is an eclipse project it will have a .project file in the root directory. If it is a netbeans project you will find a nbproject folder in the root directory.


If the project is using something like ant, maven, ivy (or other sort of build tool), then it'd be portable across IDEs. Most build tools come with plugins or commands to generate IDE specific metadata for the project. (mvn eclipse:eclipse, play eclipsify, sbt gen-idea...)

That said, IDE does not really matter - all you need is the source files, dependencies and the compiler at the end of the day.

However if you're checking out of a version control system (svn, git, et.al.), and if the things are done right you will not see any IDE specific files checked in.


You can easily check the extra configuration files created by the various IDEs. On eclipse, you will find a directory called .metadata at the root of the workspace (not root of the project). It will have a file called .log containing visible information like:

!SESSION 2011-03-31 17:24:25.570 -----------------------------------------------
eclipse.buildId=M20100909-0800
java.version=1.6.0_21
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=en_US
Command-line arguments:  -os win32 -ws win32 -arch x86_64

So you can easily see its eclipse. If that directory is not available (lets say not committed with the source code) you can still go to directories inside the project structure and find other meta data in files.

In my project there was a folder called .settings inside the actual project directory tree having files named: org.eclipse.jdt.core etc. By simply looking at this you can tell its Eclipse.

I am sure you will find similar clues when you look at a NetBeans project.

0

精彩评论

暂无评论...
验证码 换一张
取 消