You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by am...@apache.org on 2021/08/13 13:28:24 UTC
[ignite-3] branch main updated: IGNITE-15304 Validate POM files for
duplicate dependencies (#279)
This is an automated email from the ASF dual-hosted git repository.
amashenkov pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/ignite-3.git
The following commit(s) were added to refs/heads/main by this push:
new 9840566 IGNITE-15304 Validate POM files for duplicate dependencies (#279)
9840566 is described below
commit 984056648abe955e31febfc3fca0d82dabe6e4ad
Author: Peter Ivanov <mr...@gmail.com>
AuthorDate: Fri Aug 13 16:28:21 2021 +0300
IGNITE-15304 Validate POM files for duplicate dependencies (#279)
---
.../{run.sh => CheckDuplicateDependencies.sh} | 36 ++++++++--------------
check-rules/maven-check-scripts/run.sh | 3 +-
modules/raft/pom.xml | 7 -----
3 files changed, 14 insertions(+), 32 deletions(-)
diff --git a/check-rules/maven-check-scripts/run.sh b/check-rules/maven-check-scripts/CheckDuplicateDependencies.sh
similarity index 53%
copy from check-rules/maven-check-scripts/run.sh
copy to check-rules/maven-check-scripts/CheckDuplicateDependencies.sh
index 25fb506..3287ebd 100644
--- a/check-rules/maven-check-scripts/run.sh
+++ b/check-rules/maven-check-scripts/CheckDuplicateDependencies.sh
@@ -14,29 +14,17 @@ set -o nounset; set -o errexit; set -o pipefail; set -o errtrace; set -o functra
# See the License for the specific language governing permissions and
# limitations under the License.
-cleanup() {
- rm -rf current-list \
- sorted-list \
- unused-properties.txt
-}
-trap cleanup EXIT SIGINT ERR
-command -v xpath > /dev/null || {
- echo "xpath not found, exiting"
-}
-
-DIR__MAVEN_CHECK_SCRIPTS="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
-for script in CheckDependencyAndPluginVersionsNotInParent.sh \
- CheckModulesInRootPomAreSorted.sh \
- CheckPropertiesNotInParent.sh \
- CheckUnusedDependenciesAndPluginsInParent.sh \
- CheckUnusedProperties.sh; do
- echo -n " * Executing ${script}... "
- bash ${DIR__MAVEN_CHECK_SCRIPTS}/${script} && \
- echo "Done" || {
- echo "[ERROR]"
- exit 1
- }
+ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )/../.."
+POMS=$(find ${ROOT} -name pom.xml)
+for pom in ${POMS}; do
+ total_count="$(xpath -q -e "count(project/dependencies/dependency)" "${pom}")"
+ for i in $(seq 1 1 ${total_count}); do
+ xpath -q -e "project/dependencies/dependency[${i}]/*/text()" "${pom}" | \
+ sed ':a;N;$!ba;s/\n/:/g'
+ done | \
+ sort | \
+ uniq -d | while read -r dependency; do
+ echo "[ERROR] Found duplicate dependency in '$(sed -r "s|${ROOT}/||" <<< ${pom})': ${dependency}"
+ done
done
-echo
-echo "All checks finished successfully"
diff --git a/check-rules/maven-check-scripts/run.sh b/check-rules/maven-check-scripts/run.sh
index 25fb506..383a776 100644
--- a/check-rules/maven-check-scripts/run.sh
+++ b/check-rules/maven-check-scripts/run.sh
@@ -30,7 +30,8 @@ for script in CheckDependencyAndPluginVersionsNotInParent.sh \
CheckModulesInRootPomAreSorted.sh \
CheckPropertiesNotInParent.sh \
CheckUnusedDependenciesAndPluginsInParent.sh \
- CheckUnusedProperties.sh; do
+ CheckUnusedProperties.sh \
+ CheckDuplicateDependencies.sh; do
echo -n " * Executing ${script}... "
bash ${DIR__MAVEN_CHECK_SCRIPTS}/${script} && \
echo "Done" || {
diff --git a/modules/raft/pom.xml b/modules/raft/pom.xml
index 65bdfa0..bc45020 100644
--- a/modules/raft/pom.xml
+++ b/modules/raft/pom.xml
@@ -116,13 +116,6 @@
<scope>test</scope>
</dependency>
- <dependency>
- <groupId>org.apache.ignite</groupId>
- <artifactId>ignite-core</artifactId>
- <type>test-jar</type>
- <scope>test</scope>
- </dependency>
-
<!-- Logging in tests -->
<dependency>
<groupId>org.slf4j</groupId>