Dev Skelton
Dev Skelton

Reputation: 1

How to connect in a spring boot project, an artifact developed in python in azure devops

I am trying to integrate in my spring boot project, an artifact developed in python using azure devops and maven. At the moment of selecting my artifact, in the "connection feed" section I indicate that I want to do it with maven, where it gives me the steps to integrate in my pom.xml the following:

<repositories>
        <repository>
            <id>central</id>
            <url>https://repo.maven.apache.org/m2</url>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </releases>

        <repository>
            <id>id-name</id>
            <url>url-package-devops</url>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </releases>
    </repositories>

    <distributionManagement>
        </repository>
            <id>id-name</id>
            <url>url-package-devops</url>
            <releases>
                <enabled>true</enabled>.
            </releases>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </repository>
    </distributionManagement>

Then, I use the mvn install command, it seems to install the artifact in my project but I can't see it, or I don't know where it is. How could I download it and use it in some .java file?

To complement my comment, I add you the screenshots from this reply.

Here is my artifact from azure devops: Artifact from azure devops

If I click on "Connect to feed" and select "Maven" it gives me the options you explained in your answer, so that artifact is downloaded as usual. Connect to feed in maven

In fact in the .m2 path I can already visualize it, but I don't know how I can use it inside my spring boot / JAVA project, since I don't know how to call it when importing.

That really is my doubt, how can I use this package that in spite of being developed in python, I can include it in my java project and use it at the moment of importing and consulting all its methods. package in .m2 folder

Upvotes: -1

Views: 267

Answers (1)

Ziyang Liu-MSFT
Ziyang Liu-MSFT

Reputation: 5296

According to my understanding, you published a package to Azure Artifact, and now you want to consume it and know where the package has been downloaded. Please correct me if I misunderstand.

For Maven packages, we cannot manually download them directly from the UI. However, we can set the target package as the dependency of our project and then install it.

To consume a package in Azure Artifact, go to your package in the feed. Connect your project to your feed firstly. Then add the dependency to your pom.xml file. enter image description here

Go to your project's root folder and run mvn install, then the dependencies will be downloaded to your local repository. Maven maintains a repository of dependencies on your local machine (usually in a .m2/repository directory in your home directory) for quick access to project dependencies. For me it is "C:\Users\Administrator.m2". And I can see my target package as shown below after installing: enter image description here

Upvotes: 0

Related Questions