In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly shows you "RAINBOND source code how to build JAVA project configuration MAVEN warehouse", the content is easy to understand, well-organized, hope to help you solve your doubts, the following let the editor lead you to study and learn "RAINBOND source code how to build JAVA project configuration MAVEN warehouse" this article.
Overview
According to a large number of Rainbond user feedback, we found that the most prone to problems in the process of building java-maven projects with Rainbond source code is the failure to obtain components.
For example:
[ERROR] Failed to execute goal on project bq-insurance-third-party: Could not resolve dependencies for project
Such an error report.
Download and install Maven
Rainbond provides a variety of maven versions for users to choose from by default. The corresponding version and the corresponding resource address are obtained in the following table:
The Maven version gets the address 3.3.1 http://lang.goodrain.me/jvm/maven/maven-3.3.1.tar.gz3.0.5http://lang.goodrain.me/jvm/maven/maven-3.0.5.tar.gz3.1.1http://lang.goodrain.me/jvm/maven/maven-3.1.1.tar.gz3.2.5http://lang.goodrain.me/jvm/maven/maven-3.2.5.tar.gz3 .3.9 http://lang.goodrain.me/jvm/maven/maven-3.3.9.tar.gz
If you encounter a Maven build failure, please make sure that the current maven version is relevant. If you are not sure, you can download the above resources and try to build locally.
Clear the build cache
Rainbond provides caching for the build environment of each service. The Maven project provides caching for the installation directory, configuration directory, and local repository directory of maven. Users clean the cache with the following settings.
Users should turn on clearing the build cache until the build is successful for the first time. This prevents caching to incomplete or incorrect packages, causing the build to fail all the time. Keep in mind that builds give priority to getting artifacts from the cache.
Default Maven build runtime environment setting resolution
When Rainbond source code builds a java-maven project, it provides default build runtime environment settings.
Enable clear build cache: click to clear the build cache before each build. Not enabled by default.
Maven version: select the Maven version. Default is 3.3.1.
Disable Maven Mirror: disable the Maven Mirror setting after clicking, that is, instead of obtaining components through the rbd-repo (Artifactory) service, you can go directly to the central warehouse or the warehouse specified in pom.xml to obtain the components. Subsequent MAVEN MIRROR OF MAVEN MIRROR URL settings fail. It is not disabled by default.
MAVEN MIRROR OF: after enabling the mirror feature, this parameter is used to specify which repositories for image caching. The default is the central repository (central). When * is specified, all repositories will be mirrored and cached.
MAVEN MIRROR URL: specify the address of the image repository, which defaults to the maven.goodrain.me (that is, rbd-repo service address) that comes with Rainbond. If the user has a private server used within the company, it is recommended to directly specify his or her address in a format similar to: http://IP:8081/nexus/content/groups/public/
Maven component parameters: the default setting is to ignore unit tests. The user sets it according to the situation of the project.
Maven widget global parameter: the default value is clean dependency:list install. It should be noted that dependency:list needs to download a specific maven plugin, so when the user is in an offline environment and there is no corresponding component in the private server, the build failure is bound to occur. Please change it to clean install.
MAVEN builds Java parameter configuration: the default configuration is-Xmx1024m. This option specifies the memory used when maven is built, which is set according to the user's environment.
It is important to point out that when specifying the MAVEN MIRROR OF parameter, you need to consider whether the specified warehouse can be identified. The warehouse name is specified in the setting.xml file used by maven, while only the above configurations are added to the setting.xml used by Rainbond by default! So the custom warehouse name used by the user on a daily build will not be recognized. In this case, you can specify * to cache all artifacts, or replace the Rainbond default file with the user's own setting.xml file.
Custom Setting.xml
Users can configure special environment variables to specify the setting.xml they use when building the project locally, and when specified, the options in the default build environment configuration will be invalidated.
Such a configuration will be the ultimate solution, and users can build it locally, so it can also be built in Rainbond. Because after using the specified setting.xml file, everything in the Rainbond build environment is no longer different from the local one.
Users can put their previous setting.xml in the project source directory, when the file is in the source root directory, please do this: set the environment variable BUILD_MAVEN_SETTINGS_PATH=/app/setting.xml, you can use the file.
When Rainbond source code is built, all files in the source directory are stored in the / app directory by default, so the path to the file is changed to / app/setting.xml
If there is sensitive information in setting.xml, it should not appear in the source directory. Then you can upload it to places such as object storage and provide a download address. Then: set the environment variable MAVEN_SETTINGS_URL= http://somewhere/setting.xml to use the file.
Deploy local private service warehouse
Some users do not have a private server in the warehouse within the company, and at the same time want to use Rainbond source code to build maven projects in an offline environment. Then you need to use the rbd-repo (Artifactory) service to build your own warehouse private server and upload the dependency package.
Visit the http:// management node IP:8081 and log in with the administrator account (admin/password).
Create a Maven repository of type Local. The example creates a Maven repository of type Local named repo-local
Upload your own jar package to the local warehouse repo-local
View dependency declaration information
Add repo-local to the libs-release virtual repository
Visit http://:8081/artifactory/list/libs-release/ or the admin node to visit maven.goodrain.me to see if you can list your newly added artifacts.
If you already have a fully available repository folder, you can also use the import feature to upload the entire warehouse to the repo-local local repository.
Full upload provides two ways: to mount import from a directory, or to upload zip. The first way to note is that the upload path is to be uploaded in the path in the rbd-repo container, so you need to perform path mount in advance. Second, you need to pay attention to the file upload size limit, which can be set in admin-- Configuration--General Configuration.
I can build it locally, but why can't I build it on Rainbond?
Reading through this document, we can find that there are a lot of details to pay attention to when performing a maven build, and these small details can cause the build to fail.
But what is certain is that it can be built locally, so it can be built in a Rainbond environment with the same network conditions. Because when Rainbond performs a source build, the principle used is no different from a normal maven build. It is important to note that there is a slight difference in the build environment.
The following is the train of thought for troubleshooting when you encounter such doubts:
Version differences: this difference includes maven version differences, as well as JDK version differences (even small versions of the same major version). This will be the first aspect that needs to be checked when there is an error that cannot be determined. For information on how to choose the version of JDK and how to deal with the impact of version differences, see the document: RAINBOND Source build JAVA Project Select JDK
GZIP STDIN NOT IN GZIP FORMAT: if this error is reported in the build log, it can be determined that the failure to obtain the JDK or Maven installation package can be solved by selecting JDK to build the JAVA project with the document source code construction prompt GZIP STDIN NOT IN GZIP FORMAT RAINBOND source code.
Build cache: again, users should turn on clearing the build cache until the first build is successful. This prevents caching to incomplete or incorrect packages, causing the build to fail all the time. Keep in mind that builds give priority to getting artifacts from the cache.
Failed to get components: the answer to this question is not unique, and there are a lot of situations that can happen.
First of all, combined with the component download address in the construction log, to determine whether to use the warehouse private server when obtaining the component failed, whether to use the default private server (maven.goodrain.me) or the user-defined private server (user-specified artifactory or nexus).
If the Mirror feature is disabled, the central warehouse is used by default. At this point, it is necessary to judge whether the network can access the central warehouse and whether the current components exist in the central warehouse.
If the Mirror feature is not disabled and Rainbond default Warehouse Private Service (maven.goodrain.me) is used, the default proxy is the central warehouse. At this point, it is necessary to judge whether the network can access the central warehouse and whether the current components exist in the central warehouse.
If the Mirror feature is not disabled and a user-defined private server is used. It is necessary to judge whether the network can access the specified warehouse private server, and whether the current component exists in the designated warehouse private server.
401 authentication failed: if an error is reported in the construction:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project dx-id: Failed to deploy artifacts: Could not transfer artifact com.dx.application:dx-id:pom:0.0.1-20190727.012351-2 from/to snapshots (http://******:8081/artifactory/libs-release): Failed to transfer file: http://*******:8081/artifactory/libs-release/com / dx/application/dx-id/0.0.1-SNAPSHOT/dx-id-0.0.1-20190727.012351-2.pom. Return code is: 401, ReasonPhrase: Unauthorized. -> [Help 1]
It shows that authentication information is needed to access the warehouse private server specified by the user, and the authentication information is generally stored in the setting.xml file used by the user on a daily basis. Therefore, the best way to solve this problem is to use the custom Setting.xml mentioned above. Again, custom Setting.xml exists as the ultimate solution, and it is also applicable to other component acquisition failures caused by special settings in the user's warehouse.
My warehouse is enough for my project to build, but it still reports that some artifacts can't be found: the default global parameter for Maven artifacts for Rainbond is clean dependency:list install. It should be noted that dependency:list needs to download a specific maven plugin, so when the user is in an offline environment and there is no corresponding component in the private server, the build failure is bound to occur. Please change it to clean install.
Use rbd-repo to proxy other warehouse private servers: users can use rbd-repo components to represent other remote warehouse private servers. But there may be strange problems in the transmission components between different warehouse private servers. Therefore, we recommend that users use MAVEN MIRROR URL to directly specify the remote warehouse address instead of using the rbd-repo agent.
These are all the contents of this article entitled "how to build a JAVA project configuration MAVEN repository with RAINBOND source code". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
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.