How to build ascidoc PDF in IntelliJ with Maven on Ubuntu Linux - java

My system setup is the following:
IntelliJ 2017.2
Maven 3.5.2
Java 7
Ubuntu 17.10
I have a project in IntelliJ where I want to use asciidoctor variant of asciidocs. I have created a adoc file, and now I want to create the PDF from that file.
I have tried:
mvn clean install -Pbuild-release-notes
But I cant find any PDF file.

Have a look at the POM File (pom.xml) in this asciidoctor-pdf-example project.
When you run:
mvn clean process-resources
(the maven command depends from the asciidoctor-maven-plugin configuration in the POM File)
You can run maven from the command line or from an IDE, you will get your PDF in target/generated-docs.

Related

pi4j-maven Archetype support via Maven in Intelli Idea

I want to write java code using the dependency Pi4j and using Intellij on Windows 10. The target platform is a Pi Zero W.
The instructions to develop on remote (Windows 10 in this case) PC say to add the p4j-maven-archetype but don't explain how to use this maven tool within the maven included with Intellij.
I have tried to download the p4j-maven-archetype, extract it, then open Intellij and import p4j-maven-archetype as a project. Then from within Intellij I run the maven goal install so it can be used in other projects.
How would I now create a new project within Intellij using the p4j-maven-archetype that I installed?
Is there a way to package and run it remotely on the Pi from Intellij?
Since this is an archetype that you first need to install into your local Maven repository, follow the steps from corresponding instructions for the archetype project:
Install the archetype to your local .m2 repository
Unzip the archetype file in a folder
cd folder/raspimaven-archetype
mvn install
Then use project generation Maven command:
mvn archetype:generate -DarchetypeCatalog=local
Or use IDE wizard to create the project from the locally installed archetype: New Project | Maven -> Create from archetype:

Want to build project with commandline mvn but have to use Maven update in eclipse first

I'm working with multiple projects in Eclipse. because I want to automate the building I want to script the building process.
Unfortunately I cannot do the same actions on the commandline as in Eclipse.
So a common problem is that when a new function from a referenced project is used, I cannot build the project on the commandline with mvn. I use the command:
mvn clean install -U
But this command will give a build failure until I do a Eclipse Maven Update from the eclipse GUI. After that I can build the project again.
I also tried all the other commands I came across Stackoverflow:
mvn eclipse:eclipse
mvn dependency:resolve
So I just want to that Maven Update command in eclipse from the commandline so I can build from the commandline. If anyone could tell me what I'm doing wrong that would be awesome.
Thx in advance
Update for more clarification:
The project structure is:
Rest-service, Framework-service, Framework-model
Framework-model is referenced in the pom file by Framework-service and Framework-service is referenced by Rest-service. The other projects are not relevant to the problem.
When a function is added to Framework-model and used in Rest-service it gives an compilation error in eclipse and when I build with mvn clean install -U, although Maven install in eclipse is succesful but I think it is still using the old compiled code. After a Maven Update command in eclipse the compilation error is gone. And mvn clean install -U from the commandline also works.
How could I do a Maven Update command in the commandline? If mvn clean install -U should also do a Maven Update command, what settings should I check?
Another update: So this weekend I tried different things and running mvn compile before the mvn clean install -U command gives a different output. And finds the new function. But as I read maven, I thought install should also do the previous steps. How is this possible?
Eclipse's Maven plugin uses the maven version configured in Preferences/Maven/User settings. If you have a different version of maven in your Eclipse's settings than the one on your PATH variable, you could have different outputs. Maybe try and check that.

Maven Spring project: Adding a custom library using Eclipse IDE [duplicate]

I want to add jpoller.jar as a maven dependency, so I edited my pom.xml file to include it:
<dependency>
<groupId>org.sadun</groupId>
<artifactId>jpoller</artifactId>
<version>1.5.2</version>
</dependency>
Now, as expected, when I compile from the command line I get an error because jpoller isn't in any of the repositories I have listed in my pom, nor could I find one for it. Although I could create a repository for it, I'd rather not at this point. Thus, I get the following error:
[INFO] Failed to resolve artifact.
Missing:
---------- 1) org.sadun:jpoller:jar:1.5.2
Try downloading the file manually
from the project website.
Then, install it using the command:
mvn install:install-file -DgroupId=org.sadun -DartifactId=jpoller -Dversion=1.5.2 -Dpackaging=jar -Dfile=/path/to/file
How can I do this from the M2Eclipse plugin on machines where the maven CLI isn't available?
How can I do this from the M2Eclipse plugin on machines where the maven CLI isn't available?
Well, simply do it from Eclipse. First, get that jpoller jar and save it somewhere on your file system. Then, in Eclipse, from the top bar, Run > Run Configurations... then right-click on Maven Build and configure the New_configuration freshly created:
Select an arbitrary Base directory
Fill the Goals with install:install-file
Add parameters for each required parameters, without the -D prefix (e.g. file as Parameter name and /path/to/file as Value and so on for groupId, artifactId,packaging and version).
And run this configuration. Or... just install Maven.
The install command automates the creation of a folder structure in ~/.m2 and pom.xml file for the dependency artifact. This can be done manually. OR You can simply copy the ~/.m2/{group}/{artifact} folder from a machine that does have mvn installed.
Edit: This tool will help you find public repositories for a given dependency.
Edit2: See http://maven.apache.org/guides/mini/guide-coping-with-sun-jars.html for an explination of the process of installing dependencies manually. Note that most sun jars are now available in the java.net repository http://download.java.net/maven/2/

Converting SVN project to maven project in Eclipse

I have downloaded a project (Maven based structure) from our SVN repository using Eclipse SVN plugin. Initially, Eclipse wasn't recognizing it as java project so I had to follow the following steps:
http://www.javaexperience.com/how-to-convert-svn-project-to-regular-eclipse-java-project/
The above steps worked well and the project was converted to java project.
Next I right clicked on the project and selected maven->Convert to maven project. Eclipse downloaded some jars and added it to the class path but not all files seem to have been downloaded successfully as I see Junit jar file missing error (where as junit is mentioned in pom.xml)
When I right click on the pom.xml file, I don't see the option "mvn install" or "mvn clean". I am using Eclipse Kepler which comes with maven plugin out of the box.
You will find the Maven commands in 'Run As', not in 'Maven'
I would first create a maven project using create maven project menu then add the SVN based source code to it.

importing a whole project into Maven (Eclipse Juno)

I have a folder that contains some Java code, written specifically for Linux.
There is a pom.xml file and two folders called: src and build
I have installed Eclipse Juno on my Mac (10.7.5) and I understand it already has Maven included. On the Linux machine, the code is executed by entering mvn package at the command line.
But after this stage, during the execution of the build artifact, it doesn't run on my Mac, because some of the commands are specific to Linux (I am told).
How do I import the whole project into Maven on my Mac? I mean where do I copy the folders and pom file?
Thank you,
H
You can leave the maven project where it is. Go to
File->import->Maven->Existing Maven Projects->Root directory
and select the maven project dir.
If you cannot see Maven in Import menu it means you need to add maven plugin (m2e) to your Juno. The fact that mvn runs from command line means only that maven is installed on your PC.
Complementing Evgeniy Dorofeev's answer:
If your project is in a GIT repository and you use eGit, you might want to import it like this:
File->Import->Git->Projects from Git
After the import you can convert your project to a Maven project and it will update the project settings.

Categories

Resources