Build,Unit test,Compile using maven - xcode

I want to some operation on my xcode project that is compile,build and unit test using the "Maven" command like "mvn clean install","mvn validate". do we need to create Pom.xml? how can we create Pom.xml
Thanks

sure, u need pom.xml. how to build your pom? you can read maven's manual:
http://maven.apache.org/guides/introduction/introduction-to-the-pom.html

Related

How to build a maven scaffold like spring initializr

As the title, is there such a maven plugin that can achieve such a function, I can manually select the required dependencies, or even generate the code automatically?
There is https://code.quarkus.io/ for generating projects from the browser and also the quarkus https://quarkus.io/guides/cli-tooling if you want to use a command line application
You can create Maven project with mvn archetype:generate command. For example:
mvn archetype:generate -DgroupId=com.roamch007 -DartifactId=my-app -DinteractiveMode=false
This command will create project in may-app directory.
If you need specific dependencies you can create Maven Archetype, and re-use this archetype while generating new projects.
Read more: Guide to Maven Archetype

How to auto create parent packages by groupId and artifactId in pom xml

when creating maven projects, do a lot rework to create specified parent package.
such as:
when created maven project with groupId com.test and artifactId jpa-demo,
later only thing to create packages: com.test.jpa.demo in src/main/java.
so how to auto create these pacs?
mm. didn't find useful plugin in IntelliJ Idea.
anyone know a good idea? tks.
What you can try to use is Maven Archetypes like this:
mvn archetype:generate
in interactive mode.
https://maven.apache.org/guides/introduction/introduction-to-archetypes.html

How to generate maven artifact with jenkins build number

I'm trying associate maven artifacts name with build number.
ex: sample.1.0.0-snapshot.ear into sample.1.0.0-snapshot.buildnumber.ear
I have tried maven-buildnumber plugin but still no luck.
could anyone help me to do this.
You can use the Versions Maven plugin by executing following command before any other maven targets after clean.
mvn versions:set -DnewVersion=sample.1.0.0-snapshot.$BUILD_NUMBER

How to create maven dependency in java?

How to create maven dependency in java?
what are the benefits of maven?
what is the role of pom.xml?
mvn org.apache.maven.plugins:maven-dependency-plugin:2.1:get
-DrepoUrl=http://download.java.net/maven/2/ -Dartifact=robo-guice:robo-guice:0.4-SNAPSHO
mvn install
Download the “kaptcha“, extract it and copy the kaptcha-version.jar to somewhere else, for example, c drive. Issue following command :
pom.xml
After installed, just declares the kaptcha coordinate in pom.xml.
Done
Build it, now the "kaptcha" jar is able to retrieve from your Maven local repository.
link :-http://www.mkyong.com/maven/how-to-include-library-manully-into-maven-local-repository/

maven project dependency is a generated jar (not in maven repo)

I am a maven newbie. My project depends on another maven project (ProjectA) in that I need to run mvn clean package on ProjectA which gives me JarA.
Then, I need to run java JarA feeding it with an xml configuration file which gives me another JarB. I need both JarA and JarB as dependencies on my project (ProjectB).
Any comments on whether it is possible to achieve these steps in projectB's pom file? Would having parent-submodule type of a configuration help? Thanks!
Maybe. The most simple solution to get JarB would be to add a unit test to project A. But that doesn't tell Maven about this JAR, so it will ignore it.
The next step would be to get the test to write JarB as JarA-config into the target/ folder of project A. Maven supports multiple artifacts as "build results". You can then use the "qualifier" to distinguish between them.
Use build-helper:attach-artifact to tell Maven about the second JAR. See "Attach additional artifacts to your project" for an example.
Note that package happens after test, so your test case can create the second JAR and build-helper will then find it.
In project B, you can then use this to depend on both JARs
<dependency>
<groupId>x</groupId>
<artifactId>jarA</artifactId>
</dependency>
<dependency>
<groupId>x</groupId>
<artifactId>jarA</artifactId>
<classifier>config</classifier>
</dependency>
Note the additional <classifier> element.
Note: For this to work, you need to run mvn install in project A.

Resources