2017-09-02 152 views
1

我不得不使用IntelliJ社区版并且想要编辑Javascript项目。我的IntelliJ项目创建在远离我的源代码的独立目录中。如何将Javascript项目添加到IntelliJ Community Edition

/dir1/IntelliJProjects/ThisIsMyIntelliJProjectDirectory/.idea 

我的项目结构是目前:

maven-proj1 (pom is at /dir1/maven-proj1/trunk/pom.xml) 
maven-proj2 (pom is at /dir1/maven-proj2/trunk/pom.xml) 
maven-proj3 (pom is at /dir1/maven-proj3-using-git/pom.xml) 

一些正在使用的代码保持在颠覆(SVN)和其他代码是饭桶。当显示项目结构对话框时,上述maven(java)项目使用受支持的“导入模块”导入,该对话框允许您指定maven pom.xml文件。

但我怎么能添加

/dir1/javascript-proj1 

以我现有的项目。

以下是我所知道的解决方法。 (1)创建一个项目并使用/ dir1作为项目​​的基础目录,那么它下面的所有东西都可用。

Cons: 
#1: When searching I find matches in the SVN branches and tags directory. 
#2: Navigating is deeper to get past the maven-proj1/trunk directory. 
#3: Probably others, but bottom line is I've tried this and don't like it. 

(2)创建一个假的pom.xml文件,并认为的IntelliJ这个目录是一个maven项目。

This is the route I'm likely to pursue. 
Cons: 
#1 I must create some otherwise unnecessary files in my Javascript project. 

(3)使用IntelliJ Ultimate版。在这种情况下,我不是一个选择。

如果有人知道其他解决方案,请让我知道。如果你相信我的上述解决方法之一是做到这一点的最佳方式,请让我知道,并且我会接受这个答案(当时很明显没有更好的选择)。

回答

1

我创建了一个pom.xml文件(像这样):

<project> 
    <packaging>pom</packaging> 
    <modelVersion>4.0.0</modelVersion> 
    <groupId>myGroup</groupId> 
    <artifactId>myArtifact</artifactId> 
    <version>1.0.0-SNAPSHOT</version> 
    <name>my-name</name> 
    <description>Fake POM so Javascript can be loaded into IntelliJ</description> 
</project> 

然后我可以选择,项目结构,点击加号,和浏览该目录添加为“模块”到我创建的pom.xml文件。

我还将node_modules目录标记为“排除”(但不确定这很重要)。

我怀疑我有答案,但要感谢那些认为回答我的问题的人。

相关问题