Search code examples
maven-2m2eclipsenexus

maven 1 source artifact in maven 2/3?


I have a large base of maven 1 artifacts with their source jars named as app-0.0.1-src.jar. This repository is converted with nexus to a maven 2 view. Unfortunately the m2 convention on source jars is "...-sources.jar", so none of our m1 artifacts has sources.

Is there any way in nexus or otherwise to make maven 2 (esp. m2eclipse) download the sources with the old classifier ? I did try something like this without success:

<build>
    <plugins>
        <plugin>
            <artifactId>maven-dependency-plugin</artifactId>
            <groupId>org.apache.maven.plugins</groupId>
            <configuration>
                <includeClassifiers>src,sources</includeClassifiers>
            </configuration>
        </plugin>
    </plugins>
</build>

Solution

  • I guess if you are dealing with legacy apps and there won't be any new jars, a sufficient solution would be to write a shell script that loops over the repository and for every xyz-0.0.1-src.jar create a symbolic link at xyz-0.0.1-sources.jar.

    Another solution would be to create a rewrite rule in your app server that redirects all requests from *-sources.* to *-src.* within your mvn 1 repository directory.