Klue
Klue

Reputation: 1357

Specified destination directory cannot be created: /home/gosper/.m2/repository/io/swagger/swagger-jersey-jaxrs/1.5.8

I used swaggerhub.com to generate the server side code template (spring mvc server).

When I open the template project in IntelliJIDEA, it seems to unable to resolve some dependencies.

This is my pom.xml

<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/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>io.swagger</groupId>
  <artifactId>swagger-spring-mvc-server</artifactId>
  <packaging>jar</packaging>
  <name>swagger-spring-mvc-server</name>
  <version>1.0.0</version>
  <build>
    <sourceDirectory>src/main/java</sourceDirectory>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-war-plugin</artifactId>
        <version>2.6</version>
      </plugin>
      <plugin>
        <artifactId>maven-failsafe-plugin</artifactId>
        <version>2.6</version>
        <executions>
          <execution>
            <goals>
              <goal>integration-test</goal>
              <goal>verify</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.eclipse.jetty</groupId>
        <artifactId>jetty-maven-plugin</artifactId>
        <version>${jetty-version}</version>
        <configuration>
          <webAppConfig>
            <contextPath>/v1</contextPath>
          </webAppConfig>
          <webAppSourceDirectory>target/${project.artifactId}-${project.version}</webAppSourceDirectory>
          <stopPort>8079</stopPort>
          <stopKey>stopit</stopKey>
          <httpConnector>
            <port>8002</port>
            <idleTimeout>60000</idleTimeout>
          </httpConnector>
        </configuration>
        <executions>
          <execution>
            <id>start-jetty</id>
            <phase>pre-integration-test</phase>
            <goals>
              <goal>start</goal>
            </goals>
            <configuration>
              <scanIntervalSeconds>0</scanIntervalSeconds>
              <daemon>true</daemon>
            </configuration>
          </execution>
          <execution>
            <id>stop-jetty</id>
            <phase>post-integration-test</phase>
            <goals>
              <goal>stop</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
  <dependencies>
    <dependency>
      <groupId>io.swagger</groupId>
      <artifactId>swagger-jersey-jaxrs</artifactId>
      <version>${swagger-core-version}</version>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-log4j12</artifactId>
      <version>${slf4j-version}</version>
    </dependency>

    <!--Spring dependencies -->
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-core</artifactId>
      <version>${spring-version}</version>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-webmvc</artifactId>
      <version>${spring-version}</version>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-web</artifactId>
      <version>${spring-version}</version>
    </dependency>

    <!--SpringFox dependencies-->
    <dependency>
      <groupId>io.springfox</groupId>
      <artifactId>springfox-swagger2</artifactId>
      <version>${springfox-version}</version>
    </dependency>
    <dependency>
      <groupId>io.springfox</groupId>
      <artifactId>springfox-swagger-ui</artifactId>
      <version>${springfox-version}</version>
    </dependency>

    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>${junit-version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>javax.servlet</groupId>
      <artifactId>servlet-api</artifactId>
      <version>${servlet-api-version}</version>
    </dependency>
  </dependencies>
  <properties>
    <swagger-core-version>1.5.8</swagger-core-version>
    <jetty-version>9.2.15.v20160210</jetty-version>
    <jersey-version>1.13</jersey-version>
    <slf4j-version>1.7.21</slf4j-version>
    <junit-version>4.12</junit-version>
    <servlet-api-version>2.5</servlet-api-version>
    <springfox-version>2.4.0</springfox-version>
    <spring-version>4.2.5.RELEASE</spring-version>
  </properties>
</project>

Here is the error stack:

Failed to collect dependencies for [io.swagger:swagger-jersey-jaxrs:jar:1.5.8 (compile), org.slf4j:slf4j-log4j12:jar:1.7.21 (compile), org.springframework:spring-core:jar:4.2.5.RELEASE (compile), org.springframework:spring-webmvc:jar:4.2.5.RELEASE (compile), org.springframework:spring-web:jar:4.2.5.RELEASE (compile), io.springfox:springfox-swagger2:jar:2.4.0 (compile), io.springfox:springfox-swagger-ui:jar:2.4.0 (compile), junit:junit:jar:4.12 (test), javax.servlet:servlet-api:jar:2.5 (compile)]: Failed to read artifact descriptor for io.swagger:swagger-jersey-jaxrs:jar:1.5.8: Could not transfer artifact io.swagger:swagger-jersey-jaxrs:pom:1.5.8 from/to central (http://repo.maven.apache.org/maven2): Specified destination directory cannot be created: /home/gosper/.m2/repository/io/swagger/swagger-jersey-jaxrs/1.5.8 -> [Help 1]

Upvotes: 0

Views: 1975

Answers (1)

Klue
Klue

Reputation: 1357

To solve this issue, I had to go to ~/.m2 and execute sudo find repository -exec chmod a+rwx {} ";" This was the problem with permissions.

Upvotes: 0

Related Questions