Domanda

I would like to add junit 4.10 to my dependencies for my pom.xml and also 2 other denpencies found https://code.google.com/p/google-gson/downloads/list and here https://code.google.com/p/mnist-tools/downloads/detail?name=mnist-tools.zip&can=2&q=

But I have no idea how to add them to the pom.xml file using the m2eclipse plugin

Also my file structure for my maven project can be found here: https://github.com/quinnliu/WalnutiQ

I was wondering if my file structure is going to be a problem? I do name all of my test classes like *Test.java For example ExampleClass.java has a corresponding file ExampleClassTest.java

This is my pom.xml file so far:

<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>WalnutiQ</groupId>
  <artifactId>WalnutiQ</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <build>
    <sourceDirectory>src</sourceDirectory>
    <testSourceDirectory>tests</testSourceDirectory>
    <resources>
      <resource>
        <directory>train</directory>
        <excludes>
          <exclude>**/*.java</exclude>
        </excludes>
      </resource>
      <resource>
        <directory>images</directory>
        <excludes>
          <exclude>**/*.java</exclude>
        </excludes>
      </resource>
    </resources>
    <testResources>
      <testResource>
        <directory>tests</directory>
        <excludes>
          <exclude>**/*.java</exclude>
        </excludes>
      </testResource>
    </testResources>
    <plugins>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.1</version>
        <configuration>
          <source/>
          <target/>
        </configuration>
      </plugin>
    </plugins>
  </build>
</project>
È stato utile?

Soluzione

Gson is available in maven, so you can just add a dependency, see http://search.maven.org/#artifactdetails|com.google.code.gson|gson|2.2.4|jar, it has the snippet you need for your pom.

If mnist-tools isn't in a maven repo anywhere, you can add it to your local repo using mvn install-file.

Your structure probably looks like it would work (you tell us, does it?), but unless there's a good reason to change it, stick with the default structure maven uses. I.e. src/main/java, src/main/resources, src/test/java etc. If I add more I usually try to keep them in the same structure e.g. src/main/scripts

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top