JAVA-49: Removed module maven-all, to be replaced with maven-modules
This commit is contained in:
parent
e036a1adeb
commit
d1244f8330
|
@ -1,8 +0,0 @@
|
|||
## Apache Maven
|
||||
|
||||
This module contains articles about Apache Maven. Please refer to its submodules.
|
||||
|
||||
### Relevant Articles
|
||||
|
||||
- [Apache Maven Tutorial](https://www.baeldung.com/maven)
|
||||
- [Find Unused Maven Dependencies](https://www.baeldung.com/maven-unused-dependencies)
|
|
@ -1,3 +0,0 @@
|
|||
### Relevant Articles
|
||||
|
||||
- [Maven Compiler Plugin](https://www.baeldung.com/maven-compiler-plugin)
|
|
@ -1,30 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<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">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.baeldung</groupId>
|
||||
<artifactId>compiler-plugin-java-9</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>${compiler.plugin.version}</version>
|
||||
<configuration>
|
||||
<source>${source.version}</source>
|
||||
<target>${target.version}</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<properties>
|
||||
<compiler.plugin.version>3.8.0</compiler.plugin.version>
|
||||
<source.version>9</source.version>
|
||||
<target.version>9</target.version>
|
||||
</properties>
|
||||
|
||||
</project>
|
|
@ -1,9 +0,0 @@
|
|||
package com.baeldung.maven.java9;
|
||||
|
||||
import static javax.xml.XMLConstants.XML_NS_PREFIX;
|
||||
|
||||
public class MavenCompilerPlugin {
|
||||
public static void main(String[] args) {
|
||||
System.out.println("The XML namespace prefix is: " + XML_NS_PREFIX);
|
||||
}
|
||||
}
|
|
@ -1,3 +0,0 @@
|
|||
module com.baeldung.maven.java9 {
|
||||
requires java.xml;
|
||||
}
|
|
@ -1,3 +0,0 @@
|
|||
### Relevant Articles:
|
||||
|
||||
- [How to Create a Maven Plugin](https://www.baeldung.com/maven-plugin)
|
|
@ -1,80 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<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</modelVersion>
|
||||
<groupId>com.baeldung</groupId>
|
||||
<artifactId>counter-maven-plugin</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<name>counter-maven-plugin Maven Mojo</name>
|
||||
<packaging>maven-plugin</packaging>
|
||||
<url>http://maven.apache.org</url>
|
||||
|
||||
<organization>
|
||||
<name>Baeldung</name>
|
||||
<url>https://www.baeldung.com/</url>
|
||||
</organization>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-plugin-api</artifactId>
|
||||
<version>${maven-plugin-api.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.plugin-tools</groupId>
|
||||
<artifactId>maven-plugin-annotations</artifactId>
|
||||
<version>${maven-plugin-annotations.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-project</artifactId>
|
||||
<version>${maven-project.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<pluginManagement>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-plugin-plugin</artifactId>
|
||||
<version>${maven-plugin-plugin.version}</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-site-plugin</artifactId>
|
||||
<version>${maven-site-plugin.version}</version>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</pluginManagement>
|
||||
</build>
|
||||
|
||||
<reporting>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-plugin-plugin</artifactId>
|
||||
<reportSets>
|
||||
<reportSet>
|
||||
<reports>
|
||||
<report>report</report>
|
||||
</reports>
|
||||
</reportSet>
|
||||
</reportSets>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</reporting>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.target>1.8</maven.compiler.target>
|
||||
<maven.compiler.source>1.8</maven.compiler.source>
|
||||
<maven-plugin-api.version>3.6.2</maven-plugin-api.version>
|
||||
<maven-plugin-annotations.version>3.6.0</maven-plugin-annotations.version>
|
||||
<maven-project.version>2.2.1</maven-project.version>
|
||||
<maven-plugin-plugin.version>3.6.0</maven-plugin-plugin.version>
|
||||
<maven-site-plugin.version>3.8.2</maven-site-plugin.version>
|
||||
</properties>
|
||||
|
||||
</project>
|
|
@ -1,45 +0,0 @@
|
|||
package com.baeldung.maven.plugin.validator;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.maven.model.Dependency;
|
||||
import org.apache.maven.plugin.AbstractMojo;
|
||||
import org.apache.maven.plugin.MojoExecutionException;
|
||||
import org.apache.maven.plugin.MojoFailureException;
|
||||
import org.apache.maven.plugins.annotations.LifecyclePhase;
|
||||
import org.apache.maven.plugins.annotations.Mojo;
|
||||
import org.apache.maven.plugins.annotations.Parameter;
|
||||
import org.apache.maven.project.MavenProject;
|
||||
|
||||
/**
|
||||
* Counts the number of maven dependencies of a project.
|
||||
*
|
||||
* It can be filtered by scope.
|
||||
*
|
||||
*/
|
||||
@Mojo(name = "dependency-counter", defaultPhase = LifecyclePhase.COMPILE)
|
||||
public class DependencyCounterMojo extends AbstractMojo {
|
||||
|
||||
/**
|
||||
* Scope to filter the dependencies.
|
||||
*/
|
||||
@Parameter(property = "scope")
|
||||
String scope;
|
||||
|
||||
/**
|
||||
* Gives access to the Maven project information.
|
||||
*/
|
||||
@Parameter(defaultValue = "${project}", required = true, readonly = true)
|
||||
MavenProject project;
|
||||
|
||||
public void execute() throws MojoExecutionException, MojoFailureException {
|
||||
List<Dependency> dependencies = project.getDependencies();
|
||||
|
||||
long numDependencies = dependencies.stream()
|
||||
.filter(d -> (scope == null || scope.isEmpty()) || scope.equals(d.getScope()))
|
||||
.count();
|
||||
|
||||
getLog().info("Number of dependencies: " + numDependencies);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,51 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<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">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.baeldung</groupId>
|
||||
<artifactId>example</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
<version>${commons.lang3.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>${junit.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>com.baeldung</groupId>
|
||||
<artifactId>counter-maven-plugin</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>dependency-counter</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<scope>test</scope>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<properties>
|
||||
<commons.lang3.version>3.9</commons.lang3.version>
|
||||
<junit.version>4.12</junit.version>
|
||||
</properties>
|
||||
|
||||
</project>
|
|
@ -1,47 +0,0 @@
|
|||
<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">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.baeldung</groupId>
|
||||
<artifactId>maven-unused-dependencies</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
|
||||
<properties>
|
||||
<commons-collections.version>3.2.2</commons-collections.version>
|
||||
<slf4j-api.version>1.7.25</slf4j-api.version>
|
||||
<maven-dependency-plugin.version>3.1.2</maven-dependency-plugin.version>
|
||||
<maven-compiler-plugin.version>3.1</maven-compiler-plugin.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>commons-collections</groupId>
|
||||
<artifactId>commons-collections</artifactId>
|
||||
<version>${commons-collections.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
<version>${slf4j-api.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>${maven-compiler-plugin.version}</version>
|
||||
<configuration>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<version>${maven-dependency-plugin.version}</version>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
|
@ -1,17 +0,0 @@
|
|||
package com.baeldung.mavendependencyplugin;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class UnusedDependenciesExample {
|
||||
|
||||
/**
|
||||
* When the Maven dependency analyzer analyzes the code, it will see that the slf4j dependency is being used in this method.
|
||||
*
|
||||
* @return the slf4j {@link Logger}.
|
||||
*/
|
||||
public Logger getLogger() {
|
||||
return LoggerFactory.getLogger(UnusedDependenciesExample.class);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
## Maven WAR Plugin
|
||||
|
||||
This module contains articles about the Maven WAR Plugin.
|
||||
|
||||
### Relevant Articles
|
||||
|
||||
- [Eclipse Error: web.xml is missing and failOnMissingWebXml is set to true](https://www.baeldung.com/eclipse-error-web-xml-missing)
|
|
@ -1,32 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<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">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.baeldung</groupId>
|
||||
<artifactId>maven-war-plugin</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<name>maven-war-plugin</name>
|
||||
<packaging>war</packaging>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-war-plugin</artifactId>
|
||||
<!-- Update maven war plugin to 3.1.0 or higher -->
|
||||
<version>${war.plugin.version}</version>
|
||||
<configuration>
|
||||
<!-- Set failOnMissingWebXml configuration for maven war plugin -->
|
||||
<failOnMissingWebXml>false</failOnMissingWebXml>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<!-- Set failOnMissingWebXml as false in properties section -->
|
||||
<properties>
|
||||
<failOnMissingWebXml>false</failOnMissingWebXml>
|
||||
<war.plugin.version>3.1.0</war.plugin.version>
|
||||
</properties>
|
||||
|
||||
</project>
|
|
@ -1,2 +0,0 @@
|
|||
/output-resources
|
||||
/.idea/
|
|
@ -1,18 +0,0 @@
|
|||
## Apache Maven
|
||||
|
||||
This module contains articles about core Apache Maven. Articles about other Maven plugins (such as the Maven WAR Plugin)
|
||||
have their own dedicated modules.
|
||||
|
||||
### Relevant Articles
|
||||
|
||||
- [Guide to the Core Maven Plugins](https://www.baeldung.com/core-maven-plugins)
|
||||
- [Maven Resources Plugin](https://www.baeldung.com/maven-resources-plugin)
|
||||
- [Quick Guide to the Maven Surefire Plugin](https://www.baeldung.com/maven-surefire-plugin)
|
||||
- [The Maven Failsafe Plugin](https://www.baeldung.com/maven-failsafe-plugin)
|
||||
- [The Maven Verifier Plugin](https://www.baeldung.com/maven-verifier-plugin)
|
||||
- [The Maven Clean Plugin](https://www.baeldung.com/maven-clean-plugin)
|
||||
- [Build a Jar with Maven and Ignore the Test Results](https://www.baeldung.com/maven-ignore-test-results)
|
||||
- [Maven Project with Multiple Source Directories](https://www.baeldung.com/maven-project-multiple-src-directories)
|
||||
- [Integration Testing with Maven](https://www.baeldung.com/maven-integration-test)
|
||||
- [Apache Maven Standard Directory Layout](https://www.baeldung.com/maven-directory-structure)
|
||||
- [Multi-Module Project with Maven](https://www.baeldung.com/maven-multi-module)
|
|
@ -1,68 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<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">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>custom-rule</artifactId>
|
||||
<name>custom-rule</name>
|
||||
|
||||
<parent>
|
||||
<groupId>com.baeldung</groupId>
|
||||
<artifactId>maven</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
<!-- dependencies for maven plugin-->
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.enforcer</groupId>
|
||||
<artifactId>enforcer-api</artifactId>
|
||||
<version>${api.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-project</artifactId>
|
||||
<version>${maven.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-core</artifactId>
|
||||
<version>${maven.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-artifact</artifactId>
|
||||
<version>${maven.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-plugin-api</artifactId>
|
||||
<version>${maven.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.plexus</groupId>
|
||||
<artifactId>plexus-container-default</artifactId>
|
||||
<version>${plexus-container-default.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-verifier-plugin</artifactId>
|
||||
<version>${maven.verifier.version}</version>
|
||||
<configuration>
|
||||
<verificationFile>../input-resources/verifications.xml</verificationFile>
|
||||
<failOnError>false</failOnError>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<properties>
|
||||
<api.version>3.0.0-M2</api.version>
|
||||
<maven.version>2.0.9</maven.version>
|
||||
<plexus-container-default.version>1.0-alpha-9</plexus-container-default.version>
|
||||
</properties>
|
||||
|
||||
</project>
|
|
@ -1,43 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2019 PloyRef
|
||||
* Created by Seun Matt <smatt382@gmail.com>
|
||||
* on 19 - 2 - 2019
|
||||
*/
|
||||
|
||||
package com.baeldung.enforcer;
|
||||
|
||||
import org.apache.maven.enforcer.rule.api.EnforcerRule;
|
||||
import org.apache.maven.enforcer.rule.api.EnforcerRuleException;
|
||||
import org.apache.maven.enforcer.rule.api.EnforcerRuleHelper;
|
||||
import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluationException;
|
||||
|
||||
public class MyCustomRule implements EnforcerRule {
|
||||
|
||||
public void execute(EnforcerRuleHelper enforcerRuleHelper) throws EnforcerRuleException {
|
||||
|
||||
try {
|
||||
|
||||
String groupId = (String) enforcerRuleHelper.evaluate("${project.groupId}");
|
||||
|
||||
if (groupId == null || !groupId.startsWith("com.baeldung")) {
|
||||
throw new EnforcerRuleException("Project group id does not start with com.baeldung");
|
||||
}
|
||||
|
||||
}
|
||||
catch (ExpressionEvaluationException ex ) {
|
||||
throw new EnforcerRuleException( "Unable to lookup an expression " + ex.getLocalizedMessage(), ex );
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isCacheable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isResultValid(EnforcerRule enforcerRule) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public String getCacheId() {
|
||||
return null;
|
||||
}
|
||||
}
|
Binary file not shown.
Before Width: | Height: | Size: 4.2 KiB |
|
@ -1 +0,0 @@
|
|||
Welcome to ${resources.name}!
|
|
@ -1,9 +0,0 @@
|
|||
<verifications xmlns="http://maven.apache.org/verifications/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/verifications/1.0.0 http://maven.apache.org/xsd/verifications-1.0.0.xsd">
|
||||
<files>
|
||||
<file>
|
||||
<location>input-resources/baeldung.txt</location>
|
||||
<contains>Welcome</contains>
|
||||
</file>
|
||||
</files>
|
||||
</verifications>
|
|
@ -1,3 +0,0 @@
|
|||
### Relevant Articles
|
||||
|
||||
- [Maven Enforcer Plugin](https://www.baeldung.com/maven-enforcer-plugin)
|
|
@ -1,75 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<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">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>maven-enforcer</artifactId>
|
||||
<name>maven-enforcer</name>
|
||||
|
||||
<parent>
|
||||
<groupId>com.baeldung</groupId>
|
||||
<artifactId>maven</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-enforcer-plugin</artifactId>
|
||||
<version>3.0.0-M2</version>
|
||||
<!--<dependencies>-->
|
||||
<!--<dependency>-->
|
||||
<!--<groupId>com.baeldung</groupId>-->
|
||||
<!--<artifactId>custom-rule</artifactId>-->
|
||||
<!--<version>1.0</version>-->
|
||||
<!--</dependency>-->
|
||||
<!--</dependencies>-->
|
||||
<executions>
|
||||
<execution>
|
||||
<id>enforce</id>
|
||||
<goals>
|
||||
<goal>enforce</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<rules>
|
||||
<banDuplicatePomDependencyVersions/>
|
||||
<requireMavenVersion>
|
||||
<version>3.0</version>
|
||||
<message>Invalid Maven version. It should, at least, be 3.0</message>
|
||||
</requireMavenVersion>
|
||||
<requireJavaVersion>
|
||||
<version>1.8</version>
|
||||
</requireJavaVersion>
|
||||
<requireEnvironmentVariable>
|
||||
<variableName>ui</variableName>
|
||||
<level>WARN</level>
|
||||
</requireEnvironmentVariable>
|
||||
<requireEnvironmentVariable>
|
||||
<variableName>cook</variableName>
|
||||
<level>WARN</level>
|
||||
</requireEnvironmentVariable>
|
||||
<requireActiveProfile>
|
||||
<profiles>local,base</profiles>
|
||||
<message>Missing active profiles</message>
|
||||
<level>WARN</level>
|
||||
</requireActiveProfile>
|
||||
<!--other rules -->
|
||||
<!--<myCustomRule implementation="com.baeldung.enforcer.MyCustomRule"/>-->
|
||||
</rules>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-verifier-plugin</artifactId>
|
||||
<version>${maven.verifier.version}</version>
|
||||
<configuration>
|
||||
<verificationFile>../input-resources/verifications.xml</verificationFile>
|
||||
<failOnError>false</failOnError>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
|
@ -1,314 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<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">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>maven</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<name>maven</name>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<parent>
|
||||
<groupId>com.baeldung</groupId>
|
||||
<artifactId>parent-modules</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
|
||||
<modules>
|
||||
<module>custom-rule</module>
|
||||
<module>maven-enforcer</module>
|
||||
</modules>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.glassfish.jersey.containers</groupId>
|
||||
<artifactId>jersey-container-servlet-core</artifactId>
|
||||
<version>${jersey.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.glassfish.jersey.inject</groupId>
|
||||
<artifactId>jersey-hk2</artifactId>
|
||||
<version>${jersey.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>${junit.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-maven-plugin</artifactId>
|
||||
<version>${jetty.version}</version>
|
||||
<configuration>
|
||||
<httpConnector>
|
||||
<port>8999</port>
|
||||
</httpConnector>
|
||||
<stopKey>quit</stopKey>
|
||||
<stopPort>9000</stopPort>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>start-jetty</id>
|
||||
<phase>pre-integration-test</phase>
|
||||
<goals>
|
||||
<goal>start</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>stop-jetty</id>
|
||||
<phase>post-integration-test</phase>
|
||||
<goals>
|
||||
<goal>stop</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
<version>${maven.resources.version}</version>
|
||||
<configuration>
|
||||
<outputDirectory>output-resources</outputDirectory>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>input-resources</directory>
|
||||
<excludes>
|
||||
<exclude>*.png</exclude>
|
||||
</excludes>
|
||||
<filtering>true</filtering>
|
||||
</resource>
|
||||
</resources>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>${maven.compiler.version}</version>
|
||||
<configuration>
|
||||
<source>${java.version}</source>
|
||||
<target>${java.version}</target>
|
||||
<compilerArgs>
|
||||
<arg>-Xlint:unchecked</arg>
|
||||
</compilerArgs>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>${maven.surefire.version}</version>
|
||||
<configuration>
|
||||
<excludes>
|
||||
<exclude>DataTest.java</exclude>
|
||||
<exclude>**/*IntegrationTest</exclude>
|
||||
</excludes>
|
||||
<excludedGroups>com.baeldung.maven.it.Integration</excludedGroups>
|
||||
<includes>
|
||||
<include>TestFail.java</include>
|
||||
<include>DataCheck.java</include>
|
||||
</includes>
|
||||
<testFailureIgnore>true</testFailureIgnore>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-failsafe-plugin</artifactId>
|
||||
<version>${maven.failsafe.version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>integration-test</goal>
|
||||
<goal>verify</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<!-- configuration similar to surefire -->
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-verifier-plugin</artifactId>
|
||||
<version>${maven.verifier.version}</version>
|
||||
<configuration>
|
||||
<verificationFile>input-resources/verifications.xml</verificationFile>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>verify</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-clean-plugin</artifactId>
|
||||
<version>${maven.clean.version}</version>
|
||||
<configuration>
|
||||
<filesets>
|
||||
<fileset>
|
||||
<directory>output-resources</directory>
|
||||
</fileset>
|
||||
</filesets>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>build-helper-maven-plugin</artifactId>
|
||||
<version>${maven.build.helper.version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>generate-sources</phase>
|
||||
<goals>
|
||||
<goal>add-source</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<sources>
|
||||
<source>src/main/another-src</source>
|
||||
</sources>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>add-integration-test-source</id>
|
||||
<phase>generate-test-sources</phase>
|
||||
<goals>
|
||||
<goal>add-test-source</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<sources>
|
||||
<source>src/integration-test/java</source>
|
||||
</sources>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>add-integration-test-resource</id>
|
||||
<phase>generate-test-resources</phase>
|
||||
<goals>
|
||||
<goal>add-test-resource</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/integration-test/resources</directory>
|
||||
</resource>
|
||||
</resources>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>default</id>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>${maven.surefire.version}</version>
|
||||
<configuration>
|
||||
<excludes>
|
||||
<exclude>DataTest.java</exclude>
|
||||
</excludes>
|
||||
<includes>
|
||||
<include>TestFail.java</include>
|
||||
<include>DataCheck.java</include>
|
||||
</includes>
|
||||
<testFailureIgnore>true</testFailureIgnore>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>failsafe</id>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-failsafe-plugin</artifactId>
|
||||
<version>${maven.failsafe.version}</version>
|
||||
<configuration>
|
||||
<includes>
|
||||
<include>**/*RestIT</include>
|
||||
<include>**/RestITCase</include>
|
||||
</includes>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>integration-test</goal>
|
||||
<goal>verify</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>surefire</id>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>${maven.surefire.version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>integration-test</phase>
|
||||
<goals>
|
||||
<goal>test</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<excludes>
|
||||
<exclude>none</exclude>
|
||||
</excludes>
|
||||
<includes>
|
||||
<include>**/*IntegrationTest</include>
|
||||
</includes>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>category</id>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-failsafe-plugin</artifactId>
|
||||
<version>${maven.failsafe.version}</version>
|
||||
<configuration>
|
||||
<includes>
|
||||
<include>**/*</include>
|
||||
</includes>
|
||||
<groups>com.baeldung.maven.it.Integration</groups>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>integration-test</goal>
|
||||
<goal>verify</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
<properties>
|
||||
<maven.resources.version>3.0.2</maven.resources.version>
|
||||
<maven.compiler.version>3.8.0</maven.compiler.version>
|
||||
<maven.surefire.version>2.22.0</maven.surefire.version>
|
||||
<maven.failsafe.version>2.22.0</maven.failsafe.version>
|
||||
<maven.verifier.version>1.1</maven.verifier.version>
|
||||
<maven.clean.version>3.0.0</maven.clean.version>
|
||||
<maven.build.helper.version>3.0.0</maven.build.helper.version>
|
||||
<jetty.version>9.4.11.v20180605</jetty.version>
|
||||
<jersey.version>2.27</jersey.version>
|
||||
</properties>
|
||||
|
||||
</project>
|
|
@ -1,3 +0,0 @@
|
|||
### Relevant Articles:
|
||||
|
||||
- [Using Maven Behind a Proxy](https://www.baeldung.com/maven-behind-proxy)
|
|
@ -1,43 +0,0 @@
|
|||
<!-- start of settings.xml here -->
|
||||
|
||||
<!--
|
||||
Proxies section (extract of settings.xml) containing example proxy definitions:
|
||||
* BaeldungProxy_Encrypted - an example http proxy with an encrypted password - encrypted using 'mvn --encrypt-password'
|
||||
* BaeldungProxy_Authenticated - an example http proxy with a plain text password.
|
||||
* BaeldungProxy - an example minimalist unauthenticated http proxy
|
||||
All of these are 'active' - so maven will use the first one in the list.
|
||||
-->
|
||||
<proxies>
|
||||
|
||||
<proxy>
|
||||
<id>BaeldungProxy_Encrypted</id>
|
||||
<active>true</active>
|
||||
<protocol>http</protocol>
|
||||
<host>proxy.baeldung.com</host>
|
||||
<port>80</port>
|
||||
<username>baeldung</username>
|
||||
<password>{U2iMf+7aJXQHRquuQq6MX+n7GOeh97zB9/4e7kkEQYs=}</password>
|
||||
<nonProxyHosts>internal.baeldung.com|localhost|127.*|[::1]</nonProxyHosts>
|
||||
</proxy>
|
||||
|
||||
<proxy>
|
||||
<id>BaeldungProxy_Authenticated</id>
|
||||
<active>true</active>
|
||||
<protocol>http</protocol>
|
||||
<host>proxy.baeldung.com</host>
|
||||
<port>80</port>
|
||||
<username>baeldung</username>
|
||||
<password>changeme</password>
|
||||
<nonProxyHosts>internal.baeldung.com|localhost|127.*|[::1]</nonProxyHosts>
|
||||
</proxy>
|
||||
|
||||
<proxy>
|
||||
<id>BaeldungProxy</id>
|
||||
<host>proxy.baeldung.com</host>
|
||||
<port>80</port>
|
||||
<nonProxyHosts>internal.baeldung.com|localhost|127.*|[::1]</nonProxyHosts>
|
||||
</proxy>
|
||||
|
||||
</proxies>
|
||||
|
||||
<!-- rest of settings.xml here -->
|
|
@ -1,6 +0,0 @@
|
|||
<!--
|
||||
Redirect maven to settings-security.xml stored elsewhere:
|
||||
-->
|
||||
<settingsSecurity>
|
||||
<relocation>R:\config\settings-security.xml</relocation>
|
||||
</settingsSecurity>
|
|
@ -1,7 +0,0 @@
|
|||
<!--
|
||||
Encrypt master password with:
|
||||
mvn --encrypt-master-password
|
||||
-->
|
||||
<settingsSecurity>
|
||||
<master>{QFMlh/6WjF8H9po9UD\}0Nv18e527jqWb6mUgIB798n4=}</master>
|
||||
</settingsSecurity>
|
|
@ -1,24 +0,0 @@
|
|||
package com.baeldung.maven.it;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.util.Scanner;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
public class RestITCase {
|
||||
@Test
|
||||
public void whenSendingGet_thenMessageIsReturned() throws IOException {
|
||||
String url = "http://localhost:8999";
|
||||
URLConnection connection = new URL(url).openConnection();
|
||||
try (InputStream response = connection.getInputStream();
|
||||
Scanner scanner = new Scanner(response)) {
|
||||
String responseBody = scanner.nextLine();
|
||||
assertEquals("Welcome to Baeldung!", responseBody);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
package com.baeldung.maven.plugins;
|
||||
|
||||
public class Foo {
|
||||
|
||||
public static String foo() {
|
||||
return "foo";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
package com.baeldung.maven.it;
|
||||
|
||||
import org.glassfish.jersey.server.ResourceConfig;
|
||||
|
||||
public class EndpointConfig extends ResourceConfig {
|
||||
public EndpointConfig() {
|
||||
register(RestEndpoint.class);
|
||||
}
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
package com.baeldung.maven.it;
|
||||
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.Path;
|
||||
|
||||
@Path("/")
|
||||
public class RestEndpoint {
|
||||
@GET
|
||||
public String hello() {
|
||||
return "Welcome to Baeldung!";
|
||||
}
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
package com.baeldung.maven.plugins;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class Data {
|
||||
List<String> textList = new ArrayList();
|
||||
|
||||
public void addText(String text) {
|
||||
textList.add(text);
|
||||
}
|
||||
|
||||
public List getTextList() {
|
||||
return this.textList;
|
||||
}
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
package com.baeldung.maven.plugins;
|
||||
|
||||
public class MultipleSrcFolders {
|
||||
|
||||
public static void callFoo() {
|
||||
Foo.foo();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration>
|
||||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
|
||||
</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<root level="INFO">
|
||||
<appender-ref ref="STDOUT" />
|
||||
</root>
|
||||
</configuration>
|
|
@ -1,17 +0,0 @@
|
|||
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
|
||||
version="3.1">
|
||||
<servlet>
|
||||
<servlet-name>rest-servlet</servlet-name>
|
||||
<servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>
|
||||
<init-param>
|
||||
<param-name>javax.ws.rs.Application</param-name>
|
||||
<param-value>com.baeldung.maven.it.EndpointConfig</param-value>
|
||||
</init-param>
|
||||
</servlet>
|
||||
<servlet-mapping>
|
||||
<servlet-name>rest-servlet</servlet-name>
|
||||
<url-pattern>/*</url-pattern>
|
||||
</servlet-mapping>
|
||||
</web-app>
|
|
@ -1,4 +0,0 @@
|
|||
package com.baeldung.maven.it;
|
||||
|
||||
public interface Integration {
|
||||
}
|
|
@ -1,24 +0,0 @@
|
|||
package com.baeldung.maven.it;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.util.Scanner;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
public class RestIT {
|
||||
@Test
|
||||
public void whenSendingGet_thenMessageIsReturned() throws IOException {
|
||||
String url = "http://localhost:8999";
|
||||
URLConnection connection = new URL(url).openConnection();
|
||||
try (InputStream response = connection.getInputStream();
|
||||
Scanner scanner = new Scanner(response)) {
|
||||
String responseBody = scanner.nextLine();
|
||||
assertEquals("Welcome to Baeldung!", responseBody);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,24 +0,0 @@
|
|||
package com.baeldung.maven.it;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.util.Scanner;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
public class RestIntegrationTest {
|
||||
@Test
|
||||
public void whenSendingGet_thenMessageIsReturned() throws IOException {
|
||||
String url = "http://localhost:8999";
|
||||
URLConnection connection = new URL(url).openConnection();
|
||||
try (InputStream response = connection.getInputStream();
|
||||
Scanner scanner = new Scanner(response)) {
|
||||
String responseBody = scanner.nextLine();
|
||||
assertEquals("Welcome to Baeldung!", responseBody);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,26 +0,0 @@
|
|||
package com.baeldung.maven.it;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.experimental.categories.Category;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.util.Scanner;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
@Category(Integration.class)
|
||||
public class RestJUnitTest {
|
||||
@Test
|
||||
public void whenSendingGet_thenMessageIsReturned() throws IOException {
|
||||
String url = "http://localhost:8999";
|
||||
URLConnection connection = new URL(url).openConnection();
|
||||
try (InputStream response = connection.getInputStream();
|
||||
Scanner scanner = new Scanner(response)) {
|
||||
String responseBody = scanner.nextLine();
|
||||
assertEquals("Welcome to Baeldung!", responseBody);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,15 +0,0 @@
|
|||
package com.baeldung.maven.plugins;
|
||||
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import com.baeldung.maven.plugins.Data;
|
||||
|
||||
public class DataCheck {
|
||||
@Test
|
||||
public void whenDataObjectIsCreated_thenItIsNotNull() {
|
||||
Data data = new Data();
|
||||
assertNotNull(data);
|
||||
}
|
||||
}
|
|
@ -1,15 +0,0 @@
|
|||
package com.baeldung.maven.plugins;
|
||||
|
||||
import static org.junit.Assert.assertNull;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import com.baeldung.maven.plugins.Data;
|
||||
|
||||
public class DataUnitTest {
|
||||
@Test
|
||||
public void whenDataObjectIsNotCreated_thenItIsNull() {
|
||||
Data data = null;
|
||||
assertNull(data);
|
||||
}
|
||||
}
|
|
@ -1,18 +0,0 @@
|
|||
package testfail;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.Ignore;
|
||||
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
|
||||
public class TestFail {
|
||||
|
||||
@Ignore //ignored so the entire tutorials build passes
|
||||
@Test
|
||||
public void whenMessageAssigned_thenItIsNotNull() {
|
||||
String message = "hello there";
|
||||
message = null;
|
||||
assertNotNull(message);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,25 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<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">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>maven-all</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<name>maven-all</name>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<parent>
|
||||
<groupId>com.baeldung</groupId>
|
||||
<artifactId>parent-modules</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<modules>
|
||||
<!-- <module>compiler-plugin-java-9</module> --> <!-- We haven't upgraded to java 9. -->
|
||||
<module>maven</module>
|
||||
<module>maven-custom-plugin/counter-maven-plugin</module>
|
||||
<module>maven-war-plugin</module>
|
||||
<module>profiles</module>
|
||||
<module>versions-maven-plugin</module>
|
||||
</modules>
|
||||
|
||||
</project>
|
|
@ -1,7 +0,0 @@
|
|||
## Maven Profiles
|
||||
|
||||
This module contains articles about Maven profiles.
|
||||
|
||||
### Relevant Articles
|
||||
|
||||
- [Guide to Maven Profiles](https://www.baeldung.com/maven-profiles)
|
|
@ -1,94 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<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">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.baeldung</groupId>
|
||||
<artifactId>profiles</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<name>profiles</name>
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>no-tests</id>
|
||||
<properties>
|
||||
<maven.test.skip>true</maven.test.skip>
|
||||
</properties>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>integration-tests</id>
|
||||
<activation>
|
||||
<activeByDefault>true</activeByDefault>
|
||||
</activation>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>mutation-tests</id>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>active-on-jdk-11</id>
|
||||
<activation>
|
||||
<jdk>11</jdk>
|
||||
</activation>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>active-on-windows-10</id>
|
||||
<activation>
|
||||
<os>
|
||||
<name>windows 10</name>
|
||||
<family>Windows</family>
|
||||
<arch>amd64</arch>
|
||||
<version>10.0</version>
|
||||
</os>
|
||||
</activation>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>active-on-property-environment</id>
|
||||
<activation>
|
||||
<property>
|
||||
<name>environment</name>
|
||||
<value>!test</value>
|
||||
</property>
|
||||
</activation>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>active-on-missing-file</id>
|
||||
<activation>
|
||||
<file>
|
||||
<missing>target/testreport.html</missing>
|
||||
</file>
|
||||
</activation>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>active-on-present-file</id>
|
||||
<activation>
|
||||
<file>
|
||||
<exists>target/artifact.jar</exists>
|
||||
</file>
|
||||
</activation>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-help-plugin</artifactId>
|
||||
<version>${help.plugin.version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>show-profiles</id>
|
||||
<phase>compile</phase>
|
||||
<goals>
|
||||
<goal>active-profiles</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<properties>
|
||||
<help.plugin.version>3.2.0</help.plugin.version>
|
||||
</properties>
|
||||
|
||||
</project>
|
|
@ -1,7 +0,0 @@
|
|||
## Versions Maven Plugin
|
||||
|
||||
This module contains articles about the Versions Maven Plugin.
|
||||
|
||||
### Relevant Articles
|
||||
|
||||
- [Use the Latest Version of a Dependency in Maven](https://www.baeldung.com/maven-dependency-latest-version)
|
|
@ -1,82 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<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">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.baeldung</groupId>
|
||||
<artifactId>original</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>commons-io</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
<version>${commons-io.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-collections4</artifactId>
|
||||
<version>${commons-collections4.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
<version>${commons-lang3.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-compress</artifactId>
|
||||
<version>${commons-compress-version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>commons-beanutils</groupId>
|
||||
<artifactId>commons-beanutils</artifactId>
|
||||
<version>${commons-beanutils.version}</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>versions-maven-plugin</artifactId>
|
||||
<version>${versions.plugin.version}</version>
|
||||
<configuration>
|
||||
<excludes>
|
||||
<exclude>org.apache.commons:commons-collections4</exclude>
|
||||
</excludes>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>apache.snapshots</id>
|
||||
<name>Apache Development Snapshot Repository</name>
|
||||
<url>https://repository.apache.org/content/repositories/snapshots/</url>
|
||||
<releases>
|
||||
<enabled>false</enabled>
|
||||
</releases>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<properties>
|
||||
<commons-compress-version>1.15</commons-compress-version>
|
||||
<commons-io.version>2.3</commons-io.version>
|
||||
<commons-collections4.version>4.0</commons-collections4.version>
|
||||
<commons-lang3.version>3.0</commons-lang3.version>
|
||||
<commons-beanutils.version>1.9.1</commons-beanutils.version>
|
||||
<versions.plugin.version>2.7</versions.plugin.version>
|
||||
</properties>
|
||||
|
||||
</project>
|
|
@ -1,81 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<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">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.baeldung</groupId>
|
||||
<artifactId>versions-maven-plugin</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<name>versions-maven-plugin</name>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>commons-io</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
<version>${commons.io.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-collections4</artifactId>
|
||||
<version>${commons.collections4.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
<version>${commons.lang3.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-compress</artifactId>
|
||||
<version>${commons-compress-version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>commons-beanutils</groupId>
|
||||
<artifactId>commons-beanutils</artifactId>
|
||||
<version>${commons.beanutils.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>versions-maven-plugin</artifactId>
|
||||
<version>${versions.plugin.version}</version>
|
||||
<configuration>
|
||||
<excludes>
|
||||
<exclude>org.apache.commons:commons-collections4</exclude>
|
||||
</excludes>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>apache.snapshots</id>
|
||||
<name>Apache Development Snapshot Repository</name>
|
||||
<url>https://repository.apache.org/content/repositories/snapshots/</url>
|
||||
<releases>
|
||||
<enabled>false</enabled>
|
||||
</releases>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<properties>
|
||||
<commons-compress-version>1.15</commons-compress-version>
|
||||
<commons.io.version>2.3</commons.io.version>
|
||||
<versions.plugin.version>2.7</versions.plugin.version>
|
||||
<commons.beanutils.version>1.9.1</commons.beanutils.version>
|
||||
<commons.lang3.version>3.0</commons.lang3.version>
|
||||
<commons.collections4.version>4.0</commons.collections4.version>
|
||||
</properties>
|
||||
|
||||
</project>
|
|
@ -1,74 +0,0 @@
|
|||
#!/bin/bash
|
||||
#function to display commands
|
||||
exe() { echo -e "\$ $@\n" ; "$@" ; }
|
||||
|
||||
TEXT_COLOR='\033[1;33m' #Yellow
|
||||
NO_COLOR='\033[0m' # No Color
|
||||
|
||||
clear
|
||||
|
||||
echo -e "======================================================================================"
|
||||
echo -e " Showcase for the BAELDUNG tutorial \"Use the latest version of a dependency in Maven\""
|
||||
echo -e " Author: Andrea Ligios"
|
||||
echo -e "======================================================================================"
|
||||
|
||||
echo -e "${TEXT_COLOR}\n--------------------------------------------------------------------------------------"
|
||||
echo -e " Resetting the demo environment (which will be altered during the run): "
|
||||
echo -e "--------------------------------------------------------------------------------------${NO_COLOR}"
|
||||
rm -f pom.xml.versionsBackup
|
||||
cp original/pom.xml pom.xml
|
||||
ls -lt pom.*
|
||||
echo -e "${TEXT_COLOR}\n--------------------------------------------------------------------------------------"
|
||||
echo -e " Checking for newer versions of the Maven dependencies:"
|
||||
echo -e "--------------------------------------------------------------------------------------${NO_COLOR}"
|
||||
exe mvn versions:display-dependency-updates
|
||||
echo
|
||||
read -p "Press enter to continue"
|
||||
|
||||
echo -e "${TEXT_COLOR}\n--------------------------------------------------------------------------------------"
|
||||
echo -e " Updating SNAPSHOT dependencies to their RELEASE version, if any:"
|
||||
echo -e "--------------------------------------------------------------------------------------${NO_COLOR}"
|
||||
exe mvn versions:use-releases
|
||||
echo -e "${TEXT_COLOR}\n--------------------------------------------------------------------------------------"
|
||||
echo -e " A backup has been created automatically:"
|
||||
echo -e "--------------------------------------------------------------------------------------${NO_COLOR}"
|
||||
ls -lt pom.*
|
||||
echo
|
||||
read -p "Press enter to continue"
|
||||
|
||||
echo -e "${TEXT_COLOR}\n--------------------------------------------------------------------------------------"
|
||||
echo -e " Updating RELEASE dependencies to their *next* RELEASE version:"
|
||||
echo -e "--------------------------------------------------------------------------------------${NO_COLOR}"
|
||||
exe mvn versions:use-next-releases
|
||||
echo
|
||||
read -p "Press enter to continue"
|
||||
|
||||
echo -e "${TEXT_COLOR}\n--------------------------------------------------------------------------------------"
|
||||
echo -e " Reverting every modification made since the beginning:"
|
||||
echo -e "--------------------------------------------------------------------------------------${NO_COLOR}"
|
||||
exe mvn versions:revert
|
||||
echo -e "${TEXT_COLOR}\n--------------------------------------------------------------------------------------"
|
||||
echo -e " The backup is gone, and the pom.xml contains the initial dependencies:"
|
||||
echo -e "--------------------------------------------------------------------------------------${NO_COLOR}"
|
||||
ls -lt pom.*
|
||||
echo
|
||||
read -p "Press enter to continue"
|
||||
|
||||
echo -e "${TEXT_COLOR}\n--------------------------------------------------------------------------------------"
|
||||
echo -e " Updating RELEASE dependencies to their *latest* RELEASE version:"
|
||||
echo -e "--------------------------------------------------------------------------------------${NO_COLOR}"
|
||||
exe mvn versions:use-latest-releases
|
||||
echo
|
||||
read -p "Press enter to continue"
|
||||
|
||||
echo -e "${TEXT_COLOR}\n--------------------------------------------------------------------------------------"
|
||||
echo -e " Committing the modifications to pom.xml:"
|
||||
echo -e "--------------------------------------------------------------------------------------${NO_COLOR}"
|
||||
exe mvn versions:commit
|
||||
echo -e "${TEXT_COLOR}\n--------------------------------------------------------------------------------------"
|
||||
echo -e " The backup is gone, and the pom.xml contains the latest dependencies:"
|
||||
echo -e "--------------------------------------------------------------------------------------${NO_COLOR}"
|
||||
ls -lt pom.*
|
||||
echo
|
||||
|
||||
echo -e "${TEXT_COLOR}\nThat's all folks!${NO_COLOR}\n"
|
Loading…
Reference in New Issue