Exclude dependency in maven

We can exclude dependency in maven by using the exclusion element.

<project>
  ...
  <dependencies>
    <dependency>
      <groupId>test.ProjectTest1</groupId>
      <artifactId>Project-Test1</artifactId>
      <version>1.0</version>
      <scope>compile</scope>
      <exclusions>
        //Declare the exclusion here
        <exclusion> 
          <groupId>test.ProjectTest2</groupId>
          <artifactId>Project-Test2</artifactId>
        </exclusion>
      </exclusions> 
    </dependency>
  </dependencies>
</project>