【发布时间】:2019-10-28 23:29:50
【问题描述】:
这是我在 Eclipse 中的示例 Maven 动态 Web 项目 (maven-archetype-webapp)。
哪些文件夹应从 git 中排除(即添加到 .gitignore)?
我曾经认为 Maven 中的目标文件夹意味着已编译的 .class 文件,并且永远不需要提交/推送 - 所以我想将整个 target/ 添加到 .gitignore - 因为我不'不想在 git repo 中使用 maven-fetched jars。但问题是它会忽略我的 index.jsp(以及要添加的其他 jsp/html 文件)和 web.xml !!!
除了目标文件夹包含 MyListener.java,而不是 MyListener.class!
并且目标文件夹不包含Student.java或Student.class(该类在MyListener.java中使用,Spring ClassPathXmlApplicationContext为Student student = (Student) context.getBean("student");)
附: Deployed Resources 文件夹的内容是这样的:
这个结构只有两个子目录:src 和 target。
目标目录用于存放构建的所有输出。
附: 我在 .gitignore 中添加了目标,项目被安全地克隆并构建在另一台机器上!所以 - 解决了!
【问题讨论】:
标签: eclipse git maven jakarta-ee gitignore