How to use Maven to only sign three jars and push them to Maven Central?

前端 未结 1 1110
庸人自扰
庸人自扰 2021-01-25 06:53

UPDATE: See followup question


I have a Java library whose build process is entirely written in Ant. The project\'s sandbox (the source directory, in which

1条回答
  •  爱一瞬间的悲伤
    2021-01-25 07:46

    If you are building your artifacts outside of Maven you need to reference them in your .pom file

    At first, set the packaging of your project to pom so Maven will not attempt to compile anything.

    Then use the build-helper-maven-plugin to attach your artifact files to the project. Here is an example:

        
            org.codehaus.mojo
            build-helper-maven-plugin
            1.8
            
                
                    attach-artifacts
                    package
                    
                        attach-artifact
                    
                    
                        
                            
                                build/xbnjava-0.1.1/download/mylibrary-0.1.1.jar
                                jar
                            
                            
                                build/xbnjava-0.1.1/download/mylibrary-0.1.1-javadoc.jar
                                jar
                                javadoc
                            
                            
                                build/xbnjava-0.1.1/download/mylibrary-0.1.1-sources.jar
                                jar
                                sources
                            
                        
                    
                
            
        
    

    Finally, add the distributionManagement section to your .pom file as specified here.

    You can refer to my own Maven project setup at github which was created to upload manually built .jar files on Maven central.

    0 讨论(0)
提交回复
热议问题