ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

pom.xml标签学习

2022-09-04 14:01:47  阅读:242  来源: 互联网

标签:xml project 标签 commons jboss pom apache org Final


java项目之pom.xml

以ysoserial的pom.xml为例分析

<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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    //project描述这个项目,xmlns命名空间,xmlns:xsi ——是指xml文件遵守xml规范,xsi全名:xml schema instance,是指具体用到的schema资源文件里定义的元素所准守的规范。xsi:schemaLocation——是指,本文档里的xml元素所遵守的规范,schemaLocation 属性用来引用(schema)模式文档,解析器可以在需要的情况下使用这个文档对 XML 实例文档进行校验。它的值(URI)是成对出现的,第一个值表示命名空间,第二个值则表示描述该命名空间的模式文档的具体位置,两个值之间以空格分隔。
   <modelVersion>4.0.0</modelVersion>//项目版本

   <groupId>ysoserial</groupId>///GroupID 是项目组织唯一的标识符,实际对应JAVA的包的结构,是main目录里java的目录结构。
   <artifactId>ysoserial</artifactId>//ArtifactID是项目的唯一的标识符,实际对应项目的名称,就是项目根目录的名称。
   <version>0.0.6-SNAPSHOT</version>//版本
   <packaging>jar</packaging>//打包方式

   <name>ysoserial</name>//项目名称
   <url>https://github.com/frohoff/ysoserial/</url>//地址

    <properties>//配置文件<name>value</name>
      <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>//源代码使用utf-8编码
   </properties>

   <build>//描述biuld所需的plugins
      <plugins>
         <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.5.1</version>
            <configuration>
               <!-- maximize compatibility -->
               <source>1.6</source>
               <target>1.6</target>
               <!-- ignore noisy internal api warnings -->
                    <compilerArgument>-XDignore.symbol.file</compilerArgument>
                    <fork>true</fork>
                </configuration>
         </plugin>
         <plugin>
            <artifactId>maven-assembly-plugin</artifactId>
            <configuration>
               <finalName>${project.artifactId}-${project.version}-all</finalName>//编译打包之后的文件名格式
               <appendAssemblyId>false</appendAssemblyId>//Set to false to exclude the assembly id from the assembly final name, and to create the resultant assembly artifacts without classifier. As such, an assembly artifact having the same format as the packaging of the current Maven project will replace the file for this main project artifact.暂不理解
               <archive>//归档构建器的说明
                  <manifest>//清单文件
                     <mainClass>ysoserial.GeneratePayload</mainClass>
                  </manifest>
               </archive>
                    <descriptor>assembly.xml</descriptor>//描述文件
                </configuration>
            <executions>//executions:plugin也有很多个目标,每个目标具有不同的配置,executions就是设定plugin的目标。
               <execution>
                  <id>make-assembly</id>//The identifier of this execution for labelling the goals during the build, and for matching exections to merge during inheritance.
                  <phase>package</phase>
                  <goals>
                     <goal>single</goal>
                  </goals>
               </execution>
            </executions>
         </plugin>
         <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-surefire-plugin</artifactId>
                <version>3.0.0-M1</version>
              <configuration>
                 <trimStackTrace>false</trimStackTrace>
                 <systemPropertyVariables>
                    <java.rmi.server.useCodebaseOnly>false</java.rmi.server.useCodebaseOnly>
                 </systemPropertyVariables>
              </configuration>
          </plugin>
      </plugins>
   </build>

   <repositories>//The lists of the remote repositories for discovering dependencies and extensions.
      <repository>
         <id>jenkins</id>
         <layout>default</layout>
         <url>https://repo.jenkins-ci.org/public/</url>
      </repository>
   </repositories>

   <dependencies>//This element describes all of the dependencies associated with a project. These dependencies are used to construct a classpath for your project during the build process. They are automatically downloaded from the repositories defined in this project.

      <!-- testing depedencies -->

      <dependency>
         <groupId>junit</groupId>
         <artifactId>junit</artifactId>
         <version>4.12</version>
         <scope>test</scope>
      </dependency>
      <dependency>
         <groupId>org.mockito</groupId>
         <artifactId>mockito-core</artifactId>
         <version>1.10.19</version>
         <scope>test</scope>
      </dependency>
      <dependency>
         <groupId>com.github.stefanbirkner</groupId>
         <artifactId>system-rules</artifactId>
         <version>1.8.0</version>
         <scope>test</scope>//应用范围
      </dependency>
      <dependency>
         <groupId>org.nanohttpd</groupId>
         <artifactId>nanohttpd</artifactId>
         <version>2.2.0</version>
         <scope>test</scope>
      </dependency>


      <!-- non-gadget dependencies -->

      <dependency>
         <groupId>org.reflections</groupId>
         <artifactId>reflections</artifactId>
         <version>0.9.9</version>
      </dependency>
      <dependency>
         <groupId>org.jboss.shrinkwrap.resolver</groupId>
         <artifactId>shrinkwrap-resolver-depchain</artifactId>
         <version>2.2.6</version>
         <type>pom</type>
      </dependency>
      <dependency>
         <groupId>org.javassist</groupId>
         <artifactId>javassist</artifactId>
         <version>3.19.0-GA</version>
      </dependency>
      <dependency>
         <groupId>com.nqzero</groupId>
         <artifactId>permit-reflect</artifactId>
         <version>0.3</version>
      </dependency>
      <dependency>
         <groupId>commons-codec</groupId>
         <artifactId>commons-codec</artifactId>
         <version>1.9</version>
      </dependency>
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>2.6</version>
        </dependency>
      <dependency>
         <artifactId>remoting</artifactId>
         <groupId>org.jenkins-ci.main</groupId>
         <version>2.55</version>
      </dependency>
      <dependency>
         <groupId>org.jboss.logging</groupId>
         <artifactId>jboss-logging</artifactId>
         <version>3.3.0.Final</version>
      </dependency>
      <dependency>
         <groupId>org.jboss.remoting</groupId>
         <artifactId>jboss-remoting</artifactId>
         <version>4.0.19.Final</version>
      </dependency>
      <dependency>
         <groupId>org.jboss</groupId>
         <artifactId>jboss-common-core</artifactId>
         <version>2.5.0.Final</version>
         <exclusions>
            <exclusion>
               <groupId>org.jboss.logging</groupId>
               <artifactId>jboss-logging-spi</artifactId>
            </exclusion>
         </exclusions>
      </dependency>
      <dependency>
         <groupId>org.jboss.xnio</groupId>
         <artifactId>xnio-nio</artifactId>
         <version>3.3.4.Final</version>
      </dependency>
      <dependency>
         <groupId>org.jboss.sasl</groupId>
         <artifactId>jboss-sasl</artifactId>
         <version>1.0.5.Final</version>
      </dependency>
      <dependency>
         <groupId>org.jboss.remotingjmx</groupId>
         <artifactId>remoting-jmx</artifactId>
         <version>2.0.1.Final</version>
      </dependency>

      <!-- gadget dependecies -->

      <dependency>
         <groupId>commons-collections</groupId>
         <artifactId>commons-collections</artifactId>
         <version>3.1</version>
      </dependency>
      <dependency>
         <groupId>org.beanshell</groupId>
         <artifactId>bsh</artifactId>
         <version>2.0b5</version>
      </dependency>
      <dependency>
         <groupId>commons-beanutils</groupId>
         <artifactId>commons-beanutils</artifactId>
         <version>1.9.2</version>
      </dependency>
      <dependency>
         <groupId>org.apache.commons</groupId>
         <artifactId>commons-collections4</artifactId>
         <version>4.0</version>
      </dependency>
      <dependency>
         <groupId>org.codehaus.groovy</groupId>
         <artifactId>groovy</artifactId>
         <version>2.3.9</version>
      </dependency>
      <dependency>
         <groupId>org.springframework</groupId>
         <artifactId>spring-core</artifactId>
         <version>4.1.4.RELEASE</version>
      </dependency>
      <dependency>
         <groupId>org.springframework</groupId>
         <artifactId>spring-beans</artifactId>
         <version>4.1.4.RELEASE</version>
      </dependency>
      <dependency>
         <groupId>org.hibernate</groupId>
         <artifactId>hibernate-core</artifactId>
         <version>4.3.11.Final</version>
      </dependency>
      <dependency>
         <groupId>org.springframework</groupId>
         <artifactId>spring-aop</artifactId>
         <version>4.1.4.RELEASE</version>
      </dependency>
      <dependency>
         <groupId>net.sf.json-lib</groupId>
         <artifactId>json-lib</artifactId>
         <classifier>jdk15</classifier>
         <version>2.4</version>
      </dependency>
      <dependency>
         <groupId>commons-fileupload</groupId>
         <artifactId>commons-fileupload</artifactId>
         <version>1.3</version>
      </dependency>
        <dependency>
         <groupId>org.apache.wicket</groupId>
         <artifactId>wicket-util</artifactId>
         <version>6.23.0</version>
      </dependency>
      <dependency>
         <groupId>com.mchange</groupId>
         <artifactId>c3p0</artifactId>
         <version>0.9.5.2</version>
      </dependency>
      <dependency>
         <groupId>javax.servlet</groupId>
         <artifactId>javax.servlet-api</artifactId>
         <version>3.1.0</version>
      </dependency>
      <dependency>
         <groupId>org.apache.myfaces.core</groupId>
         <artifactId>myfaces-impl</artifactId>
         <version>2.2.9</version>
      </dependency>
      <dependency>
         <groupId>xalan</groupId>
         <artifactId>xalan</artifactId>
         <version>2.7.2</version>
      </dependency>
      <dependency>
         <groupId>rome</groupId>
         <artifactId>rome</artifactId>
         <version>1.0</version>
      </dependency>
        <dependency>
            <groupId>org.python</groupId>
            <artifactId>jython-standalone</artifactId>
            <version>2.5.2</version>
        </dependency>
      <dependency>
         <groupId>rhino</groupId>
         <artifactId>js</artifactId>
         <version>1.7R2</version>
      </dependency>
      <dependency>
      <groupId>javassist</groupId>
      <artifactId>javassist</artifactId>
      <version>3.12.0.GA</version>
      </dependency>
      <dependency>
         <groupId>org.jboss.weld</groupId>
         <artifactId>weld-core</artifactId>
         <version>1.1.33.Final</version>
      </dependency>
      <dependency>
         <groupId>org.jboss.interceptor</groupId>
         <artifactId>jboss-interceptor-core</artifactId>
         <version>2.0.0.Final</version>
      </dependency>
      <dependency>
         <groupId>org.jboss.interceptor</groupId>
         <artifactId>jboss-interceptor-spi</artifactId>
         <version>2.0.0.Final</version>
      </dependency>
      <dependency>
         <groupId>javax.enterprise</groupId>
         <artifactId>cdi-api</artifactId>
         <version>1.0-SP1</version>
      </dependency>
      <dependency>
         <groupId>javax.interceptor</groupId>
         <artifactId>javax.interceptor-api</artifactId>
         <version>3.1</version>
      </dependency>
      <dependency>
         <groupId>org.slf4j</groupId>
         <artifactId>slf4j-api</artifactId>
         <version>1.7.21</version>
      </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-jdk14</artifactId>
            <version>1.7.21</version>
        </dependency>
      <dependency>
         <groupId>org.clojure</groupId>
         <artifactId>clojure</artifactId>
         <version>1.8.0</version>
      </dependency>
      <dependency>
         <groupId>com.vaadin</groupId>
         <artifactId>vaadin-server</artifactId>
         <version>7.7.14</version>
      </dependency>
        <dependency>
            <groupId>org.aspectj</groupId>
            <artifactId>aspectjweaver</artifactId>
            <version>1.9.5</version>
        </dependency>
        <dependency>
            <groupId>org.apache.click</groupId>
            <artifactId>click-nodeps</artifactId>
            <version>2.3.0</version>
        </dependency>
   </dependencies>

   <profiles>// A listing of project-local build profiles which will modify the build process when activated.用于区分测试包和发行包,并配置不同的环境
        <profile>
            <id>jdk6</id>
            <activation>
                <jdk>1.6</jdk>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <version>2.22.1</version>
                    </plugin>
                </plugins>
            </build>
            <dependencies>
                <dependency>
                    <groupId>javax.el</groupId>
                    <artifactId>javax.el-api</artifactId>
                    <version>3.0.0</version>
                </dependency>
            </dependencies>
            <!-- workaround for non-overlapping TLS versions in JDK6 and central repo
             https://central.sonatype.org/articles/2018/May/04/discontinued-support-for-tlsv11-and-below/ -->
            <repositories>
                <repository>
                    <id>repo1</id>
                    <url>http://repo1.maven.org/maven2</url><!-- intentionally http (see above) -->
                </repository>
            </repositories>
            <pluginRepositories>
                <pluginRepository>
                    <id>repo1</id>
                    <url>http://repo1.maven.org/maven2</url><!-- intentionally http (see above) -->
                </pluginRepository>
            </pluginRepositories>
        </profile>

      <profile>
         <id>hibernate5</id>
         <activation>
            <property>
               <name>hibernate5</name>
            </property>
         </activation>
         <dependencies>
            <dependency>
               <groupId>org.hibernate</groupId>
               <artifactId>hibernate-core</artifactId>
               <version>5.0.7.Final</version>
            </dependency>
                <dependency>
                    <groupId>javax.el</groupId>
                    <artifactId>javax.el-api</artifactId>
                    <version>3.0.0</version>
                </dependency>
         </dependencies>
      </profile>

      <profile>
         <id>apache-el</id>
         <activation>
            <activeByDefault>true</activeByDefault>
            <property>
               <name>el</name>
               <value>apache</value>
            </property>
         </activation>
         <dependencies>
            <dependency>
               <groupId>org.mortbay.jasper</groupId>
               <artifactId>apache-el</artifactId>
               <version>8.0.27</version>
            </dependency>
         </dependencies>
      </profile>

      <profile>
         <id>juel</id>
         <activation>
            <property>
               <name>el</name>
               <value>juel</value>
            </property>
         </activation>
         <dependencies>
            <dependency>
               <groupId>de.odysseus.juel</groupId>
               <artifactId>juel-impl</artifactId>
               <version>2.2.7</version>
            </dependency>
            <dependency>
               <groupId>de.odysseus.juel</groupId>
               <artifactId>juel-api</artifactId>
               <version>2.2.7</version>
            </dependency>
         </dependencies>
      </profile>

   </profiles>
    <distributionManagement>//Distribution information for a project that enables deployment of the site and artifacts to remote web servers and repositories respectively.告知我们项目发布地址
        <repository>
            <id>github</id>
            <name>GitHub Packages</name>
            <url>https://maven.pkg.github.com/frohoff/ysoserial</url>
        </repository>
    </distributionManagement>  
</project>

注释中解释的一知半解,pom配置需要长时间的项目开发经验的积累,由于笔者仅仅用于java安全测试,所以无法知其全貌,IDEA中出现对标签的概括,可以进行学习。

标签:xml,project,标签,commons,jboss,pom,apache,org,Final
来源: https://www.cnblogs.com/Sovohost-43/p/16654974.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有