首页 > 其他分享 >maven-common

maven-common

时间:2023-02-24 23:23:56浏览次数:46  
标签:... Maven java src maven common main resources

Maven Common

Project Object Model

XML Schema

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
</project>

Basic Archetype

<!-- The Basics -->
<groupId>...</groupId>
<artifactId>...</artifactId>
<version>...</version>
<packaging>...</packaging>
<dependencies>...</dependencies>
<parent>...</parent>
<dependencyManagement>...</dependencyManagement>
<modules>...</modules>
<properties>...</properties>

<!-- Build Settings -->
<build>...</build>
<reporting>...</reporting>

<!-- More Project Information -->
<name>...</name>
<description>...</description>
<developers>...</developers>
<contributors>...</contributors>

<!-- Environment Settings -->
<prerequisites>...</prerequisites>
<repositories>...</repositories>
<pluginRepositories>...</pluginRepositories>
<distributionManagement>...</distributionManagement>
<profiles>...</profiles>

Java Version & Source Encoding

这篇文章讲述输入配置 Maven 项目的 Java 版本:https://www.baeldung.com/maven-java-version

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <maven.compiler.target>1.8</maven.compiler.target>
    <maven.compiler.source>1.8</maven.compiler.source>
</properties>

Resource Direction

Maven 默认只在 resource phase 将 maven 项目/src/main/resourcemaven 项目/src/test/resource 下的文件复制过滤到 target/classes 中,有时需要在 /src/main/java 中放置静态资源,但这些资源默认在 build 后不可访问,可以通过如下设置进行复制:

<build>
    <resources>
        <resource>
            <directory>src/main/resources</directory>
        </resource>
        <resource>
            <directory>src/main/java</directory>
            <excludes>
                <exclude>**/*.java</exclude>
            </excludes>
        </resource>
    </resources>
</build>
<build>
    <testResources>
        <testResource>
            <directory>src/main/resources</directory>
        </resource>
        <resource>
            <directory>src/main/java</directory>
            <excludes>
                <exclude>**/*.java</exclude>
            </excludes>
        </testResource>
    </testResource>
</build>

Maven Convention

Maven Standard Directory Layout

src/main/java Application/Library sources
src/main/resources Application/Library resources
src/main/filters Resource filter files
src/main/webapp Web application sources
src/test/java Test sources
src/test/resources Test resources
src/test/filters Test resource filter files
src/it Integration Tests (primarily for plugins)
src/assembly Assembly descriptors
src/site Site
LICENSE.txt Project's license
NOTICE.txt Notices and attributions required by libraries that the project depends on
README.txt Project's readme

具体描述见官网

标签:...,Maven,java,src,maven,common,main,resources
From: https://www.cnblogs.com/locustree/p/17153507.html

相关文章

  • 什么是maven
    1.什么是mavenMaven是一个项目管理工具,它包含了一个项目对象模型(POM:ProjectObjectModel),一组标准集合,一个项目生命周期(ProjectLifecycle),一个依赖管理系统(D......
  • Javaweb----Maven环境配置
    Maven环境配置maven的作用:写javaweb项目时,自动导入相应的java包。maven的环境变量配置2.1进入maven的官网下载maven:链接地址https://maven.apache.org/download.c......
  • maven
    maven常用打包命令:1、mvnclean将旧的class字节码文件删除。2、mvnpakage打包,动态web工程打war包,Java工程打jar包。3、mvninstall将项目生成jar包放在仓库中,然后......
  • 【笔记】IDEA中maven导入依赖提示证书错误解决方法
    先是提示:一定要备份配置文件!!! 一定要备份配置文件!!! 一定要备份配置文件!!!先说原因:idea内置了jre,与你开发用的jre不是同一个软件,你通过命令修改的是开发用的jre的证书库,导入m......
  • 基于jib-maven-plugin快速构建微服务docker镜像
    一、说明本文介绍基于Maven插件jib-maven-plugin实现快速构建SpringBoot程序镜像,并推送到远程仓库中,且无需安装Docker环境。Jib是Google开发的一个无需Do......
  • maven 打包,包名带时间戳
    1.情景展示使用maven插件,将maven项目进行打包时,如何令其名称后面追加时间戳?2.具体分析使用buildnumber-maven-plugin插件打包3.解决方案在pom.xml当中添加以下内容......
  • 2月23日javaweb之Maven
    Maven常用命令compile:编译clean:清理test:测试package:打包install:安装Maven生命周期Maven对项目构建的生命周期描述是一次构建过程经历了多少个时间。Maven对项目的......
  • 常用maven命令与配置
    注册本地jar包mvninstall:install-file-Dfile=D:\workspace\java\gitlab\mybatis-plus-extension\target\mybatis-plus-extension-3.3.1-o2m.jar-DgroupId=com.baomid......
  • Maven Nexus 上传/下载
    下载:方式一:maven配置pom<dependency><groupId>com.aaa</groupId><artifactId>aaa.webInvoice</artifactId><version>0.0.1-SNAPSHOT</version><type>......
  • 使用骨架创建maven的web工程、servlet实例之间指定web资源包、实例之导入项目依赖的ja
    使用骨架创建maven的web工程操作一样把勾进行勾选找到webapp选项下一步创建就行创建好会有显示目录结构其余的都需要自己手动补齐有小蓝点的才是一个web项目如果......