简体   繁体   中英

How to add some contents in pom.xml for “mvn install”?

I have multiple java projects with me. I have one document to Build the source code using Maven. I am following it and trying to build the project.

1) Initially in the document it is given that you have to do "mvn install" or "mvn -Dmaven.test.skip=true install" at the root directory of your project.

2) Then given that if above steps generate error then you have add some lines to pom.xml file. Lines are: add the following entry as the last entry in the list (you will find an entry with id openxds so this new entry should follow that one):

 <repository>
    <id>sysnetint</id>
    <url>http://sysnetintrepo.com/repository</url>
 </repository>

You will also need to add this repository to the plugin repositories section:

 <pluginRepositories>
    <repository>
       <id>sysnetint</id>
       <url>http://sysnetintrepo.com/repository</url>
    </repository>
 </pluginRepositories>

The build should be successful at this point and you should have all the targets ready for deployment.

I add the first lines in the respective node but I am not getting where to add the second lines in pom.xml

Because in my pom.xml there is already node and if I enter to add this again inside it, then maven is giving error something related to tag.

I want to ask that how to add the above lines in pom.xml?

Sorry for asking stupid question on this as I don't know about the maven and pom.xml files.

Thanks

Updated: Under pluginRepositories node the child nodes are as:

<pluginRepositories>
              <pluginRepository>
                      .....
              </pluginRepository>
</pluginRepositories>

If I enter repository node under pluginRepositories, I am getting certain errors related to that tag only

<pluginRepository> is a subTag of <pluginRepositories> and <repository> is a subTag of <repositories> . So don't add <repository> under <pluginRepository> .

Instead put the content of the <repository> tag (without the tag itself) in <pluginRepository>

Take a look at this page there is examples.

Edit : it should be something like that :

        <repositories>
              <repository>
                 <id>sysnetint</id>
                 <url>http://sysnetintrepo.com/repository</url>
              </repository>
        </repositories>
        <pluginRepositories>
              <pluginRepository>
                 <id>sysnetint</id>
                 <url>http://sysnetintrepo.com/repository</url>
              </pluginRepository>
        </pluginRepositories>

honestly, you'll have to start with Maven basics. go to http://maven.apache.org/guides/ and start reading there. what you are now trying to do is to jump right in the middle of the complex thing the Maven is, and apparently by using some custom tutorial.

regarding the specific question you asked: "pluginRepositories" tag goes directly under the root node ("project"). you can check the entire POM structure at http://maven.apache.org/guides/introduction/introduction-to-the-pom.html#Super_POM

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM