jfrog / jfrog-cli

JFrog CLI is a client that provides a simple interface that automates access to the JFrog products.
https://www.jfrog.com/confluence/display/CLI/JFrog+CLI
Apache License 2.0
528 stars 223 forks source link

'.mvn' directory search is not recursive #2673

Open galusben opened 2 weeks ago

galusben commented 2 weeks ago

Describe the bug

The .mvn directory is used for extra configurations like mvnw config and extensions. The convention and the way maven itself works is that every time a mvn command is running, it will transitively search for the .mvn directory from the current path up to the root path, so it will be easy for developers to include this directory only on the top of their project, while maven will respect the extra configuration regardless of where it was running.

When using JFrog CLI, this is not the case and the command will search only for .mvn on the local path where the command was executed.

So, if we will run:

jfrog mvn clean install It will search for the .mvn directory only in the local directory.

If we will run

mvn clean install

Will search all the way up until it will either hit a .mvn directory or get to the root of the accessible file system.

Current behavior

We are currently forced to maintain multiple .mvn directories within our project. This situation arises because developers and CI pipelines run Maven commands in multiple locations throughout the project, necessitating the presence of the .mvn directory in each of these locations.

Ideally, we would maintain a single .mvn directory at the root of the project, with the following structure:

root
│
├── .mvn
│   └── extensions.xml
│
├── module1
│   ├── src
│   │   ├── main
│   │   │   └── java
│   └── pom.xml
│
└── module2
    ├── src
    │   ├── main
    │   │   └── java
    └── pom.xml

However, due to the current behavior, we are required to duplicate the .mvn directory and extensions.xml file within each module, resulting in the following structure:

root
│
├── .mvn
│   └── extensions.xml
│
├── module1
│   ├── src
│   │   ├── main
│   │   │   └── java
│   ├── pom.xml
│   └── .mvn
│       └── extensions.xml
│
└── module2
    ├── src
    │   ├── main
    │   │   └── java
    ├── pom.xml
    └── .mvn
        └── extensions.xml

This duplication increases maintenance overhead and introduces potential inconsistencies, as each extensions.xml file must be kept in sync across all locations.

Reproduction steps

No response

Expected behavior

No response

JFrog CLI version

2.64.1

Operating system type and version

Linux and Mac OS

JFrog Artifactory version

No response

JFrog Xray version

No response

galusben commented 2 weeks ago

Related issue: https://github.com/jfrog/jfrog-cli/issues/2485