Cannot download sources from remote maven repository, but from local all is fine

516 Views Asked by At

I have 2 java projects: payment-common and payment-service. In payment-common I added maven-siurce-plugin:

<project>
    <builds>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <executions>
                    <execution>
                        <id>attach-sources</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>

if I run mvn clean package, I see sources.jar in target:

enter image description here

I see also this .jar file in our remote repository after mvn clean deploy:

enter image description here

I have the next dependency in project payment-service:

<dependency>
    <groupId>com.***</groupId>
    <artifactId>payment-common</artifactId>
    <version>1.540.0-SNAPSHOT</version>
</dependency>

If I trying to download sources in Idea, I’m getting the next error:

enter image description here

And then. I run mvn clean install, after them I can successfully download sources. What am I doing wrong?

UPD: repositories in pom.xml:

    <repositories>
        <repository>
            <id>cloudfront-snapshots</id>
            <name>***</name>
            <url>https://maven.***.net/</url>
        </repository>
        <repository>
            <id>jcenter-snapshots</id>
            <name>jcenter</name>
            <url>https://jcenter.bintray.com/</url>
        </repository>
        <repository>
            <id>maven.***</id>
            <url>s3://***-maven-repo/</url>
        </repository>
    </repositories>
    <pluginRepositories>
        <pluginRepository>
            <id>maven.***</id>
            <url>s3://***-maven-repo/</url>
        </pluginRepository>
    </pluginRepositories>
    <distributionManagement>
        <repository>
            <id>maven.***</id>
            <url>s3://***-maven-repo/</url>
        </repository>
        <snapshotRepository>
            <id>maven.***</id>
            <url>s3://***-maven-repo/</url>
        </snapshotRepository>
    </distributionManagement>
0

There are 0 best solutions below