Brian Wu
Brian Wu

Reputation: 1

Could not transfer artifact from/to central: Broken pipe

Getting this issue when trying to create a Maven web app. I've looked around on stack overflow and tried many possibilities, but none seem to work. Here's my pom.xml:

<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>3.3.0</version>
        <!-- lookup parent from repository -->
    </parent>
    <groupId>com.name</groupId>
    <artifactId>demo</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>demo</name>
    <description>Demo project for Spring Boot</description>
    <properties>
        <java.version>22</java.version>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-thymeleaf</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
            <scope>runtime</scope>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.postgresql</groupId>
            <artifactId>postgresql</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <excludes>
                        <exclude>
                            <groupId>org.projectlombok</groupId>
                            <artifactId>lombok</artifactId>
                        </exclude>
                    </excludes>
                </configuration>
            </plugin>
        </plugins>
    </build>
    <repositories>
        <repository>
            <id>central</id>
            <url>https://repo.maven.apache.org/maven2</url>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>
    </repositories>
</project>

I'm not on company network or anything, so I don't believe I need a proxy. I've tried running "mvn clean install -U", checked my PATH variable, reloading the project, and several other things. I am on mac M1 Sonoma and using IntelliJ CE. Any help is appreciated!

Upvotes: 0

Views: 208

Answers (2)

Brian Wu
Brian Wu

Reputation: 1

Resolved. It was my McAfee content filter that was blocking connection to central repo. I had to disable it in system settings

Upvotes: 0

Girdhar Singh Rathore
Girdhar Singh Rathore

Reputation: 5585

You can try update your maven configuration.

You can update settings.xml file in the Maven conf directory (usually located at /path/to/maven/conf/settings.xml) or you can create settings.xml if not present.

Example Locations of settings.xml

Windows: C:\Users\YourUsername\.m2\settings.xml

macOS: /Users/YourUsername/.m2/settings.xml

Linux: /home/YourUsername/.m2/settings.xml

and remove the repositories config from pom.xml

add setting.xml file

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
  
  <mirrors>
    <!-- Mirror for Maven Central -->
    <mirror>
      <id>central</id>
      <mirrorOf>central</mirrorOf>
      <url>https://repo.maven.apache.org/maven2</url>
    
    </mirror>
  </mirrors>
  
  
</settings>

Upvotes: 0

Related Questions