How do I build this java project with maven? - java

I honestly don't know anything about java, I'm just trying to build the latest version of this project to try and work around bugs in the version that is packaged by my OS. The project in question:
https://sourceforge.net/projects/tuxguitar/
I tried running mvn compile, mvn clean package, and mvn clean install but no jar file was produced in the source tree. The readme has no instructions for building. Any help would be greatly appreciated!
Thanks!

To produce jar you need at least package phase, you can get there by doing:
mvn clean package
(clean is to remove stale data, it is a good practice to use it always with maven) and you jar will be in target directory.

mvn complite just complite the project and no package.
answer : mvn clean package.this will clean,complite and package the project,after finished, you can found the package(jar or war) into the $PROJECT_HOME/target/ folder.

I usually run mvn clean install - which in addition will add the built jar into your local maven artifact repository.

Related

How to find the dependencies of a maven plugin goal

I'm trying to find out where the dependencies are coming from for a particular plugin goal. I know the dependencies exist because Maven downloaded them when I ran the goal for the first time. And they're not (directly) dependencies of my project, because I ran mvn clean install first, and these dependencies weren't downloaded then.
In this specific case, I'm trying to figure out what the dependencies are when I run mvn sonar:sonar, but I expect the answer will be general purpose. For instance, even though I've built this project a number of times, when I ran that goal Maven downloaded a bunch of new jars like maven-antrun-plugin.
Here are things I've tried:
mvn dependency:tree shows the dependencies for the project, but not for the plugin goal (it doesn't include anything related to SonarQube in the list).
mvn org.apache.maven.plugins:maven-help-plugin:3.2.0:effective-pom -Dverbose=true also doesn't include anything related to SonarQube.
mvn -X sonar:sonar prints out what looks like a dependency graph, but it's missing the jars that Maven downloaded the first time I ran the sonar:sonar goal.
mvn -X dependency:resolve-plugins seems to be meant to download the dependencies of plugins, but does not capture the sonar:sonar dependencies. If I clear out my Maven cache, run mvn dependency:resolve-plugins, and then run mvn sonar:sonar, Maven has to download jars.
Use your IDE to navigate to the POM of the plugin project and then look at the dependency tree.
Or do this manually by copying the plugin POM to your file system and running mvn dependency:tree.
The dependencies downloaded by maven are generally stored locally on the pc at the address C:\Users\yourUser/.m2 this regardless of your projects and so that you do not have to reload dependencies that you are already using in other projects.
I hope I have understood your question and that my answer is useful to you, greetings.

Trying to compile Maven with clean parameter and got exception

Trying to compile Maven with clean parameter:
C:> mvn clean
and got the exception below:
Cannot execute mojo: clean. it requires a project with an existing pom.xml, but the buid is not using one.
can anyone tell me how I can associate my existing project to maven.
Maven uses a file called pom.xml to build. It should be located in the root of your project.
Maven works on the basis that your project conforms to the Maven way of doing things and so I would recommend reading the Maven Getting Started Guide to familiarize with the standards before starting to use Maven.
I think you need to read up on a bit of documentation. Basically it is the pom.xml file it is complaining about that defines how maven should handle your project.
This explains how you can use maven to generate an example project.
This goes in more depth and also provides some links to other resources.
suppose your project is in 'C:\MyProject' where you can see a pom.xml file, open command prompt, go to C:\MyProject and type 'mvn clean' as follows:
> cd C:\MyProject
> mvn clean
The project you are compiling is not a maven project.

How to run the downloaded project through eclipse

I am referring "http://krams915.blogspot.in/2011/01/spring-mvc-3-hibernate-annotations.html" blog and at end of the blog there is source code in zip folder i have downloaded but i dont know how to run in Eclipse,
at the last on blog they have mention
You can run the project directly using an embedded server via Maven.
For Tomcat: mvn tomcat:run
For Jetty: mvn jetty:run
I dont know how use this steps.please help me how to run this project,
I am using tomcat as my server,
Thanks,
Basically you need to do two things:
Install maven plugin in eclipse.
Add a tomcat server instance in eclipse.
This link should guide you to achieve that:
http://www.mulesoft.com/tomcat-maven
Install Maven
go through command line to your project folder
call mvn tomcat:run or mvn jetty:run
1.Install Maven
2.set system enivorment
3.go through command line to your project folder(where the pom.xml is)
4.call mvn tomcat:run or mvn jetty:run
Download Spring Source Tool suite which comes along with maven. It maked things little easier for you. You can directly run maven projects from the IDE itself.

How to stop eclipse to redownload the plugin from repository for a maven project

I am importing an existing project into my eclipse workspace. I am using Maven 2.2.0, and Eclipse Juno. I could build project successfully using mvn command prompt.
But unable to import the project as eclipse could not build the project.Eclipse is trying to again download from repository. What If we stop eclipse to download the resources again from repository.
I thought I would add Windows--->Preferences-->Maven--Archetype--Add local catalog
I understood that we have ~/.m2/archetype-catalog.xml catalogu file. But to my surprise I cannot find it.
Please suggest me if I am proceeding with correct way or not.
If its correct way, how do I set local archetype.
Please share your thoughts.
Thanks In Advance.
You need to install the mvn plugin and import the mvn project as such. Alternatively, you can eclipsify the mvn project using the goal eclipse:eclipse (with the mvn command line).
In mvn itself you could set the pluginRepo to updatePolicy NEVER temporarily, if you still have issues with Eclipse. I think Eclipse uses the same settings for importing mvn projects.
http://maven.apache.org/settings.html
I personally never was happy with Eclipse's mvn integration. Have you tried IntelliJ?

POM file updated what to do next?

I had a some config in pom.xml and now i have updated the version of a core tech... now should i run mvn clean install again or mvn eclipse:eclipse.
Both.
If you are worried that you might trash something, take a recursive copy of your workspace before you do it.
Another alternative is to install and use the m2eclipse plugin.

Categories

Resources