Issue
We have local network with bunch of users connected together.
And we can access shared files like \\user023\share\folder\test.txt
.
How can i use this address to make local maven repository or how can i use maven { url 'path to network address'}
?
Solution
Quite simply:
maven { url 'file:///[Path-to-Repo]'}
For example:
If you repo were located at '\\Sever\Developer Repos\m2'
:
The Maven reference in the repository section of your build.gradle
would look like:
maven { url 'file:///Sever/Developer%2520Repos/m2'}
A few caveats:
- It is advised to do what other suggest and setup a 'real' repository. if that is not possible, then enter into the rest of this at your own risk.
- Use the '/' character in your paths.
- Spaces in filenames need to be designated with their unicode escaped equivalency.
- The m2 repo needs to be an actual Maven repo with the appropriate file structure,.pom files etc.
- Never WRITE to a repo like this with a build script when there are multiple users utilizing this repo. This will most certainly cause corruption for at least a portion of the repo. In fact, I would lock the file structure as read-only if possible to prevent this from happening and force manual updates to the repo as necessary.
- This information is for gradle 6.3 with the Android 3.6.3 gradle build tools. This has broke in the past and so be sure to use a gradle wrapper with your project to ensure build compatibility as you move forward.
Answered By - David Rock
Answer Checked By - Cary Denson (JavaFixing Admin)