maven war plugin如何去掉不想打进去的包

2025-01-24 14:48:48
推荐回答(1个)
回答1:

war插件有个标签lt;packagingExcludes;意思是打包时不包含哪些文件,写具体的文件或目录,多个用逗号隔开。
例子:
lt;plugin;
lt;groupId;org.apache.maven.pluginslt;/groupId;
lt;artifactId;maven-war-pluginlt;/artifactId;
lt;version;2.2lt;/version;
lt;configuration;
lt;webappDirectory;WebContentlt;/webappDirectory;
lt;!-- 必须指定,否则默认会变成在target/war/work 导致被打包进war文件,指定后为target/work --;
lt;workDirectory;${project.build.directory}/worklt;/workDirectory;
lt;useCache;falselt;/useCache;
lt;packagingExcludes;WEB-INF/classes/**/*.*,WEB-INF/lib/**/*lt;/packagingExcludes;
lt;archive;
lt;addMavenDescriptor;truelt;/addMavenDescriptor;
lt;/archive;
lt;/configuration;
lt;/plugin;