alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Java example source code file (sample-04.xml)

This example Java source code file (sample-04.xml) is included in the alvinalexander.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Learn more about this Java project at its project page.

Java - Java tags/keywords

export-package, generate, license, netty, nio, private-package, project, see, test, the, this, udp, used, you

The sample-04.xml Java example source code

<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Copyright 2012 The Netty Project
  ~
  ~ The Netty Project licenses this file to you under the Apache License,
  ~ version 2.0 (the "License"); you may not use this file except in compliance
  ~ with the License. You may obtain a copy of the License at:
  ~
  ~   http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  ~ WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  ~ License for the specific language governing permissions and limitations
  ~ under the License.
  -->
<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/maven-v4_0_0.xsd">

  <modelVersion>4.0.0
  <parent>
    <groupId>org.sonatype.oss
    <artifactId>oss-parent
    <version>7
  </parent>

  <groupId>io.netty
  <artifactId>netty-parent
  <packaging>pom
  <version>4.0.14.Final-SNAPSHOT

  <name>Netty
  <url>http://netty.io/
  <description>
    Netty is an asynchronous event-driven network application framework for 
    rapid development of maintainable high performance protocol servers and
    clients.
  </description>

  <organization>
    <name>The Netty Project
    <url>http://netty.io/
  </organization>

  <licenses>
    <license>
      <name>Apache License, Version 2.0
      <url>http://www.apache.org/licenses/LICENSE-2.0
    </license>
  </licenses>
  <inceptionYear>2008

  <scm>
    <url>https://github.com/netty/netty
    <connection>scm:git:git://github.com/netty/netty.git
    <developerConnection>scm:git:ssh://git@github.com/netty/netty.git
    <tag>HEAD
  </scm>

  <developers>
    <developer>
      <id>netty.io
      <name>The Netty Project Contributors
      <email>netty@googlegroups.com
      <url>http://netty.io/
      <organization>The Netty Project
      <organizationUrl>http://netty.io/
    </developer>
  </developers>

  <properties>
    <project.build.sourceEncoding>UTF-8
    <project.reporting.outputEncoding>UTF-8
    <jboss.marshalling.version>1.3.18.GA
    <test.jvm.argLine>
      -server 
      -dsa -da -ea:io.netty...
      -XX:+AggressiveOpts
      -XX:+TieredCompilation
      -XX:+UseBiasedLocking
      -XX:+UseFastAccessorMethods
      -XX:+UseStringCache
      -XX:+OptimizeStringConcat
      -XX:+HeapDumpOnOutOfMemoryError
    </test.jvm.argLine>
  </properties>
 
  <modules>
    <module>common
    <module>buffer
    <module>codec
    <module>codec-http
    <module>codec-socks
    <module>transport
    <module>transport-rxtx
    <module>transport-sctp
    <module>transport-udt
    <module>handler
    <module>example
    <module>testsuite
    <module>microbench
    <module>all
    <module>tarball
  </modules>

  <dependencyManagement>
    <dependencies>
      <!-- Byte code generator - completely optional -->
      <dependency>
        <groupId>org.javassist
        <artifactId>javassist
        <version>3.18.0-GA
        <scope>compile
        <optional>true
      </dependency>

      <!-- JBoss Marshalling - completely optional -->
      <dependency>
        <groupId>org.jboss.marshalling
        <artifactId>jboss-marshalling
        <version>${jboss.marshalling.version}
        <scope>compile
        <optional>true
      </dependency>
    
      <dependency>
        <groupId>com.google.protobuf
        <artifactId>protobuf-java
        <version>2.5.0
      </dependency>
      <dependency>
        <groupId>com.jcraft
        <artifactId>jzlib
          <version>1.1.2
      </dependency>

      <dependency>
        <groupId>org.rxtx
        <artifactId>rxtx
        <version>2.1.7
      </dependency>

      <dependency>
        <groupId>com.barchart.udt
        <artifactId>barchart-udt-bundle
        <version>2.3.0
      </dependency>

      <dependency>
        <groupId>javax.servlet
        <artifactId>servlet-api
        <version>2.5
      </dependency>

      <dependency>
        <groupId>org.slf4j
        <artifactId>slf4j-api
        <version>1.7.5
      </dependency>
      <dependency>
        <groupId>commons-logging
        <artifactId>commons-logging
        <version>1.1.3
      </dependency>
      <dependency>
        <groupId>log4j
        <artifactId>log4j
        <version>1.2.17
        <exclusions>
          <exclusion>
            <artifactId>mail
            <groupId>javax.mail
          </exclusion>
          <exclusion>
            <artifactId>jms
            <groupId>javax.jms
          </exclusion>
          <exclusion>
            <artifactId>jmxtools
            <groupId>com.sun.jdmk
          </exclusion>
          <exclusion>
            <artifactId>jmxri
            <groupId>com.sun.jmx
          </exclusion>
        </exclusions>
        <optional>true
      </dependency>
      
      <!-- Metrics providers -->
      <dependency>
        <groupId>com.yammer.metrics
        <artifactId>metrics-core
        <version>2.2.0
      </dependency>
      
      <!-- Test dependencies for jboss marshalling encoder/decoder -->
      <dependency>
        <groupId>org.jboss.marshalling
        <artifactId>jboss-marshalling-serial
        <version>${jboss.marshalling.version}
        <scope>test
       </dependency>
      <dependency>
        <groupId>org.jboss.marshalling
        <artifactId>jboss-marshalling-river
        <version>${jboss.marshalling.version}
        <scope>test
      </dependency>

      <!-- Test dependencies for microbench -->
      <dependency>
        <groupId>com.google.caliper
        <artifactId>caliper
        <version>0.5-rc1
        <scope>test
      </dependency>
    </dependencies>
  </dependencyManagement>

  <dependencies>
    <!-- Enable Javassist support for all test runs -->
    <dependency>
      <groupId>org.javassist
      <artifactId>javassist
      <scope>test
    </dependency>

    <!-- Testing frameworks and related dependencies -->
    <dependency>
      <groupId>junit
      <artifactId>junit
      <version>4.11
      <scope>test
    </dependency>
    <dependency>
      <groupId>org.easymock
      <artifactId>easymock
      <version>3.2
      <scope>test
    </dependency>
    <dependency>
      <groupId>org.easymock
      <artifactId>easymockclassextension
      <version>3.2
      <scope>test
    </dependency>
    <dependency>
      <groupId>org.jmock
      <artifactId>jmock-junit4
      <version>2.6.0
      <scope>test
    </dependency>
    <dependency>
      <groupId>ch.qos.logback
      <artifactId>logback-classic
      <version>1.0.13
      <scope>test
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <artifactId>maven-enforcer-plugin
        <version>1.3
        <executions>
          <execution>
            <id>enforce-tools
            <goals>
              <goal>enforce
            </goals>
            <configuration>
              <rules>
                <requireJavaVersion>
                  <!-- Enforce java 1.7 as minimum for compiling -->
                  <!-- This is needed because of java.util.zip.Deflater and NIO UDP multicast-->
                  <version>[1.7.0,)
                </requireJavaVersion>
                <requireMavenVersion>
                  <version>[3.0.5,3.1)
                </requireMavenVersion>
              </rules>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-compiler-plugin
        <version>3.1
        <configuration>
          <compilerVersion>1.7
          <fork>true
          <source>1.6
          <target>1.6
          <debug>true
          <optimize>true
          <showDeprecation>true
          <showWarnings>true
          <compilerArgument>-Xlint:-options
          <!-- XXX: maven-release-plugin complains - MRELEASE-715 -->
          <!--
          <compilerArguments>
            <Xlint:-options />
            <Xlint:unchecked />
            <Xlint:deprecation />
          </compilerArguments>
          -->
          <meminitial>256m
          <maxmem>1024m
        </configuration>
      </plugin>
      <plugin>
        <!-- ensure that only methods available in java 1.6 can
             be used even when compiling with java 1.7+ -->
        <groupId>org.codehaus.mojo
        <artifactId>animal-sniffer-maven-plugin
        <version>1.9
        <configuration>
          <signature>
            <groupId>org.codehaus.mojo.signature
            <artifactId>java16
            <version>1.0
          </signature>
          <ignores>
            <ignore>sun.misc.Unsafe
            <ignore>sun.misc.Cleaner

            <ignore>java.util.zip.Deflater

            <!-- Used for NIO UDP multicast -->
            <ignore>java.nio.channels.DatagramChannel
            <ignore>java.nio.channels.MembershipKey
            <ignore>java.net.StandardProtocolFamily

            <!-- Used for NIO. 2 -->
            <ignore>java.nio.channels.AsynchronousChannel
            <ignore>java.nio.channels.AsynchronousSocketChannel
            <ignore>java.nio.channels.AsynchronousServerSocketChannel
            <ignore>java.nio.channels.AsynchronousChannelGroup
            <ignore>java.nio.channels.NetworkChannel
            <ignore>java.nio.channels.InterruptedByTimeoutException
            <ignore>java.net.StandardSocketOptions
            <ignore>java.net.SocketOption
          </ignores>
        </configuration>
        <executions>
          <execution>
            <phase>process-classes
            <goals>
              <goal>check
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-checkstyle-plugin
        <version>2.10
        <executions>
          <execution>
            <id>check-style
            <goals>
              <goal>check
            </goals>
            <phase>validate
            <configuration>
              <consoleOutput>true
              <logViolationsToConsole>true
              <failsOnError>true
              <failOnViolation>true
              <configLocation>io/netty/checkstyle.xml
              <includeTestSourceDirectory>true
            </configuration>
          </execution>
        </executions>
        <dependencies>
          <dependency>
            <groupId>${project.groupId}
            <artifactId>netty-build
            <version>19
          </dependency>
        </dependencies>
      </plugin>
      <plugin>
        <artifactId>maven-surefire-plugin
        <configuration>
          <includes>
             <include>**/*Test*.java
             <include>**/*Benchmark*.java
          </includes>
          <excludes>
            <exclude>**/Abstract*
            <exclude>**/TestUtil*
          </excludes>
          <runOrder>random
          <argLine>${test.jvm.argLine}
        </configuration>
      </plugin>
      <!-- always produce osgi bundles -->
      <plugin>
        <groupId>org.apache.felix
        <artifactId>maven-bundle-plugin
        <version>2.4.0
        <executions>
          <execution>
            <id>generate-manifest
            <phase>process-classes
            <goals>
              <goal>manifest
            </goals>
            <configuration>
              <instructions>
                <Export-Package>${project.groupId}.*
                <!-- enforce JVM vendor package as optional -->
                <Import-Package>sun.misc.*;resolution:=optional,*
                <!-- override "internal" private package convention -->
                <Private-Package>!*
              </instructions>
            </configuration>
          </execution>
        </executions>
      </plugin>             
      <plugin>
        <artifactId>maven-source-plugin
        <version>2.2.1
        <executions>
          <!--
            ~ This workaround prevents Maven from executing the 'generate-sources' phase twice.
            ~ See http://jira.codehaus.org/browse/MSOURCES-13
            ~ and http://blog.peterlynch.ca/2010/05/maven-how-to-prevent-generate-sources.html
            -->
          <execution>
            <id>attach-sources
            <phase>invalid
            <goals>
              <goal>jar
            </goals>
          </execution>
          <execution>
            <id>attach-sources-no-fork
            <phase>package
            <goals>
              <goal>jar-no-fork
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-javadoc-plugin
        <version>2.9.1
        <configuration>
          <detectOfflineLinks>false
          <breakiterator>true
          <version>false
          <author>false
          <keywords>true
        </configuration>
      </plugin>
      <plugin>
        <artifactId>maven-deploy-plugin
        <version>2.7
        <configuration>
          <retryFailedDeploymentCount>10
        </configuration>
      </plugin>
      <plugin>
        <artifactId>maven-release-plugin
        <version>2.4.1
        <configuration>
          <useReleaseProfile>false
          <arguments>-P release,sonatype-oss-release,full,no-osgi
          <autoVersionSubmodules>true
          <allowTimestampedSnapshots>false
          <tagNameFormat>netty-@{project.version}
        </configuration>
      </plugin>

      <!-- Ensure to put maven-antrun-plugin at the end of the plugin list
           so that they are run lastly in the same phase. -->
      <plugin>
        <artifactId>maven-antrun-plugin
        <executions>
          <!-- Generate the version properties for all artifacts. -->
          <execution>
            <id>write-version-properties
            <phase>initialize
            <goals>
              <goal>run
            </goals>
            <configuration>
              <target>
                <taskdef resource="net/sf/antcontrib/antlib.xml" />

                <!-- Get the information about the latest commit -->
                <exec executable="git" outputproperty="gitOutput.shortCommitHash" resultproperty="gitExitCode.shortCommitHash" failonerror="false" failifexecutionfails="false">
                  <arg value="log" />
                  <arg value="-1" />
                  <arg value="--format=format:%h" />
                </exec>
                <if>
                  <equals arg2="0" arg1="${gitExitCode.shortCommitHash}" />
                  <then>
                    <property name="shortCommitHash" value="${gitOutput.shortCommitHash}" />
                  </then>
                  <else>
                    <property name="shortCommitHash" value="0" />
                  </else>
                </if>

                <exec executable="git" outputproperty="gitOutput.longCommitHash" resultproperty="gitExitCode.longCommitHash" failonerror="false" failifexecutionfails="false">
                  <arg value="log" />
                  <arg value="-1" />
                  <arg value="--format=format:%H" />
                </exec>
                <if>
                  <equals arg2="0" arg1="${gitExitCode.longCommitHash}" />
                  <then>
                    <property name="longCommitHash" value="${gitOutput.longCommitHash}" />
                  </then>
                  <else>
                    <property name="longCommitHash" value="0000000000000000000000000000000000000000" />
                  </else>
                </if>

                <exec executable="git" outputproperty="gitOutput.commitDate" resultproperty="gitExitCode.commitDate" failonerror="false" failifexecutionfails="false">
                  <arg value="log" />
                  <arg value="-1" />
                  <arg value="--format=format:%cd" />
                  <arg value="--date=iso" />
                </exec>
                <if>
                  <equals arg2="0" arg1="${gitExitCode.commitDate}" />
                  <then>
                    <property name="commitDate" value="${gitOutput.commitDate}" />
                  </then>
                  <else>
                    <property name="commitDate" value="1970-01-01 00:00:00 +0000" />
                  </else>
                </if>

                <exec executable="git" outputproperty="gitOutput.repoStatus" resultproperty="gitExitCode.repoStatus" failonerror="false" failifexecutionfails="false">
                  <arg value="status" />
                  <arg value="--porcelain" />
                </exec>
                <if>
                  <equals arg2="0" arg1="${gitExitCode.repoStatus}" />
                  <then>
                    <if>
                      <equals arg2="" arg1="${gitOutput.repoStatus}" />
                      <then>
                        <property name="repoStatus" value="clean" />
                      </then>
                      <else>
                        <property name="repoStatus" value="dirty" />
                      </else>
                    </if>
                  </then>
                  <else>
                    <property name="repoStatus" value="unknown" />
                  </else>
                </if>

                <!-- Print the obtained commit information. -->
                <echo>Current commit: ${shortCommitHash} on ${commitDate}

                <!-- Generate the .properties file. -->
                <!--
                <property name="metaInfDir" value="${project.basedir}/src/main/resources/META-INF" />
                -->
                <property name="metaInfDir" value="${project.build.outputDirectory}/META-INF" />
                <property name="versionPropFile" value="${metaInfDir}/${project.groupId}.versions.properties" />
                <mkdir dir="${metaInfDir}" />
                <delete file="${versionPropFile}" quiet="true" />

                <propertyfile file="${versionPropFile}" comment="Generated by netty-parent/pom.xml">
                  <entry key="${project.artifactId}.version" value="${project.version}" />
                  <entry key="${project.artifactId}.buildDate" type="date" value="now" pattern="yyyy-MM-dd HH:mm:ss Z" />
                  <entry key="${project.artifactId}.commitDate" value="${commitDate}" />
                  <entry key="${project.artifactId}.shortCommitHash" value="${shortCommitHash}" />
                  <entry key="${project.artifactId}.longCommitHash" value="${longCommitHash}" />
                  <entry key="${project.artifactId}.repoStatus" value="${repoStatus}" />
                </propertyfile>
              </target>
            </configuration>
          </execution>
        </executions>
        <dependencies>
          <dependency>
            <groupId>org.apache.ant
            <artifactId>ant
            <version>1.8.2
          </dependency>
          <dependency>
            <groupId>org.apache.ant
            <artifactId>ant-launcher
            <version>1.8.2
          </dependency>
          <dependency>
            <groupId>ant-contrib
            <artifactId>ant-contrib
            <version>1.0b3
            <exclusions>
              <exclusion>
                <groupId>ant
                <artifactId>ant
              </exclusion>
            </exclusions>
          </dependency>
        </dependencies>
      </plugin>
    </plugins>

    <pluginManagement>
      <plugins>
        <!-- keep surefire and failsafe in sync -->
        <plugin>
          <artifactId>maven-surefire-plugin
          <version>2.15
        </plugin>
        <!-- keep surefire and failsafe in sync -->
        <plugin>
          <artifactId>maven-failsafe-plugin
          <version>2.15
        </plugin>
        <plugin>
          <artifactId>maven-clean-plugin
          <version>2.5
        </plugin>
        <plugin>
          <artifactId>maven-resources-plugin
          <version>2.6
        </plugin>
        <plugin>
          <artifactId>maven-jar-plugin
          <version>2.4
          <executions>
            <execution>
              <id>default-jar
              <configuration>
                <archive>
                  <manifest>
                    <addDefaultImplementationEntries>true
                  </manifest>
                  <index>true
                  <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF
                </archive>
              </configuration>
            </execution>
          </executions>
        </plugin>
        <plugin>
          <artifactId>maven-dependency-plugin
          <version>2.8
        </plugin>
        <plugin>
          <artifactId>maven-assembly-plugin
          <version>2.4
        </plugin>
        <plugin>
          <!-- Do NOT upgrade -->
          <artifactId>maven-jxr-plugin
          <version>2.2
        </plugin>
        <plugin>
          <artifactId>maven-antrun-plugin
          <version>1.7
          <dependencies>
            <dependency>
              <groupId>ant-contrib
              <artifactId>ant-contrib
              <version>1.0b3
              <exclusions>
                <exclusion>
                  <groupId>ant
                  <artifactId>ant
                </exclusion>
              </exclusions>
            </dependency>
          </dependencies>
        </plugin>
        <plugin>
          <groupId>org.codehaus.mojo
          <artifactId>build-helper-maven-plugin
          <version>1.8
        </plugin>               

        <!-- Workaround for the 'M2E plugin execution not covered' problem.
             See: http://wiki.eclipse.org/M2E_plugin_execution_not_covered -->
        <plugin>
          <groupId>org.eclipse.m2e
          <artifactId>lifecycle-mapping
          <version>1.0.0
          <configuration>
            <lifecycleMappingMetadata>
              <pluginExecutions>
                <pluginExecution>
                  <pluginExecutionFilter>
                    <groupId>org.apache.maven.plugins
                    <artifactId>maven-antrun-plugin
                    <versionRange>[1.7,)
                    <goals>
                      <goal>run
                    </goals>
                  </pluginExecutionFilter>
                  <action>
                    <ignore />
                  </action>
                </pluginExecution>
                <pluginExecution>
                  <pluginExecutionFilter>
                    <groupId>org.apache.maven.plugins
                    <artifactId>maven-checkstyle-plugin
                    <versionRange>[1.0,)
                    <goals>
                      <goal>check
                    </goals>
                  </pluginExecutionFilter>
                  <action>
                    <execute>
                      <runOnIncremental>false
                    </execute>
                  </action>
                </pluginExecution>
                <pluginExecution>
                  <pluginExecutionFilter>
                    <groupId>org.apache.maven.plugins
                    <artifactId>maven-enforcer-plugin
                    <versionRange>[1.0,)
                    <goals>
                      <goal>enforce
                    </goals>
                  </pluginExecutionFilter>
                  <action>
                    <execute>
                      <runOnIncremental>false
                    </execute>
                  </action>
                </pluginExecution>
                <pluginExecution>
                  <pluginExecutionFilter>
                    <groupId>org.apache.maven.plugins
                    <artifactId>maven-clean-plugin
                    <versionRange>[1.0,)
                    <goals>
                      <goal>clean
                    </goals>
                  </pluginExecutionFilter>
                  <action>
                    <execute>
                      <runOnIncremental>false
                    </execute>
                  </action>
                </pluginExecution>
                <pluginExecution>
                  <pluginExecutionFilter>
                    <groupId>org.apache.felix
                    <artifactId>maven-bundle-plugin
                    <versionRange>[2.4,)
                    <goals>
                      <goal>manifest
                    </goals>
                  </pluginExecutionFilter>
                  <action>
                    <ignore />
                  </action>
                </pluginExecution>
              </pluginExecutions>
            </lifecycleMappingMetadata>
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>
</project>

Other Java examples (source code examples)

Here is a short list of links related to this Java sample-04.xml source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.