In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces "the method of publishing jar to maven central warehouse". In the daily operation, I believe that many people have doubts about the method of publishing jar to maven central warehouse. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts of "publishing jar to maven central warehouse". Next, please follow the editor to study!
Sign up for sonatype work order system account
You have to go to this website to sign up for an account.
Https://issues.sonatype.org/secure/Signup!default.jspa
We need to submit a ticket to apply for permission to submit a jar package, so we must create an account to submit a ticket. This account can also use sonatype's Nexus, and we finally publish it to the central database through Nexus.
Submit a work order
Log in to issues.sonatype.org, click new at the top navigation to create a new work order, and fill in the following figure
Field description
Project: select Community Support-Open Source Project Repository Hosting
Type: select New Project
Summary: subject, required, according to the actual situation
Description: description, optional, according to the actual situation
Attachment: attachment, optional
GroupId: the GroupId of the project, which is the same as the GroupId in pom.xml. It is required. If not available, you can use your github.
Project URL: the url of the project, which is required. If the project code is on github, enter the github url of the project.
SCM url: the code address of the project. It can be the address of the code under git clone. It can be github or domestic code cloud.
Already Synced to Central: whether it has been synchronized to the central library, if you do not select No.
Then click * * New * * to submit and wait for the staff review. At this point, the work order status is Open, and if there is no problem with the information provided, the status will change from open to resolved. You can get a reply in about an hour or two. Generally speaking, the reply is to verify that groupid belongs to your own domain name.
The reply is as follows:
According to the reply, adding a txt record to the domain name is the fastest way. Reply after it is added, and the official will deal with it in less than 10 minutes.
Configure the pom.xml of the project
Add the following configuration to pom.xml
Org.sonatype.oss oss-parent 7 The Apache Software License Version 2.0 http://www.apache.org/licenses/LICENSE-2.0.txt repo Project address roseboy.net author name author mailbox configuration maven setting.xml add server
Add the following code under the servies node:
Sonatype-nexus-snapshots first step registered user name first step registered password sonatype-nexus-staging first step registered user name first step registered password
At this point, the configuration related to maven has been completed, but the jar package cannot be uploaded yet. You also need to configure gpg-key for signature verification to prevent bad guys from tampering with your jar package.
Configure gpg-key
Download the installation version directly from this URL https://www.gnupg.org/download/index.html and use the graphical interface to operate. Click New, fill in the name, email, password and so on to generate key, then pop up the box to ask if you want to upload, and click the upload button to upload the public key.
Upload to Nexus of sonatype
Execute maven deployment command
Mvn clean deploy-P sonatype-oss-release-Darguments= "gpg.passphrase= key password"
If you are using the idea integrated environment, follow the figure below, and finally double-click deploy.
By the time the execution is complete, your jar source code, the generated docjar, and the packaged jar have been uploaded to Nexus.
Log in to Nexus and publish to the central warehouse
Use the account registered in the first step to log in to the following URL and check it at https://oss.sonatype.org/#stagingRepositories (left Build Promotion-- > Staging Repositories). It is usually the last one, which can be discarded by time or searched through the search box in the upper right corner. The status should be open. Select the component and click Close- > Confirm,nexus above to do some processing and verification. If the verification fails, you need to delete the component and upload it after modification.
If the verification is successful, select the widget, and click Release- > Confirm above. After the release is successful, the status will change to Releaed, and then automatically deleted.
You can click Advanced Search on the left side of the page to view it. If you can find the released module, it means it has been successful.
It is usually released to the maven central library within 10 minutes, but it takes two hours to update to search.maven.org. If you can find it on https://mvnrepository.com/, it will take 1-2 days.
Plug-ins released to the central warehouse
After the execution of maven delploy, you also need to log in to Nexus and wait for the verification to complete before manually publishing. This step is troublesome. You can use plug-ins to complete these operations.
The pom.xml of the project is increased by the following configuration:
Org.sonatype.pluginsnexus-staging-maven-plugin1.6.7truesonatype-nexus-staging https://oss.sonatype.org/true
After adding the plug-in, you can publish it to the central repository by running mvn deploy directly, but it takes a long time.
At this point, the study on "the method of publishing jar to maven central warehouse" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.