Maven相關知識

1,創建Maven 項目 html

    a,新建Spring template project spring

b,選擇 spring mvc apache

2,向Maven的本地倉庫添加jar包 (http://maven.apache.org/plugins/maven-install-plugin/examples/specific-local-repo.html mvc

    A,在doc app

mvn install:install-file  -Dfile=path-to-your-artifact-jar maven

                          -DgroupId=your.groupId this

                          -DartifactId=your-artifactId spa

                          -Dversion=version code

                          -Dpackaging=jar xml

                          -DlocalRepositoryPath=path-to-specific-local-repo

 

Shell中

        mvn install:install-file  -Dfile=path-to-your-artifact-jar \
                          -DgroupId=your.groupId \
                          -DartifactId=your-artifactId \
                          -Dversion=version \
                          -Dpackaging=jar \
                          -DlocalRepositoryPath=path-to-specific-local-repo

 

   B,在pom.xml中的Dependencies中配置選項並選擇階段
    

3Maven項目獲取resources下面的文件內容


A, 類加載

InputStream is = this.getClass().getResourceAsStream("/META-INF/app.properties");

或者

InputStream is = this.getClass().getClassLoader().getResourceAsStream("META-INF/app.properties");

 

B, FileInputStream

 

new FileInputStream(System.getProperty("user.dir")+"\\src\\main\\resources\\META-INF\\app.properties");

相關文章
相關標籤/搜索