enricher/standard/src/main/java/io/fabric8/maven/enricher/standard/DefaultServiceEnricher.java
private ServicePort parsePortMapping(String port) {
        Matcher matcher = PORT_MAPPING_PATTERN.matcher(port);
        if (!matcher.matches()) {
            log.error("Invalid 'port' configuration '%s'. Must match <port>(:<targetPort>)?,<port2>?,...", port);
            throw new IllegalArgumentException("Invalid port mapping specification " + port);
        }

        int servicePort = Integer.parseInt(matcher.group("port"));
        String optionalTargetPort = matcher.group("targetPort");
        String protocol = getProtocol(matcher.group("protocol"));

        ServicePortBuilder builder = new ServicePortBuilder()
            .withPort(servicePort)
            .withProtocol(protocol)
            .withName(getDefaultPortName(servicePort, protocol));

        // leave empty if not set. will be filled up with the port from the image config
        if (optionalTargetPort != null) {
            builder.withNewTargetPort(Integer.parseInt(optionalTargetPort));
        }
        return builder.build();
    }
private ServicePort parsePortMapping(String port) {
        Matcher matcher = PORT_MAPPING_PATTERN.matcher(port);
        if (!matcher.matches()) {
            log.error("Invalid 'port' configuration '%s'. Must match <port>(:<targetPort>)?,<port2>?,...", port);
            throw new IllegalArgumentException("Invalid port mapping specification " + port);
        }

        int servicePort = Integer.parseInt(matcher.group("port"));
        String optionalTargetPort = matcher.group("targetPort");
        String protocol = getProtocol(matcher.group("protocol"));

        ServicePortBuilder builder = new ServicePortBuilder()
            .withPort(servicePort)
            .withProtocol(protocol)
            .withName(getDefaultPortName(servicePort, protocol));

        // leave empty if not set. will be filled up with the port from the image config
        if (optionalTargetPort != null) {
            builder.withNewTargetPort(Integer.parseInt(optionalTargetPort));
        }
        return builder.build();
    }
private ServicePort parsePortMapping ( String port ) { Matcher matcher = PORT_MAPPING_PATTERN . matcher ( port ) ; if ( ! matcher . matches ( ) ) { log . error ( "Invalid 'port' configuration '%s'. Must match <port>(:<targetPort>)?,<port2>?,..." , port ) ; throw new IllegalArgumentException ( "Invalid port mapping specification " + port ) ; } int servicePort = Integer . parseInt ( matcher . group ( "port" ) ) ; String optionalTargetPort = matcher . group ( "targetPort" ) ; String protocol = getProtocol ( matcher . group ( "protocol" ) ) ; ServicePortBuilder builder = new ServicePortBuilder ( ) . withPort ( servicePort ) . withProtocol ( protocol ) . withName ( getDefaultPortName ( servicePort , protocol ) ) ; // leave empty if not set. will be filled up with the port from the image config if ( optionalTargetPort != null ) { builder . withNewTargetPort ( Integer . parseInt ( optionalTargetPort ) ) ; } return builder . build ( ) ; }
parse config specified ports
parse config specified ports