Solved I've already failed and I haven't even started (Help with Maven)

Discussion in 'Plugin Development' started by acer5999, Jul 13, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    acer5999

    Hi,
    Essentially I am trying to write just a small plugin thats only job is to make EchoPets cost some money
    I am trying to use the Vault API and the EchoPetAPI along with the Bukkit thing (obviously) but on my first line of code which is simply
    Code:java
    1. public class VaultEchoPet extends JavaPlugin

    IntelliJ doesn't recognize JavaPlugin, So I must be doing something wrong... I have watched a tutorial, read a few threads on bukkit and yet, I haven't figured out what I am doing wrong, here is my pom.xml if that helps
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <project xmlns="http://maven.apache.org/POM/4.0.0"
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
        <modelVersion>4.0.0</modelVersion>
     
        <groupId>acer5999</groupId>
        <artifactId>VaultEchoPet</artifactId>
        <version>1.0-SNAPSHOT</version>
        <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
            <modelVersion>4.0.0</modelVersion>
     
            <groupId>com.acer5999.ev</groupId>
            <artifactId>VaultEchoPet</artifactId>
            <version>1.0</version>
            <packaging>jar</packaging>
            <name>VaultEchopet</name>
            <description>Vault Echo Pet</description>
     
            <properties>
                <bukkit.version>1.7.9-R0.3-SNAPSHOT</bukkit.version>
            </properties>
     
            <repositories>
                <repository>
                    <id>bukkit-repo</id>
                    <url>http://repo.bukkit.org/content/groups/public/</url>
                </repository>
                <repository>
                    <id>vault-repo</id>
                    <url>http://nexus.theyeticave.net/content/repositories/pub_releases</url>
                </repository>
                <repository>
                    <id>hawk-repo</id>
                    <url>http://ci.hawkfalcon.com/plugin/repository/everything/</url>
                </repository>
            </repositories>
     
            <dependencies>
                <dependency>
                    <groupId>org.bukkit</groupId>
                    <artifactId>bukkit</artifactId>
                    <version>1.7.9-R0.3-SNAPSHOT</version>
                    <scope>provided</scope>
                </dependency>
                <dependency>
                    <groupId>com.dsh105<groupId>
                    <artifactId>EchoPet</artifactId>
                    <version>2.3.3</version>
                </dependency>
                <dependency>
                    <groupId>net.milkbowl.vault</groupId>
                    <artifactId>VaultAPI</artifactId>
                    <version>1.4</version>
                    <scope>provided</scope>
                </dependency>
            </dependencies>
     
            <build>
                <sourceDirectory>src/main/java</sourceDirectory>
                <finalName>VaultEchoPet</finalName>
                <resources>
                    <resource>
                        <targetPath>.</targetPath>
                        <directory>src/main/resources</directory>
                        <includes>
                            <include>*.yml</include>
                        </includes>
                        <filtering>true</filtering>
                    </resource>
                </resources>
                <plugins>
                    <plugin>
                        <artifactId>maven-compiler-plugin</artifactId>
                        <version>2.3.2</version>
                        <configuration>
                            <source>1.6</source>
                            <target>1.6</target>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </project>
     
     
    </project>
    Note: I'm pretty darn sure I have Maven installed but I suck at following instructions so I could be wrong...
    Regards,
    Acer
     
  2. Offline

    techboy291

    I'm not very familiar with IntelliJ, but it needs the Bukkit jar to be in the local maven repository for it to be used. Try

    Code:
    mvn clean
    
    in your plugin directory where the pom is located, so maven can copy the jar from the bukkit repo to your local one, then restart IntelliJ.
     
  3. Offline

    RingOfStorms

    Are you sure your module is recognized as a Maven project? When you import the project or create you have to select Maven as the type of project.
     
  4. Offline

    acer5999

    I'm assuming that if I type mvn, and it's unrecognized that I have messed up the installation of Maven?
     
  5. Offline

    techboy291

    Yep :p
     
  6. Offline

    acer5999

    I have followed the steps exactly, I have all the Enviroment Variables, anything that you think is a common mistake that people have when installing maven?

    :D So I got it working, I had to delete the other things the Path variable and then just use %M2% but there is still the question of intellJ working... I'll update when it works

    Edit: I ran Maven Clear in the directory and it found the pom good and stuff but it gave me an error right away on line 11 (Generated by IntelliJ)
    Code:
        <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    thats the line it errors on and here is the error
    Code:
    [ERROR]    Non-parseable POM C:\Users\user 1\Desktop\VaultEchoPet\pom.xml: Unre
    cognised tag: 'project' (position: START_TAG seen ...apache.org/POM/4.0.0 http:/
    /maven.apache.org/xsd/maven-4.0.0.xsd">... @11:113)  @ line 11, column 113 -> [H
    elp 2]
    I then proceeded to run a full stack trace and I got back well... Alot of errors.
    Code:
    [ERROR]    Non-parseable POM C:\Users\user 1\Desktop\VaultEchoPet\pom.xml: Unre
    cognised tag: 'project' (position: START_TAG seen ...apache.org/POM/4.0.0 http:/
    /maven.apache.org/xsd/maven-4.0.0.xsd">... @11:113)  @ line 11, column 113 -> [H
    elp 2]
    If anyone could help, it would be much appreciated
    Regards,
    Acer

    Edit of my Edit:
    I pasted the wrong error in the second one and I used -e when I should have been using -X, the real errors are
    Code:
    Apache Maven 3.0.5 (r01de14724cdef164cd33c7c8c2fe155faf9602da; 2013-02-19 05:51:
    28-0800)
    Maven home: C:\Program Files\Maven
    Java version: 1.8.0_05, vendor: Oracle Corporation
    Java home: C:\Program Files (x86)\Java\jdk1.8.0_05\jre
    Default locale: en_US, platform encoding: Cp1252
    OS name: "windows 8", version: "6.2", arch: "x86", family: "dos"
    [INFO] Error stacktraces are turned on.
    [DEBUG] Reading global settings from C:\Program Files\Maven\conf\settings.xml
    [DEBUG] Reading user settings from C:\Users\user 1\.m2\settings.xml
    [DEBUG] Using local repository at C:\Users\user 1\.m2\repository
    [DEBUG] Using manager EnhancedLocalRepositoryManager with priority 10 for C:\Use
    rs\user 1\.m2\repository
    [INFO] Scanning for projects...
    [ERROR] The build could not read 1 project -> [Help 1]
    org.apache.maven.project.ProjectBuildingException: Some problems were encountere
    d while processing the POMs:
    [FATAL] Non-parseable POM C:\Users\user 1\Desktop\VaultEchoPet\pom.xml: Unrecogn
    ised tag: 'project' (position: START_TAG seen ...apache.org/POM/4.0.0 http://mav
    en.apache.org/xsd/maven-4.0.0.xsd">... @11:113)  @ line 11, column 113
     
            at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBu
    ilder.java:363)
            at org.apache.maven.DefaultMaven.collectProjects(DefaultMaven.java:636)
            at org.apache.maven.DefaultMaven.getProjectsForMavenReactor(DefaultMaven
    .java:585)
            at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:234)
            at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
            at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
            at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
            at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
    java:62)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
    sorImpl.java:43)
            at java.lang.reflect.Method.invoke(Method.java:483)
            at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Laun
    cher.java:290)
            at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.jav
    a:230)
            at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(La
    uncher.java:409)
            at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:
    352)
    [ERROR]
    [ERROR]  The project  (C:\Users\user 1\Desktop\VaultEchoPet\pom.xml) has 1 erro
    r
    [ERROR]    Non-parseable POM C:\Users\user 1\Desktop\VaultEchoPet\pom.xml: Unre
    cognised tag: 'project' (position: START_TAG seen ...apache.org/POM/4.0.0 http:/
    /maven.apache.org/xsd/maven-4.0.0.xsd">... @11:113)  @ line 11, column 113 -> [H
    elp 2]
    org.apache.maven.model.io.ModelParseException: Unrecognised tag: 'project' (posi
    tion: START_TAG seen ...apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4
    .0.0.xsd">... @11:113)
            at org.apache.maven.model.io.DefaultModelReader.read(DefaultModelReader.
    java:127)
            at org.apache.maven.model.io.DefaultModelReader.read(DefaultModelReader.
    java:91)
            at org.apache.maven.model.building.DefaultModelProcessor.read(DefaultMod
    elProcessor.java:77)
            at org.apache.maven.model.building.DefaultModelBuilder.readModel(Default
    ModelBuilder.java:456)
            at org.apache.maven.model.building.DefaultModelBuilder.build(DefaultMode
    lBuilder.java:261)
            at org.apache.maven.model.building.DefaultModelBuilder.build(DefaultMode
    lBuilder.java:232)
            at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBu
    ilder.java:410)
            at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBu
    ilder.java:379)
            at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBu
    ilder.java:343)
            at org.apache.maven.DefaultMaven.collectProjects(DefaultMaven.java:636)
            at org.apache.maven.DefaultMaven.getProjectsForMavenReactor(DefaultMaven
    .java:585)
            at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:234)
            at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
            at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
            at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
            at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
    java:62)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
    sorImpl.java:43)
            at java.lang.reflect.Method.invoke(Method.java:483)
            at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Laun
    cher.java:290)
            at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.jav
    a:230)
            at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(La
    uncher.java:409)
            at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:
    352)
    Caused by: org.codehaus.plexus.util.xml.pull.XmlPullParserException: Unrecognise
    d tag: 'project' (position: START_TAG seen ...apache.org/POM/4.0.0 http://maven.
    apache.org/xsd/maven-4.0.0.xsd">... @11:113)
            at org.apache.maven.model.io.xpp3.MavenXpp3ReaderEx.checkUnknownElement(
    MavenXpp3ReaderEx.java:157)
            at org.apache.maven.model.io.xpp3.MavenXpp3ReaderEx.parseModel(MavenXpp3
    ReaderEx.java:2785)
            at org.apache.maven.model.io.xpp3.MavenXpp3ReaderEx.read(MavenXpp3Reader
    Ex.java:4631)
            at org.apache.maven.model.io.xpp3.MavenXpp3ReaderEx.read(MavenXpp3Reader
    Ex.java:4590)
            at org.apache.maven.model.io.DefaultModelReader.read(DefaultModelReader.
    java:118)
            ... 23 more
    [ERROR]
    [ERROR]
    [ERROR] For more information about the errors and possible solutions, please rea
    d the following articles:
    [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildin
    gException
    [ERROR] [Help 2] http://cwiki.apache.org/confluence/display/MAVEN/ModelParseExce
    ption
    I have, I did all that stuff, that's how the pom.xml started

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 9, 2016
  7. i dont use what you use but i do know that with eclipse you have to add the craft bukkit library and if you dont i get your error try looking up how to add it
     
  8. Offline

    acer5999

    Actually, I got everything working, I started a new project and copied in all the repositories and dependencies and after that didn't work I ran a mvn test in IntelliJ and turns out that I didn't copy and paste the settings.xml into the .m2 folder XD I'll mark this as solved thanks for all your help!
     
  9. Offline

    LordVakar

    #LatePost
    FrozenBattlesTeam
    If you don't know what he's doing, you should google Maven and use it sometime to build your jars.
     
Thread Status:
Not open for further replies.

Share This Page